diff 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
line wrap: on
line diff
--- a/blastem.c	Tue May 14 00:46:34 2013 -0700
+++ b/blastem.c	Tue May 14 21:59:56 2013 -0700
@@ -170,8 +170,8 @@
 		z_context->sync_cycle = mclks / MCLKS_PER_Z80;
 		uint32_t vint_cycle = vdp_next_vint_z80(gen->vdp) / MCLKS_PER_Z80;
 		while (z_context->current_cycle < z_context->sync_cycle) {
-			if (z_context->iff1 && z_context->current_cycle < ZVINT_CYCLE) {
-				z_context->int_cycle = vint_cycle;
+			if (z_context->iff1 && z_context->current_cycle < vint_cycle) {
+				z_context->int_cycle = vint_cycle < z_context->int_enable_cycle ? z_context->int_enable_cycle : vint_cycle;
 			}
 			z_context->target_cycle = z_context->sync_cycle < z_context->int_cycle ? z_context->sync_cycle : z_context->int_cycle;
 			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);