fix: remove accidental rotation in ldrsh instructions

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-04-13 22:59:32 -03:00
parent c1b74d556a
commit 6d5c30ac25
2 changed files with 2 additions and 6 deletions

View File

@ -47,13 +47,11 @@ pub fn halfAndSignedDataTransfer(comptime P: bool, comptime U: bool, comptime I:
},
0b11 => {
// LDRSH
const value = if (address & 1 == 1) blk: {
result = if (address & 1 == 1) blk: {
break :blk sext(8, bus.read(u8, address));
} else blk: {
break :blk sext(16, bus.read(u16, address));
};
result = rotr(u32, value, 8 * (address & 1));
},
0b00 => unreachable, // SWP
}

View File

@ -45,13 +45,11 @@ pub fn format78(comptime op: u2, comptime T: bool) InstrFn {
},
0b11 => {
// LDRSH
const value = if (address & 1 == 1) blk: {
cpu.r[rd] = if (address & 1 == 1) blk: {
break :blk sext(8, bus.read(u8, address));
} else blk: {
break :blk sext(16, bus.read(u16, address));
};
cpu.r[rd] = rotr(u32, value, 8 * (address & 1));
},
}
} else {