fix: implement the same LDRSH logic as THUMB LDRSH
This commit is contained in:
parent
c52dc5adb1
commit
1b9ab1f1d7
|
@ -45,7 +45,13 @@ pub fn halfAndSignedDataTransfer(comptime P: bool, comptime U: bool, comptime I:
|
||||||
},
|
},
|
||||||
0b11 => {
|
0b11 => {
|
||||||
// LDRSH
|
// LDRSH
|
||||||
result = util.u32SignExtend(16, bus.read16(address & 0xFFFF_FFFE));
|
const value = if (address & 1 == 1) blk: {
|
||||||
|
break :blk util.u32SignExtend(8, bus.read8(address));
|
||||||
|
} else blk: {
|
||||||
|
break :blk util.u32SignExtend(16, bus.read16(address));
|
||||||
|
};
|
||||||
|
|
||||||
|
result = std.math.rotr(u32, value, 8 * (address & 1));
|
||||||
},
|
},
|
||||||
0b00 => unreachable, // SWP
|
0b00 => unreachable, // SWP
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue