diff options
author | RSDuck <RSDuck@users.noreply.github.com> | 2023-10-22 15:21:03 +0200 |
---|---|---|
committer | RSDuck <RSDuck@users.noreply.github.com> | 2023-10-22 15:21:03 +0200 |
commit | 3d58a338a16bc41b9106857645fabc0221de711d (patch) | |
tree | 52f91225b994f60c4d5f5f0fbca29e32e9b71066 | |
parent | d4e51f80601f57399db49f1010c45427bd2bf3c4 (diff) |
store pc+12 when storing r15
-rw-r--r-- | src/ARMInterpreter_LoadStore.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ARMInterpreter_LoadStore.cpp b/src/ARMInterpreter_LoadStore.cpp index e7b83eb..81877f0 100644 --- a/src/ARMInterpreter_LoadStore.cpp +++ b/src/ARMInterpreter_LoadStore.cpp @@ -62,14 +62,20 @@ namespace ARMInterpreter #define A_STR \ offset += cpu->R[(cpu->CurInstr>>16) & 0xF]; \ - cpu->DataWrite32(offset, cpu->R[(cpu->CurInstr>>12) & 0xF]); \ + u32 storeval = cpu->R[(cpu->CurInstr>>12) & 0xF]; \ + if (((cpu->CurInstr>>12) & 0xF) == 0xF) \ + storeval += 4; \ + cpu->DataWrite32(offset, storeval); \ if (cpu->CurInstr & (1<<21)) cpu->R[(cpu->CurInstr>>16) & 0xF] = offset; \ cpu->AddCycles_CD(); // TODO: user mode (bit21) #define A_STR_POST \ u32 addr = cpu->R[(cpu->CurInstr>>16) & 0xF]; \ - cpu->DataWrite32(addr, cpu->R[(cpu->CurInstr>>12) & 0xF]); \ + u32 storeval = cpu->R[(cpu->CurInstr>>12) & 0xF]; \ + if (((cpu->CurInstr>>12) & 0xF) == 0xF) \ + storeval += 4; \ + cpu->DataWrite32(addr, storeval); \ cpu->R[(cpu->CurInstr>>16) & 0xF] += offset; \ cpu->AddCycles_CD(); |