diff sms.c @ 1377:e587f16e7d3d

Implemented SMS pause button
author Michael Pavone <pavone@retrodev.com>
date Sun, 28 May 2017 21:03:55 -0700
parents 5b20840711c1
children 65f1d6558e9e
line wrap: on
line diff
--- a/sms.c	Sun May 28 21:02:47 2017 -0700
+++ b/sms.c	Sun May 28 21:03:55 2017 -0700
@@ -193,7 +193,7 @@
 {
 	render_disable_ym();
 	sms_context *sms = (sms_context *)system;
-	uint32_t target_cycle = sms->z80->current_cycle + 3420*262;
+	uint32_t target_cycle = sms->z80->current_cycle + 3420*16;
 	//TODO: PAL support
 	render_set_video_standard(VID_NTSC);
 	while (!sms->should_return)
@@ -202,6 +202,12 @@
 			system->enter_debugger = 0;
 			zdebugger(sms->z80, sms->z80->pc);
 		}
+		if (sms->z80->nmi_start == CYCLE_NEVER) {
+			uint32_t nmi = vdp_next_nmi(sms->vdp);
+			if (nmi != CYCLE_NEVER) {
+				z80_assert_nmi(sms->z80, nmi);
+			}
+		}
 		z80_run(sms->z80, target_cycle);
 		if (sms->z80->reset) {
 			z80_clear_reset(sms->z80, sms->z80->current_cycle + 128*15);
@@ -209,7 +215,7 @@
 		target_cycle = sms->z80->current_cycle;
 		vdp_run_context(sms->vdp, target_cycle);
 		psg_run(sms->psg, target_cycle);
-		target_cycle += 3420*262;
+		target_cycle += 3420*16;
 		if (target_cycle > 0x10000000) {
 			uint32_t adjust = sms->z80->current_cycle - 3420*262*2;
 			io_adjust_cycles(sms->io.ports, sms->z80->current_cycle, adjust);
@@ -355,6 +361,7 @@
 	sms->header.soft_reset = soft_reset;
 	sms->header.inc_debug_mode = inc_debug_mode;
 	sms->header.inc_debug_pal = inc_debug_pal;
+	sms->header.type = SYSTEM_SMS;
 	
 	return sms;
 }
\ No newline at end of file