diff options
-rw-r--r-- | src/debug.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/debug.rs b/src/debug.rs index 17ed604..c01ee15 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -36,8 +36,9 @@ impl DebugState { pub fn debug_summary(&mut self, core: &BedrockCore) { if self.enabled { + let prev_pc = core.mem.pc.wrapping_sub(1); eprintln!("\n PC: 0x{:04x} Cycles: {} (+{} in {:.2?})", - core.mem.pc, core.cycle, + prev_pc, core.cycle, core.cycle.saturating_sub(self.last_cycle), self.last_mark.elapsed(), ); @@ -46,7 +47,7 @@ impl DebugState { eprint!("RST: "); debug_stack(&core.rst, 0x10); // Print information about the closest symbol. - if let Some(symbol) = self.symbols.for_address(core.mem.pc) { + if let Some(symbol) = self.symbols.for_address(prev_pc) { let name = &symbol.name; let address = &symbol.address; eprint!("SYM: {BLUE}@{name}{NORMAL} 0x{address:04x}"); |