mirror of https://github.com/mgba-emu/mgba.git
ARM: Fix Addressing mode 1 shifter on rs == pc (fixes #1926)
This commit is contained in:
parent
791818e9a8
commit
a53b01be00
1
CHANGES
1
CHANGES
|
@ -15,6 +15,7 @@ Features:
|
||||||
Emulation fixes:
|
Emulation fixes:
|
||||||
- ARM: Fix ALU reading PC after shifting
|
- ARM: Fix ALU reading PC after shifting
|
||||||
- ARM: Fix STR storing PC after address calculation
|
- ARM: Fix STR storing PC after address calculation
|
||||||
|
- ARM: Fix Addressing mode 1 shifter on rs == pc (fixes mgba.io/i/1926)
|
||||||
- GB: Partially fix timing for skipped BIOS
|
- GB: Partially fix timing for skipped BIOS
|
||||||
- GB Audio: Fix serializing sweep time
|
- GB Audio: Fix serializing sweep time
|
||||||
- GB MBC: Fix MBC1 mode changing behavior
|
- GB MBC: Fix MBC1 mode changing behavior
|
||||||
|
|
|
@ -19,15 +19,11 @@ static inline void _shiftLSL(struct ARMCore* cpu, uint32_t opcode) {
|
||||||
if (opcode & 0x00000010) {
|
if (opcode & 0x00000010) {
|
||||||
int rs = (opcode >> 8) & 0x0000000F;
|
int rs = (opcode >> 8) & 0x0000000F;
|
||||||
++cpu->cycles;
|
++cpu->cycles;
|
||||||
int shift = cpu->gprs[rs];
|
|
||||||
if (rs == ARM_PC) {
|
|
||||||
shift += 4;
|
|
||||||
}
|
|
||||||
shift &= 0xFF;
|
|
||||||
int32_t shiftVal = cpu->gprs[rm];
|
int32_t shiftVal = cpu->gprs[rm];
|
||||||
if (rm == ARM_PC) {
|
if (rm == ARM_PC) {
|
||||||
shiftVal += 4;
|
shiftVal += 4;
|
||||||
}
|
}
|
||||||
|
int shift = cpu->gprs[rs] & 0xFF;
|
||||||
if (!shift) {
|
if (!shift) {
|
||||||
cpu->shifterOperand = shiftVal;
|
cpu->shifterOperand = shiftVal;
|
||||||
cpu->shifterCarryOut = cpu->cpsr.c;
|
cpu->shifterCarryOut = cpu->cpsr.c;
|
||||||
|
@ -58,15 +54,11 @@ static inline void _shiftLSR(struct ARMCore* cpu, uint32_t opcode) {
|
||||||
if (opcode & 0x00000010) {
|
if (opcode & 0x00000010) {
|
||||||
int rs = (opcode >> 8) & 0x0000000F;
|
int rs = (opcode >> 8) & 0x0000000F;
|
||||||
++cpu->cycles;
|
++cpu->cycles;
|
||||||
int shift = cpu->gprs[rs];
|
|
||||||
if (rs == ARM_PC) {
|
|
||||||
shift += 4;
|
|
||||||
}
|
|
||||||
shift &= 0xFF;
|
|
||||||
uint32_t shiftVal = cpu->gprs[rm];
|
uint32_t shiftVal = cpu->gprs[rm];
|
||||||
if (rm == ARM_PC) {
|
if (rm == ARM_PC) {
|
||||||
shiftVal += 4;
|
shiftVal += 4;
|
||||||
}
|
}
|
||||||
|
int shift = cpu->gprs[rs] & 0xFF;
|
||||||
if (!shift) {
|
if (!shift) {
|
||||||
cpu->shifterOperand = shiftVal;
|
cpu->shifterOperand = shiftVal;
|
||||||
cpu->shifterCarryOut = cpu->cpsr.c;
|
cpu->shifterCarryOut = cpu->cpsr.c;
|
||||||
|
@ -97,15 +89,11 @@ static inline void _shiftASR(struct ARMCore* cpu, uint32_t opcode) {
|
||||||
if (opcode & 0x00000010) {
|
if (opcode & 0x00000010) {
|
||||||
int rs = (opcode >> 8) & 0x0000000F;
|
int rs = (opcode >> 8) & 0x0000000F;
|
||||||
++cpu->cycles;
|
++cpu->cycles;
|
||||||
int shift = cpu->gprs[rs];
|
|
||||||
if (rs == ARM_PC) {
|
|
||||||
shift += 4;
|
|
||||||
}
|
|
||||||
shift &= 0xFF;
|
|
||||||
int shiftVal = cpu->gprs[rm];
|
int shiftVal = cpu->gprs[rm];
|
||||||
if (rm == ARM_PC) {
|
if (rm == ARM_PC) {
|
||||||
shiftVal += 4;
|
shiftVal += 4;
|
||||||
}
|
}
|
||||||
|
int shift = cpu->gprs[rs] & 0xFF;
|
||||||
if (!shift) {
|
if (!shift) {
|
||||||
cpu->shifterOperand = shiftVal;
|
cpu->shifterOperand = shiftVal;
|
||||||
cpu->shifterCarryOut = cpu->cpsr.c;
|
cpu->shifterCarryOut = cpu->cpsr.c;
|
||||||
|
@ -136,15 +124,11 @@ static inline void _shiftROR(struct ARMCore* cpu, uint32_t opcode) {
|
||||||
if (opcode & 0x00000010) {
|
if (opcode & 0x00000010) {
|
||||||
int rs = (opcode >> 8) & 0x0000000F;
|
int rs = (opcode >> 8) & 0x0000000F;
|
||||||
++cpu->cycles;
|
++cpu->cycles;
|
||||||
int shift = cpu->gprs[rs];
|
|
||||||
if (rs == ARM_PC) {
|
|
||||||
shift += 4;
|
|
||||||
}
|
|
||||||
shift &= 0xFF;
|
|
||||||
int shiftVal = cpu->gprs[rm];
|
int shiftVal = cpu->gprs[rm];
|
||||||
if (rm == ARM_PC) {
|
if (rm == ARM_PC) {
|
||||||
shiftVal += 4;
|
shiftVal += 4;
|
||||||
}
|
}
|
||||||
|
int shift = cpu->gprs[rs] & 0xFF;
|
||||||
int rotate = shift & 0x1F;
|
int rotate = shift & 0x1F;
|
||||||
if (!shift) {
|
if (!shift) {
|
||||||
cpu->shifterOperand = shiftVal;
|
cpu->shifterOperand = shiftVal;
|
||||||
|
|
Loading…
Reference in New Issue