Changeset 0726522 in buchla-emu for emu


Ignore:
Timestamp:
07/29/2017 10:40:29 PM (7 years ago)
Author:
Thomas Lopatic <thomas@…>
Branches:
master
Children:
a6da9fb
Parents:
375f7fb
Message:

Support ASCII BEL code (G).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • emu/ser.c

    r375f7fb r0726522  
    2222#define ver3(...) _ver(ser_verbose, 2, __VA_ARGS__)
    2323
     24#define BEL_CYC 10000
     25
    2426#define CON_W 80
    2527#define CON_H 25
    2628
    2729#define CON_BGR 0x00000000
     30#define CON_BEL 0x00808080
    2831#define CON_CUR 0x00e87000
    2932#define CON_FGR ((SDL_Color){ .r = 255, .b = 255, .g = 255, .a = 255 })
     
    5962
    6063static int32_t cur_x = 0, cur_y = 0;
     64static int32_t bel = 0;
    6165
    6266static void out(int32_t un, uint8_t c)
     
    6973static void update(void)
    7074{
    71         if (SDL_FillRect(sur, NULL, CON_BGR) < 0) {
     75        if (SDL_FillRect(sur, NULL, bel == 0 ? CON_BGR : CON_BEL) < 0) {
    7276                fail("SDL_FillRect() failed: %s", SDL_GetError());
    7377        }
     
    179183                        break;
    180184
     185                case '\a':
     186                        bel = BEL_CYC;
     187                        break;
     188
    181189                default:
    182190                        echo('^');
     
    274282{
    275283        ver3("ser exec");
     284
     285        if (bel > 0) {
     286                --bel;
     287
     288                if (bel == BEL_CYC - 1 || bel == 0) {
     289                        update();
     290                }
     291        }
     292
    276293        return state[0].irq_r || state[0].irq_t || state[1].irq_r || state[1].irq_t;
    277294}
Note: See TracChangeset for help on using the changeset viewer.