apple1-videocard-lib/demo_interrupt.h
2021-12-08 12:53:13 +01:00

45 lines
1.0 KiB
C

// TODO make it static once KickC bug is fixed
byte last_seconds = 0;
void demo_interrupt() {
// resets the watch to 00:00:00.0
_ticks = 0;
_seconds = 0;
_minutes = 0;
_hours = 0;
// installs the interrupt handler routine
install_interrupt();
// enables interrupts on the TMS9918
tms_interrupt(1);
woz_puts("INTERRUPT INSTALLED\r");
woz_puts("0 TURNS OFF\r");
woz_puts("1 TURNS ON\r");
woz_puts("E EXIT TO MAIN MENU\r");
for(;;) {
if(keypressed()) {
byte k = woz_getkey();
if(k=='1') tms_interrupt(1);
else if(k=='0') tms_interrupt(0);
else if(k=='E') break;
}
if(last_seconds != _seconds) {
woz_put_hex(_hours); woz_putc(':');
woz_put_hex(_minutes); woz_putc(':');
woz_put_hex(_seconds); woz_putc('.');
woz_put_hex(_ticks); woz_putc('\r');
last_seconds = _seconds;
}
}
// disables interrupts on the TMS9918
tms_interrupt(0);
woz_puts("INTERRUPT STOPPED\r");
}