void scld_dec_write( libspectrum_word port GCC_UNUSED, libspectrum_byte b ) { scld old_dec = scld_last_dec; scld new_dec; libspectrum_byte ink,paper; /* We use new_dec as we don't want to have the new colours, modes etc. to take effect until we have updated the critical region */ new_dec.byte = b; /* If we changed the active screen, or change the colour in hires * mode, update the critical region and mark the entire display file as * dirty so we redraw it on the next pass */ if( new_dec.mask.scrnmode != old_dec.mask.scrnmode || new_dec.name.hires != old_dec.name.hires || ( new_dec.name.hires && ( new_dec.mask.hirescol != old_dec.mask.hirescol ) ) ) { display_update_critical( 0, 0 ); display_refresh_main_screen(); } /* Commit change to scld_last_dec */ scld_last_dec = new_dec; /* If we just reenabled interrupts, check for a retriggered interrupt */ if( old_dec.name.intdisable && !scld_last_dec.name.intdisable ) z80_interrupt(); if( scld_last_dec.name.altmembank != old_dec.name.altmembank ) machine_current->memory_map(); display_parse_attr( hires_get_attr(), &ink, &paper ); display_set_hires_border( paper ); }
static void z80_interrupt_event_fn( libspectrum_dword tstates, int type, void *user_data ) { /* Retriggered interrupt; firstly, ignore if we're doing RZX playback as all interrupts are generated by the RZX code */ if( rzx_playback ) return; /* Otherwise, see if we actually accept an interrupt. If we do and we're doing RZX recording, store a frame */ if( z80_interrupt() ) rzx_frame(); }
static void spectrum_frame_event_fn( libspectrum_dword last_tstates, int type, void *user_data ) { if( rzx_playback ) event_force_events(); rzx_frame(); psg_frame(); spectrum_frame(); z80_interrupt(); ui_joystick_poll(); timer_estimate_speed(); debugger_add_time_events(); ui_event(); ui_error_frame(); }
int z80_do_opcode( void ) { if(z80_iline) { if(z80_interrupt()) { int ret = z80_tstates - last_z80_tstates; last_z80_tstates = z80_tstates; return(ret); } } uint8 opcode; /* Check to see if M1 cycles happen on even z80_tstates */ //if( z80_tstates & 1 ) // z80_tstates++; //uint16 lastpc = PC; opcode = Z80_RB_MACRO( PC ); //printf("Z80-op: %04x, %02x\n", PC, opcode); z80_tstates++; PC++; R++; switch(opcode) { #include "opcodes_base.c" } int ret = z80_tstates - last_z80_tstates; last_z80_tstates = z80_tstates; //printf("PC: %04x, %02x, time=%d\n", lastpc, opcode, ret); return(ret); }