From 447276d029a0dde0293adc1f10a917221d0c6efd Mon Sep 17 00:00:00 2001 From: Max Regan Date: Sun, 1 Jul 2018 22:32:59 -0700 Subject: [PATCH] boot_test: updates for changes to breakpoints Because now they actually stop in the correct place. Also, some other fixups because I'm too lazy to properly split patches for a personal project. --- gbdb_boot_test | 14 +++++++------- src/apps/gbdb.c | 4 +--- src/gbemu/cpu.c | 8 ++++---- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/gbdb_boot_test b/gbdb_boot_test index 9f29a38..38ab951 100644 --- a/gbdb_boot_test +++ b/gbdb_boot_test @@ -32,7 +32,7 @@ runto 0xc assert $pc == 0xc assert $hl == 0x7fff -step; step +step assert $pc == 0xf assert $hl == 0xff26 @@ -59,7 +59,7 @@ assert $c == 0x12 runto 0x27 assert $pc == 0x27 -step; step +step assert $pc == 0x28 step @@ -94,7 +94,7 @@ assert $pc == 0xa1 runto 0xa3 assert $pc == 0xa3 -step; step #FIXME: bugs +step assert $pc == 0xa4 @@ -116,11 +116,11 @@ assert $pc == 0x96 runto 0x34 assert $pc == 0x34 -step; step +step assert $pc == 0x37 assert $de == 0xd8 -step; +step assert $pc == 0x39 assert $b == 0x08 @@ -128,7 +128,7 @@ runto 0x40 assert $pc == 0x40 assert $b == 0 -step; step +step assert $pc == 0x42 assert $a == 0x19 @@ -151,7 +151,7 @@ runto 0x55 assert $a == 0 assert $pc == 0x55 -step; step +step assert $h == 0 assert $pc == 0x56 diff --git a/src/apps/gbdb.c b/src/apps/gbdb.c index 912359c..256fe90 100644 --- a/src/apps/gbdb.c +++ b/src/apps/gbdb.c @@ -227,7 +227,6 @@ static void step(char *arg_list) if (end_steps <= cpu.metrics.retired_instrs) { gb_log("CPU stopped after %" PRId64 " instructions\n", steps); } else if (paused_breakpoint) { - breakpoint_addr_hit(cpu.pc); gb_log("Breakpoint hit\n"); } else if (paused_signal){ gb_log("Interrupted\n"); @@ -482,7 +481,6 @@ static void do_run(void) { if (paused_signal) { gb_log("Interrupted.\n"); } else if (paused_breakpoint) { - breakpoint_addr_hit(cpu.pc); gb_log("Breakpoint hit\n"); } @@ -610,7 +608,7 @@ static void breakpoint_addr_hit(uint16_t addr) for (i = 0; i < num_breakpoints; i++) { if (breakpoints[i].addr == addr) { - bkpt= &breakpoints[i]; + bkpt = &breakpoints[i]; break; } } diff --git a/src/gbemu/cpu.c b/src/gbemu/cpu.c index c7ba00d..5098ec1 100644 --- a/src/gbemu/cpu.c +++ b/src/gbemu/cpu.c @@ -393,8 +393,7 @@ void lr35902_cycle(struct lr35902_state *cpu) WRITE_BIT(cpu->a, 7, cpu->cf); break; case 0x10: /* STOP */ - //TODO: - //cpu->stopped = true; + ASSERT(0); //TODO: Implement me break; case 0x11: /* LD DE, d16 */ LD_D16(cpu, cpu->de); @@ -1409,10 +1408,11 @@ void lr35902_cycle(struct lr35902_state *cpu) POP_16(cpu, cpu->hl); break; case 0xe2: + cpu->mem_write(cpu, 0xff00 + cpu->c, cpu->a); + break; case 0xe3: /* UNDEF */ - break; case 0xe4: /* UNDEF */ - break; + ASSERT(0); case 0xe5: /* PUSH HL */ PUSH_16(cpu, cpu->hl); break;