comparison blastem.c @ 335:14a937097c2b

Some Z80 interrupt fixes
author Mike Pavone <pavone@retrodev.com>
date Tue, 14 May 2013 21:59:56 -0700
parents f16136a3835d
children 87b65e5ce1ab
comparison
equal deleted inserted replaced
334:4c91470e1a53 335:14a937097c2b
168 need_reset = 0; 168 need_reset = 0;
169 } 169 }
170 z_context->sync_cycle = mclks / MCLKS_PER_Z80; 170 z_context->sync_cycle = mclks / MCLKS_PER_Z80;
171 uint32_t vint_cycle = vdp_next_vint_z80(gen->vdp) / MCLKS_PER_Z80; 171 uint32_t vint_cycle = vdp_next_vint_z80(gen->vdp) / MCLKS_PER_Z80;
172 while (z_context->current_cycle < z_context->sync_cycle) { 172 while (z_context->current_cycle < z_context->sync_cycle) {
173 if (z_context->iff1 && z_context->current_cycle < ZVINT_CYCLE) { 173 if (z_context->iff1 && z_context->current_cycle < vint_cycle) {
174 z_context->int_cycle = vint_cycle; 174 z_context->int_cycle = vint_cycle < z_context->int_enable_cycle ? z_context->int_enable_cycle : vint_cycle;
175 } 175 }
176 z_context->target_cycle = z_context->sync_cycle < z_context->int_cycle ? z_context->sync_cycle : z_context->int_cycle; 176 z_context->target_cycle = z_context->sync_cycle < z_context->int_cycle ? z_context->sync_cycle : z_context->int_cycle;
177 dprintf("Running Z80 from cycle %d to cycle %d. Native PC: %p\n", z_context->current_cycle, z_context->sync_cycle, z_context->native_pc); 177 dprintf("Running Z80 from cycle %d to cycle %d. Native PC: %p\n", z_context->current_cycle, z_context->sync_cycle, z_context->native_pc);
178 z80_run(z_context); 178 z80_run(z_context);
179 dprintf("Z80 ran to cycle %d\n", z_context->current_cycle); 179 dprintf("Z80 ran to cycle %d\n", z_context->current_cycle);