Store the PC register at the appropriate offset

In ARM mode, the GBA CPU stores the PC (r15) register with an offset of
4. This was not handled correctly by the core emulator.

Fixes #1200
This commit is contained in:
Fabrice de Gans 2023-11-10 15:42:49 -08:00
parent 215e9b1ac2
commit beab088139
1 changed files with 1 additions and 1 deletions

View File

@ -1528,7 +1528,7 @@ static INSN_REGPARM void arm121(uint32_t opcode)
#define ADDRESS_PREDEC (reg[base].I - offset) #define ADDRESS_PREDEC (reg[base].I - offset)
#define ADDRESS_PREINC (reg[base].I + offset) #define ADDRESS_PREINC (reg[base].I + offset)
#define OP_STR CPUWriteMemory(address, reg[dest].I) #define OP_STR CPUWriteMemory(address, reg[dest].I + (dest == 15 ? 4 : 0))
#define OP_STRH CPUWriteHalfWord(address, reg[dest].W.W0) #define OP_STRH CPUWriteHalfWord(address, reg[dest].W.W0)
#define OP_STRB CPUWriteByte(address, reg[dest].B.B0) #define OP_STRB CPUWriteByte(address, reg[dest].B.B0)
#define OP_LDR reg[dest].I = CPUReadMemory(address) #define OP_LDR reg[dest].I = CPUReadMemory(address)