aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-10-08 21:56:43 +0200
committerMiquel Sabaté Solà <mssola@mssola.com>2026-10-08 21:56:43 +0200
commit466dcce47cc1158d5d92a66119d4d89fe657e356 (patch)
tree53c85116d480eee768bdf4521c6eb2bd58a6d816
parent6b4f6e26bb5fc2e2ba52e87960ef1c2e242dea50 (diff)
downloadtools.nes-466dcce47cc1158d5d92a66119d4d89fe657e356.tar.gz
tools.nes-466dcce47cc1158d5d92a66119d4d89fe657e356.zip
runrom: regularize the output on report
Make the hexadecimal values more cohesive and avoid having a variable-sized line because of them. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
-rw-r--r--crates/runrom/src/main.rs15
-rw-r--r--tests/expected/runrom/arithlog.txt24
-rw-r--r--tests/expected/runrom/branching.txt26
-rw-r--r--tests/expected/runrom/cmp.txt2
-rw-r--r--tests/expected/runrom/halt.txt6
-rw-r--r--tests/expected/runrom/misc-all.txt4
-rw-r--r--tests/expected/runrom/stack.txt14
7 files changed, 49 insertions, 42 deletions
diff --git a/crates/runrom/src/main.rs b/crates/runrom/src/main.rs
index 9671a0b..4d94384 100644
--- a/crates/runrom/src/main.rs
+++ b/crates/runrom/src/main.rs
@@ -328,10 +328,17 @@ fn run(
title = true;
}
- println!(
- "[${:X}] = ${:02X} [reads={}, writes={}]",
- idx, cell.value, cell.reads, cell.writes
- );
+ if idx > 0xFF {
+ println!(
+ "[${:04X}] = ${:02X} [reads={}, writes={}]",
+ idx, cell.value, cell.reads, cell.writes
+ );
+ } else {
+ println!(
+ " [${:02X}] = ${:02X} [reads={}, writes={}]",
+ idx, cell.value, cell.reads, cell.writes
+ );
+ }
}
}
}
diff --git a/tests/expected/runrom/arithlog.txt b/tests/expected/runrom/arithlog.txt
index aa31569..22f6b71 100644
--- a/tests/expected/runrom/arithlog.txt
+++ b/tests/expected/runrom/arithlog.txt
@@ -44,15 +44,15 @@ rts PC: $8045, cycles: 122, registers: [a: $FF, x: $01, y: $01, sp: $FD], statu
== Memory dump ==
-[$0] = $02 [reads=6, writes=2]
-[$1] = $03 [reads=1, writes=1]
-[$2] = $82 [reads=1, writes=2]
-[$3] = $01 [reads=1, writes=2]
-[$4] = $00 [reads=0, writes=1]
-[$5] = $00 [reads=0, writes=1]
-[$6] = $00 [reads=0, writes=1]
-[$7] = $01 [reads=0, writes=1]
-[$8] = $01 [reads=0, writes=1]
-[$9] = $03 [reads=0, writes=1]
-[$A] = $00 [reads=0, writes=1]
-[$B] = $FF [reads=0, writes=1]
+ [$00] = $02 [reads=6, writes=2]
+ [$01] = $03 [reads=1, writes=1]
+ [$02] = $82 [reads=1, writes=2]
+ [$03] = $01 [reads=1, writes=2]
+ [$04] = $00 [reads=0, writes=1]
+ [$05] = $00 [reads=0, writes=1]
+ [$06] = $00 [reads=0, writes=1]
+ [$07] = $01 [reads=0, writes=1]
+ [$08] = $01 [reads=0, writes=1]
+ [$09] = $03 [reads=0, writes=1]
+ [$0A] = $00 [reads=0, writes=1]
+ [$0B] = $FF [reads=0, writes=1]
diff --git a/tests/expected/runrom/branching.txt b/tests/expected/runrom/branching.txt
index 8c2eb7f..d33a036 100644
--- a/tests/expected/runrom/branching.txt
+++ b/tests/expected/runrom/branching.txt
@@ -56,16 +56,16 @@ rts PC: $8047, cycles: 148, registers: [a: $00, x: $FE, y: $FF, sp: $FD], statu
== Memory dump ==
-[$27] = $00 [reads=1, writes=0]
-[$300] = $00 [reads=1, writes=0]
-[$302] = $00 [reads=1, writes=0]
-[$304] = $00 [reads=1, writes=0]
-[$306] = $00 [reads=1, writes=0]
-[$308] = $00 [reads=1, writes=0]
-[$30A] = $00 [reads=1, writes=0]
-[$30C] = $00 [reads=1, writes=0]
-[$30D] = $00 [reads=1, writes=0]
-[$30E] = $00 [reads=1, writes=0]
-[$30F] = $00 [reads=1, writes=0]
-[$310] = $00 [reads=1, writes=0]
-[$311] = $00 [reads=1, writes=0]
+ [$27] = $00 [reads=1, writes=0]
+[$0300] = $00 [reads=1, writes=0]
+[$0302] = $00 [reads=1, writes=0]
+[$0304] = $00 [reads=1, writes=0]
+[$0306] = $00 [reads=1, writes=0]
+[$0308] = $00 [reads=1, writes=0]
+[$030A] = $00 [reads=1, writes=0]
+[$030C] = $00 [reads=1, writes=0]
+[$030D] = $00 [reads=1, writes=0]
+[$030E] = $00 [reads=1, writes=0]
+[$030F] = $00 [reads=1, writes=0]
+[$0310] = $00 [reads=1, writes=0]
+[$0311] = $00 [reads=1, writes=0]
diff --git a/tests/expected/runrom/cmp.txt b/tests/expected/runrom/cmp.txt
index e76570b..182b39d 100644
--- a/tests/expected/runrom/cmp.txt
+++ b/tests/expected/runrom/cmp.txt
@@ -15,4 +15,4 @@ rts PC: $8017, cycles: 44, registers: [a: $FF, x: $00, y: $00, sp: $FD], status
== Memory dump ==
-[$0] = $01 [reads=6, writes=2]
+ [$00] = $01 [reads=6, writes=2]
diff --git a/tests/expected/runrom/halt.txt b/tests/expected/runrom/halt.txt
index 8e4d83e..a8d6572 100644
--- a/tests/expected/runrom/halt.txt
+++ b/tests/expected/runrom/halt.txt
@@ -6,6 +6,6 @@ brk PC: $8000, cycles: 14, registers: [a: $00, x: $00, y: $00, sp: $FA], status
== Memory dump ==
-[$2FB] = $34 [reads=0, writes=1]
-[$2FC] = $02 [reads=0, writes=1]
-[$2FD] = $80 [reads=0, writes=1]
+[$02FB] = $34 [reads=0, writes=1]
+[$02FC] = $02 [reads=0, writes=1]
+[$02FD] = $80 [reads=0, writes=1]
diff --git a/tests/expected/runrom/misc-all.txt b/tests/expected/runrom/misc-all.txt
index a0290f5..6369e49 100644
--- a/tests/expected/runrom/misc-all.txt
+++ b/tests/expected/runrom/misc-all.txt
@@ -521,5 +521,5 @@ rts PC: $8004, cycles: 1306, registers: [a: $00, x: $00, y: $00, sp: $FD], stat
== Memory dump ==
-[$2FC] = $02 [reads=1, writes=1]
-[$2FD] = $80 [reads=1, writes=1]
+[$02FC] = $02 [reads=1, writes=1]
+[$02FD] = $80 [reads=1, writes=1]
diff --git a/tests/expected/runrom/stack.txt b/tests/expected/runrom/stack.txt
index f35ea16..0da4871 100644
--- a/tests/expected/runrom/stack.txt
+++ b/tests/expected/runrom/stack.txt
@@ -35,10 +35,10 @@ rts PC: $8003, cycles: 72, registers: [a: $00, x: $00, y: $00, sp: $FD], status
== Memory dump ==
-[$2F7] = $36 [reads=1, writes=1]
-[$2F8] = $00 [reads=1, writes=1]
-[$2F9] = $00 [reads=1, writes=1]
-[$2FA] = $00 [reads=1, writes=1]
-[$2FB] = $34 [reads=1, writes=1]
-[$2FC] = $02 [reads=1, writes=1]
-[$2FD] = $80 [reads=1, writes=1]
+[$02F7] = $36 [reads=1, writes=1]
+[$02F8] = $00 [reads=1, writes=1]
+[$02F9] = $00 [reads=1, writes=1]
+[$02FA] = $00 [reads=1, writes=1]
+[$02FB] = $34 [reads=1, writes=1]
+[$02FC] = $02 [reads=1, writes=1]
+[$02FD] = $80 [reads=1, writes=1]