aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2024-05-16 23:22:36 +0300
committerJan Tuomi <jan@jantuomi.fi>2024-05-16 23:22:36 +0300
commita568629bf316e3cb7fe9baa0e14c3e8ec398b682 (patch)
treef164039d56d1fb70cf6acd7307e6e2243e456409
parent9a3e2a3d05fc0b6bd0a847e29da0a87934f5a743 (diff)
Add print memory command to debugger
-rw-r--r--atk16_emu/debugger.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/atk16_emu/debugger.py b/atk16_emu/debugger.py
index a157e68..fa0eeee 100644
--- a/atk16_emu/debugger.py
+++ b/atk16_emu/debugger.py
@@ -264,6 +264,30 @@ class Debugger:
self.history_cmpl_index += 1
self.machine = self.history_buffer[len(self.history_buffer) - self.history_cmpl_index]
+ elif cmd == "m":
+ input_ = input(C.UNDERLINE + "Print memory address range (a..b):" + C.ENDC + " ")
+ if ".." not in input_:
+ range_ = [input_, input_]
+ else:
+ range_ = input_.split("..")
+
+ start = try_parse_num(range_[0])
+ end = try_parse_num(range_[1])
+
+ if start is None or end is None:
+ print("Invalid range")
+ continue
+
+ for addr in range(start, end + 1):
+ if addr < 0 or addr >= 64 * 2 ** 16:
+ continue
+
+ addr_prefix = C.OKGREEN + f"0x{addr:>04x}" + C.ENDC
+ word_infix = C.OKBLUE + f"0x{self.machine.mem_read(addr):>04x}" + C.ENDC
+ print(f" {addr_prefix}: {word_infix}")
+
+ print()
+
elif cmd == "B":
print(C.UNDERLINE + "Active breakpoints:" + C.ENDC)
self.print_breakpoints()
@@ -346,6 +370,7 @@ class Debugger:
print(" b step backward (if in time traveling mode)")
print(" B set or remove breakpoint")
print(" s show state summary")
+ print(" m print memory range")
print(" e toggle inline symbol eval on current line")
print(" 0 reset machine state")
print(" l load ROM image and reset machine state")