summaryrefslogtreecommitdiff
path: root/sms.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-01-27 22:30:52 -0800
committerMichael Pavone <pavone@retrodev.com>2017-01-27 22:30:52 -0800
commit256a86fc4048b377b6ef56511e7828f674deb00f (patch)
tree8270aeede1bfb1e17b9c779a354198b77258efd5 /sms.c
parentbeab1966ee7ba1d5821b119145396a4b39279bb1 (diff)
Implement SMS hardware soft reset (note only available on real hardware on the Genesis in PBC mode)
Diffstat (limited to 'sms.c')
-rw-r--r--sms.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sms.c b/sms.c
index c1a67db..0ccac57 100644
--- a/sms.c
+++ b/sms.c
@@ -202,6 +202,9 @@ static void run_sms(system_header *system)
zdebugger(sms->z80, sms->z80->pc);
}
z80_run(sms->z80, target_cycle);
+ if (sms->z80->reset) {
+ z80_clear_reset(sms->z80, sms->z80->current_cycle + 128*15);
+ }
target_cycle = sms->z80->current_cycle;
vdp_run_context(sms->vdp, target_cycle);
psg_run(sms->psg, target_cycle);
@@ -236,6 +239,13 @@ static void start_sms(system_header *system, char *statefile)
run_sms(system);
}
+static void soft_reset(system_header *system)
+{
+ sms_context *sms = (sms_context *)system;
+ z80_assert_reset(sms->z80, sms->z80->current_cycle);
+ sms->z80->target_cycle = sms->z80->sync_cycle = sms->z80->current_cycle;
+}
+
static void free_sms(system_header *system)
{
sms_context *sms = (sms_context *)system;
@@ -341,6 +351,7 @@ sms_context *alloc_configure_sms(system_media *media, uint32_t opts, uint8_t for
sms->header.free_context = free_sms;
sms->header.get_open_bus_value = get_open_bus_value;
sms->header.request_exit = request_exit;
+ sms->header.soft_reset = soft_reset;
sms->header.inc_debug_mode = inc_debug_mode;
sms->header.inc_debug_pal = inc_debug_pal;