int TraceCpuInt(Z80EX_CONTEXT *cpu) { CpuTrace_Log(); int dt = z80ex_int(cpu); cpuTrace_dT += dt; cpuTrace_intReq++; return dt; }
static void xep128_emulation ( void ) { emu_timekeeping_check(); for (;;) { int t; if (XEMU_UNLIKELY(paused && !z80ex.prefix)) { /* Paused is non-zero for special cases, like pausing emulator :) or single-step execution mode We only do this if z80ex.prefix is non-zero, ie not in the "middle" of a prefixed Z80 opcode or so ... */ __emu_one_frame(312, 0); // keep UI stuffs (and some timing) intact ... with a faked about 312 scanline (normal frame) timing needed ... return; } if (XEMU_UNLIKELY(nmi_pending)) { t = z80ex_nmi(); DEBUG("NMI: %d" NL, t); if (t) nmi_pending = 0; } else t = 0; //if (XEMU_UNLIKELY((dave_int_read & 0xAA) && t == 0)) { if ((dave_int_read & 0xAA) && t == 0) { t = z80ex_int(); if (t) DEBUG("CPU: int and accepted = %d" NL, t); } else t = 0; if (XEMU_LIKELY(!t)) t = z80ex_step(); cpu_cycles_for_dave_sync += t; //DEBUG("DAVE: SYNC: CPU cycles = %d, Dave sync val = %d, limit = %d" NL, t, cpu_cycles_for_dave_sync, cpu_cycles_per_dave_tick); while (cpu_cycles_for_dave_sync >= cpu_cycles_per_dave_tick) { dave_tick(); cpu_cycles_for_dave_sync -= cpu_cycles_per_dave_tick; } balancer += t * SCALER; //DEBUG("%s [balance=%f t=%d]" NL, buffer, balancer, t); while (balancer >= 0.5) { nick_render_slot(); balancer -= 1.0; if (XEMU_UNLIKELY(emu_one_frame_rasters != -1)) { __emu_one_frame( emu_one_frame_rasters, emu_one_frame_frameskip ); emu_one_frame_rasters = -1; return; } } //DEBUG("[balance=%f t=%d]" NL, balancer, t); } }
// main cycle void zx_life( int *running ) { while ( *running ) { while ( zxcpu_tstates_main < zxcpu_tstates_frame ) { if ((zxcpu_tstates_main >= zxcpu_int_start) && (zxcpu_tstates_main < zxcpu_int_end)) zxcpu_tstates_main += z80ex_int(zxcpu); zxcpu_tstates_main += z80ex_step(zxcpu); } if ( !zx_frame_new ) zx_frame_end(); zx_frame_new = 0; //zxcpu_tstates_main %= zxcpu_tstates_frame; while ( zxcpu_tstates_main >= zxcpu_tstates_frame ) \ zxcpu_tstates_main -= zxcpu_tstates_frame; } }
uint32_t Z80CPUBase::execute(uint32_t instructions) { if (m_context == 0) return 0; uint32_t Tstates = 0; while((instructions > 0) && (!m_isHalted)) { if (m_intPending) { if (z80ex_int(m_context) != 0) { m_intPending = false; } } Tstates += z80ex_step(m_context); instructions--; } return Tstates; }