fix(memory): ignore CPU and DMA writes to unused I/O addresses
Stores to I/O addresses with no register returned Unmapped and stopped the machine. Hardware ignores them. Emulated writes there now pay their bus cost and change nothing; host writes stay strict. The unmodeled internal memory control register at 0x04xx0800 and all unused I/O reads remain diagnostics. Rollback tests that used unused I/O as their failing word now run the block on to a register that rejects the stored value: SIOMULTI2 outside multiplayer mode, an RCNT GPIO serial IRQ, or 64-sample wave playback. Where no reachable register can fail (JOYSTAT, POSTFLG/HALTCNT, IME, DMA3CNT), the test now checks that the block commits and the unused word is ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HhfHfHEuzv2AUTd6erW1gU
This commit is contained in:
parent
b535c08313
commit
20176716d9
16 changed files with 166 additions and 92 deletions
|
|
@ -584,7 +584,7 @@ fn bios_stop_store_finishes_before_freezing_and_access_context_is_cleared() {
|
|||
assert_eq!(machine.step().unwrap(), StepKind::StopIdle);
|
||||
assert_eq!(machine.last_timing(), StepTiming::default());
|
||||
// A failed non-BIOS instruction must also clear its access context.
|
||||
let mut machine = store_machine(ROM_START, 0xe581_0000, 0x0400_0058, 0, true);
|
||||
let mut machine = store_machine(ROM_START, 0xe581_0000, 0x0400_0800, 0, true);
|
||||
assert!(machine.step().is_err());
|
||||
machine.memory_mut().write8(POSTFLG, 1).unwrap();
|
||||
halt(&mut machine);
|
||||
|
|
@ -604,15 +604,14 @@ fn non_bios_stop_write_is_ignored_not_a_diagnostic() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn failed_block_store_cannot_partially_halt_or_change_postflg() {
|
||||
// The first word is mapped; the second is not. Validation precedes all writes.
|
||||
let mut machine = store_machine(0x100, 0xe8a1_0005, POSTFLG, 1, false); // STMIA r1!,{r0,r2}
|
||||
let before = machine.cpu().clone();
|
||||
assert!(machine.step().is_err());
|
||||
assert_eq!(machine.cpu(), &before);
|
||||
assert!(!machine.halted());
|
||||
assert_eq!(machine.memory().read8(POSTFLG).unwrap(), 0);
|
||||
assert_eq!(machine.cycles(), 0);
|
||||
fn bios_block_store_halts_and_ignores_the_unused_word_after_haltcnt() {
|
||||
// STMIA r1!,{r0,r2}: POSTFLG=1 and HALTCNT=0, then an unused I/O word.
|
||||
let mut machine = store_machine(0x100, 0xe8a1_0005, POSTFLG, 1, false);
|
||||
assert_eq!(machine.step().unwrap(), StepKind::Instruction);
|
||||
assert!(machine.halted());
|
||||
assert!(!machine.stopped());
|
||||
assert_eq!(machine.memory().read8(POSTFLG).unwrap(), 1);
|
||||
assert_eq!(machine.cpu().registers()[1], POSTFLG + 8);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue