fix: PC is 12 ahead when it is rd in str and strb

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-10-21 05:12:16 -03:00
parent 17226d8f75
commit 75921d6413
1 changed files with 4 additions and 3 deletions

View File

@ -38,11 +38,12 @@ pub fn singleDataTransfer(comptime I: bool, comptime P: bool, comptime U: bool,
} else {
if (B) {
// STRB
bus.write8(address, @truncate(u8, cpu.r[rd]));
const value = if (rd == 0xF) cpu.r[rd] + 8 else cpu.r[rd];
bus.write8(address, @truncate(u8, value));
} else {
// STR
const force_aligned = address & 0xFFFF_FFFC;
bus.write32(force_aligned, cpu.r[rd]);
const value = if (rd == 0xF) cpu.r[rd] + 8 else cpu.r[rd];
bus.write32(address & 0xFFFF_FFFC, value);
}
}