summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Bridle <ben@derelict.engineering>2024-10-31 11:16:20 +1300
committerBen Bridle <ben@derelict.engineering>2024-10-31 11:16:43 +1300
commit8efe2561a99660147871a688bc02e4bb4c6cde60 (patch)
tree233681cc7fb02f93f27c79bfe88b1ccf3dfddd74
parent0bf83f08a4099d90ac18f921b45f74124bcb4c62 (diff)
downloadbedrock-pc-8efe2561a99660147871a688bc02e4bb4c6cde60.zip
Show memory address on SYM line in emulator debug output
The memory address of the most recent symbol is now displayed next to the name of that symbol in the emulator debug output, to make it easier to see how close the program counter is to that symbol. The source location of that symbol is now also shown as dimmed to make it less distracting.
-rw-r--r--src/debug.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/debug.rs b/src/debug.rs
index 1593d9d..d7e7f67 100644
--- a/src/debug.rs
+++ b/src/debug.rs
@@ -5,6 +5,7 @@ use std::time::Instant;
const NORMAL: &str = "\x1b[0m";
+const DIM: &str = "\x1b[2m";
const YELLOW: &str = "\x1b[33m";
const BLUE: &str = "\x1b[34m";
@@ -44,8 +45,8 @@ impl DebugState {
debug_stack(&core.rst, 0x10);
// Print information about the current symbol.
if let Some(symbol) = self.symbols.for_address(core.mem.pc) {
- eprint!("SYM: {BLUE}@{}{NORMAL}", symbol.name);
- if let Some(location) = &symbol.location { eprint!(" {location}"); }
+ eprint!("SYM: {BLUE}@{}{NORMAL} 0x{:04x}", symbol.name, symbol.address);
+ if let Some(location) = &symbol.location { eprint!(" {DIM}{location}{NORMAL}"); }
eprintln!();
}
self.last_cycle = core.cycle;