File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -141,11 +141,32 @@ pub fn dump_system_state(cpu: *Cpu) void {
141
141
}
142
142
143
143
std .debug .print ("0x{X:0>4}: " , .{sram_base + @as (u24 , @intCast (i ))});
144
+ // hex bytes
144
145
j = 0 ;
145
146
while (j < row_len ) : (j += 1 ) {
146
147
std .debug .print ("{X:0>2} " , .{cur_row [j ]});
147
148
}
148
- std .debug .print ("\n " , .{});
149
+
150
+ // pad hex area for short rows to align ASCII column
151
+ if (row_len < row_width ) {
152
+ var pad : usize = row_width - row_len ;
153
+ while (pad > 0 ) : (pad -= 1 ) {
154
+ std .debug .print (" " , .{});
155
+ }
156
+ }
157
+
158
+ // ASCII representation
159
+ std .debug .print (" |" , .{});
160
+ j = 0 ;
161
+ while (j < row_len ) : (j += 1 ) {
162
+ const b = cur_row [j ];
163
+ if (b >= 32 and b <= 126 ) {
164
+ std .debug .print ("{c}" , .{b });
165
+ } else {
166
+ std .debug .print ("." , .{});
167
+ }
168
+ }
169
+ std .debug .print ("|\n " , .{});
149
170
150
171
// store as previous row
151
172
@memcpy (prev_row [0.. row_len ], cur_row [0.. row_len ]);
You can’t perform that action at this time.
0 commit comments