void trs_timer_event(void) { if (timer_on) { trs_timer_interrupt(1); /* generate */ trs_disk_motoroff_interrupt(trs_disk_motoroff()); trs_kb_heartbeat(); /* part of keyboard stretch kludge */ } }
unsigned char trs_interrupt_latch_read() { unsigned char tmp = interrupt_latch; if (trs_model == 1) { trs_timer_interrupt(0); /* acknowledge this one (only) */ z80_state.irq = (interrupt_latch != 0); return tmp; } else { return ~tmp; } }
/* Handle reset button if poweron=0; handle hard reset or initial poweron if poweron=1 */ void trs_reset(int poweron) { trs_emu_mouse = FALSE; #ifndef ANDROID /* Close disks opened by Z80 programs */ do_emt_resetdisk(); #endif /* Reset devices (Model I SYSRES, Model III/4 RESET) */ trs_cassette_reset(); trs_timer_speed(0); trs_disk_init(poweron); // also inits trs_hard and trs_stringy /* I'm told that the hard disk controller is enabled on powerup */ /* XXX should trs_hard_init do this, then? */ trs_hard_out(TRS_HARD_CONTROL, TRS_HARD_SOFTWARE_RESET|TRS_HARD_DEVICE_ENABLE); if (trs_model == 5) { /* Switch in boot ROM */ z80_out(0x9C, 1); } if (trs_model >= 4) { /* Turn off various memory map and video mode bits */ z80_out(0x84, 0); } if (trs_model >= 3) { grafyx_write_mode(0); trs_interrupt_mask_write(0); trs_nmi_mask_write(0); } if (trs_model == 3) { grafyx_m3_reset(); } if (trs_model == 1) { hrg_onoff(0); /* Switch off HRG1B hi-res graphics. */ } trs_kb_reset(); /* Part of keyboard stretch kludge */ trs_cancel_event(); trs_timer_interrupt(0); if (poweron || trs_model >= 4) { /* Reset processor */ z80_reset(); } else { /* Signal a nonmaskable interrupt. */ trs_reset_button_interrupt(1); trs_schedule_event(trs_reset_button_interrupt, 0, 2000); } }