summaryrefslogtreecommitdiff
path: root/sms.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2016-12-28 12:28:52 -0800
committerMichael Pavone <pavone@retrodev.com>2016-12-28 12:28:52 -0800
commit96d5581219aec6c49fadaaf1d30623c0f2eed358 (patch)
tree560c0cfaa52f1183cd4b2b6adec9247abc921eb0 /sms.c
parente2e00fe60bcc9ff0e8f76cf3f9e4ef17113b4519 (diff)
Enabled Z80 debugger in PBC mode
Diffstat (limited to 'sms.c')
-rw-r--r--sms.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sms.c b/sms.c
index 5e3b9a9..79fb78b 100644
--- a/sms.c
+++ b/sms.c
@@ -5,6 +5,7 @@
#include "blastem.h"
#include "render.h"
#include "util.h"
+#include "debug.h"
static void *memory_io_write(uint32_t location, void *vcontext, uint8_t value)
{
@@ -119,6 +120,10 @@ static void run_sms(system_header *system)
uint32_t target_cycle = sms->z80->current_cycle + 3420*262;
while (!sms->should_return)
{
+ if (system->enter_debugger && sms->z80->pc) {
+ system->enter_debugger = 0;
+ zdebugger(sms->z80, sms->z80->pc);
+ }
z80_run(sms->z80, target_cycle);
target_cycle = sms->z80->current_cycle;
vdp_run_context(sms->vdp, target_cycle);
@@ -143,6 +148,11 @@ static void start_sms(system_header *system, char *statefile)
sms_context *sms = (sms_context *)system;
set_keybindings(&sms->io);
+ if (system->enter_debugger) {
+ system->enter_debugger = 0;
+ zinsert_breakpoint(sms->z80, 0, (uint8_t *)zdebugger);
+ }
+
z80_assert_reset(sms->z80, 0);
z80_clear_reset(sms->z80, 128*15);