fix(cpu): force-align SWP reads and writes

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-10-21 05:12:17 -03:00
parent 44e8b5b882
commit e933d7e5c7
1 changed files with 2 additions and 2 deletions

View File

@ -20,8 +20,8 @@ pub fn singleDataSwap(comptime B: bool) InstrFn {
cpu.r[rd] = value; cpu.r[rd] = value;
} else { } else {
// SWP // SWP
const value = std.math.rotr(u32, bus.read32(address), 8 * (address & 0x3)); const value = std.math.rotr(u32, bus.read32(address & 0xFFFF_FFFC), 8 * (address & 0x3));
bus.write32(address, cpu.r[rm]); bus.write32(address & 0xFFFF_FFFC, cpu.r[rm]);
cpu.r[rd] = value; cpu.r[rd] = value;
} }
} }