diff options
| -rw-r--r-- | src/board_memory.zig | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/board_memory.zig b/src/board_memory.zig index 702b130d..d2878d2d 100644 --- a/src/board_memory.zig +++ b/src/board_memory.zig @@ -264,7 +264,7 @@ pub fn peek(p: *Pardes, id: usize, argument: []const u8) !void { try writeNote(&out.writer, e, requested, "words"); for (0..e.count) |i| { const at = addr + @as(u32, @intCast(i * 4)); - try out.writer.print("0x{x:0>8}: 0x{x:0>8}\n", .{ at, readWord(at) }); + try out.writer.print("{x:0>8}: {x:0>8}\n", .{ at, readWord(at) }); } const content = try out.toOwnedSlice(); try fill(p, id, .{ .cmd = .Peek }, content); @@ -291,7 +291,7 @@ pub fn poke(p: *Pardes, id: usize, argument: []const u8) !void { var buf: [96]u8 = undefined; p.setMessage(id, std.fmt.bufPrint( &buf, - "0x{x:0>8}: wrote 0x{x:0>8}, reads 0x{x:0>8}", + "{x:0>8}: wrote {x:0>8}, reads {x:0>8}", .{ addr, value, back }, ) catch unreachable); } @@ -306,6 +306,12 @@ pub fn poke(p: *Pardes, id: usize, argument: []const u8) !void { /// Eight fits in 46 and keeps every property that matters: address on the left, fixed-width hex /// columns, ASCII on the right, and a gap at the halfway mark because the eye counts in fours and /// eights rather than in sixteens. +/// +/// NO `0x` ON WHAT THESE WORDS PRINT, which is where two of those columns came from. It reads no +/// worse - every number here is hex, there is no other kind, and the words refuse a decimal one - and +/// it buys something better than the width: an address in a dump can now be typed straight back into +/// a `Peek` without editing it, because bare hex is exactly what the parser wants. Output that is +/// valid input is worth more than a prefix restating what the whole file already says. const row_bytes: u32 = if (pardes.platform == .p4) 8 else 16; /// `Hexdump <addr> [len]` — len bytes, `row_bytes` to a row, hex columns and an ASCII gutter, in @@ -327,7 +333,7 @@ pub fn hexdump(p: *Pardes, id: usize, argument: []const u8) !void { const n = @min(row_bytes, e.count - row); var bytes: [row_bytes]u8 = undefined; for (0..n) |i| bytes[i] = readByte(addr + row + @as(u32, @intCast(i))); - try out.writer.print("0x{x:0>8} ", .{addr + row}); + try out.writer.print("{x:0>8} ", .{addr + row}); for (0..row_bytes) |i| { // The gap at the halfway mark: the eye counts to four or eight, not to sixteen. if (i == row_bytes / 2) try out.writer.writeByte(' '); |
