fix: remove accidental rotation in ldrsh instructions
This commit is contained in:
parent
c1b74d556a
commit
6d5c30ac25
|
@ -47,13 +47,11 @@ pub fn halfAndSignedDataTransfer(comptime P: bool, comptime U: bool, comptime I:
|
||||||
},
|
},
|
||||||
0b11 => {
|
0b11 => {
|
||||||
// LDRSH
|
// LDRSH
|
||||||
const value = if (address & 1 == 1) blk: {
|
result = if (address & 1 == 1) blk: {
|
||||||
break :blk sext(8, bus.read(u8, address));
|
break :blk sext(8, bus.read(u8, address));
|
||||||
} else blk: {
|
} else blk: {
|
||||||
break :blk sext(16, bus.read(u16, address));
|
break :blk sext(16, bus.read(u16, address));
|
||||||
};
|
};
|
||||||
|
|
||||||
result = rotr(u32, value, 8 * (address & 1));
|
|
||||||
},
|
},
|
||||||
0b00 => unreachable, // SWP
|
0b00 => unreachable, // SWP
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,13 +45,11 @@ pub fn format78(comptime op: u2, comptime T: bool) InstrFn {
|
||||||
},
|
},
|
||||||
0b11 => {
|
0b11 => {
|
||||||
// LDRSH
|
// LDRSH
|
||||||
const value = if (address & 1 == 1) blk: {
|
cpu.r[rd] = if (address & 1 == 1) blk: {
|
||||||
break :blk sext(8, bus.read(u8, address));
|
break :blk sext(8, bus.read(u8, address));
|
||||||
} else blk: {
|
} else blk: {
|
||||||
break :blk sext(16, bus.read(u16, address));
|
break :blk sext(16, bus.read(u16, address));
|
||||||
};
|
};
|
||||||
|
|
||||||
cpu.r[rd] = rotr(u32, value, 8 * (address & 1));
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue