diff z80_to_x86.c @ 1117:928a65750345

Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
author Michael Pavone <pavone@retrodev.com>
date Thu, 22 Dec 2016 19:51:25 -0800
parents fe8c79f82c22
children 8f14767661fa
line wrap: on
line diff
--- a/z80_to_x86.c	Thu Dec 22 10:51:33 2016 -0800
+++ b/z80_to_x86.c	Thu Dec 22 19:51:25 2016 -0800
@@ -3476,7 +3476,7 @@
 	call(code, options->gen.load_context);
 	jmp_r(code, options->gen.scratch1);
 
-	options->run = (z80_run_fun)code->cur;
+	options->run = code->cur;
 	tmp_stack_off = code->stack_off;
 	save_callee_save_regs(code);
 #ifdef X86_64
@@ -3525,8 +3525,8 @@
 			}
 			while (context->current_cycle < context->sync_cycle)
 			{
-				if (context->int_pulse_end < context->current_cycle || context->int_pulse_end == CYCLE_NEVER) {
-					z80_next_int_pulse(context);
+				if (context->next_int_pulse && (context->int_pulse_end < context->current_cycle || context->int_pulse_end == CYCLE_NEVER)) {
+					context->next_int_pulse(context);
 				}
 				if (context->iff1) {
 					context->int_cycle = context->int_pulse_start < context->int_enable_cycle ? context->int_enable_cycle : context->int_pulse_start;
@@ -3623,7 +3623,9 @@
 		if (context->int_pulse_end < deduction) {
 			context->int_pulse_start = context->int_pulse_end = CYCLE_NEVER;
 		} else {
-			context->int_pulse_end -= deduction;
+			if (context->int_pulse_end != CYCLE_NEVER) {
+				context->int_pulse_end -= deduction;
+			}
 			if (context->int_pulse_start < deduction) {
 				context->int_pulse_start = 0;
 			} else {