all repos — mgba @ ebcb344d647dc767b6ef50fb2ba2d3812d248441

mGBA Game Boy Advance Emulator

ARM7: Handle writeback for PC in addressing modes 2 and 3
Jeffrey Pfau jeffrey@endrift.com
Fri, 08 May 2015 01:23:44 -0700
commit

ebcb344d647dc767b6ef50fb2ba2d3812d248441

parent

3c844a9ae9e6de6c1aae1eb5b627ce1d3aa334bc

2 files changed, 7 insertions(+), 1 deletions(-)

jump to
M CHANGESCHANGES

@@ -45,6 +45,7 @@ - Video: Fix an issue with very long filenames

- SDL: Fix boundary conditions for joystick adjustments - Util: Fix a null-pointer issue when attempting to delete a key - SDL: Allocate properly sized input maps + - ARM7: Handle writeback for PC in addressing modes 2 and 3 Misc: - Qt: Show multiplayer numbers in window title - Qt: Handle saving input settings better
M src/arm/isa-arm.csrc/arm/isa-arm.c

@@ -233,7 +233,12 @@ #define ADDR_MODE_2_RN (cpu->gprs[rn])

#define ADDR_MODE_2_RM (cpu->gprs[rm]) #define ADDR_MODE_2_IMMEDIATE (opcode & 0x00000FFF) #define ADDR_MODE_2_INDEX(U_OP, M) (cpu->gprs[rn] U_OP M) -#define ADDR_MODE_2_WRITEBACK(ADDR) (cpu->gprs[rn] = ADDR) +#define ADDR_MODE_2_WRITEBACK(ADDR) \ + cpu->gprs[rn] = ADDR; \ + if (UNLIKELY(rn == ARM_PC)) { \ + ARM_WRITE_PC; \ + } + #define ADDR_MODE_2_LSL (cpu->gprs[rm] << ADDR_MODE_2_I) #define ADDR_MODE_2_LSR (ADDR_MODE_2_I_TEST ? ((uint32_t) cpu->gprs[rm]) >> ADDR_MODE_2_I : 0) #define ADDR_MODE_2_ASR (ADDR_MODE_2_I_TEST ? ((int32_t) cpu->gprs[rm]) >> ADDR_MODE_2_I : ((int32_t) cpu->gprs[rm]) >> 31)