From 49706842af25080756e308f25496e3848f89727b Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Mon, 13 Feb 2023 17:15:39 -0600 Subject: [PATCH] fix: run more than just the CPU when stepping via gdb --- src/core/emu.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/emu.zig b/src/core/emu.zig index 1dc1d1e..1a84c11 100644 --- a/src/core/emu.zig +++ b/src/core/emu.zig @@ -199,15 +199,18 @@ pub const EmuThing = struct { const cpu = self.cpu; const sched = self.scheduler; + // Is true when we have executed one (1) instruction + var did_step: bool = false; + // TODO: How can I make it easier to keep this in lock-step with runFrame? - while (true) { + while (!did_step) { if (!cpu.stepDmaTransfer()) { if (cpu.isHalted()) { // Fast-forward to next Event sched.tick = sched.queue.peek().?.tick; } else { cpu.step(); - break; // this function won't return until we've actually stepped once + did_step = true; } }