Skip to content

Commit fd54e9b

Browse files
committed
Restore panic on write to unimplemented IO
1 parent 873e3ce commit fd54e9b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

sim/aviron/src/main.zig

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ const IO = struct {
298298
.sp_l => @truncate(io.sp >> 0),
299299
.sp_h => @truncate(io.sp >> 8),
300300

301-
_ => 0xFF, // Unimplemented I/O: return 0xFF and let CPU/reporting handle it
301+
_ => std.debug.panic("illegal i/o read from undefined register 0x{X:0>2}", .{addr}),
302302
};
303303
}
304304

@@ -341,9 +341,10 @@ const IO = struct {
341341
.sp_h => write_masked(high_byte(&io.sp), mask, value),
342342
.sreg => write_masked(@ptrCast(io.sreg), mask, value),
343343

344-
_ => {
345-
// Unimplemented I/O: ignore (no panic). Could log if desired.
346-
},
344+
_ => std.debug.panic(
345+
"illegal i/o write to undefined register 0x{X:0>2} with value=0x{X:0>2}, mask=0x{X:0>2}",
346+
.{ addr, value, mask },
347+
),
347348
}
348349
}
349350

0 commit comments

Comments
 (0)