From 3b73f21bb7b5836bea24d82b5ce8326dee6ac7f9 Mon Sep 17 00:00:00 2001 From: Jaklyy <102590697+Jaklyy@users.noreply.github.com> Date: Mon, 23 Sep 2024 16:12:23 -0400 Subject: [PATCH] str r15 is incremented by +2/+4 oop --- src/ARMInterpreter_LoadStore.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ARMInterpreter_LoadStore.cpp b/src/ARMInterpreter_LoadStore.cpp index f181476b..e8e6accc 100644 --- a/src/ARMInterpreter_LoadStore.cpp +++ b/src/ARMInterpreter_LoadStore.cpp @@ -434,7 +434,7 @@ void A_SWPB(ARM* cpu) SWP(cpu); } -void ReglessLDMSTM(ARM* cpu, const bool load, const u8 baseid, const bool writeback, const bool decrement, bool preinc, const bool usermode) +void ReglessLDMSTM(ARM* cpu, const bool load, const u8 baseid, const bool writeback, const bool decrement, bool preinc, const bool usermode, const bool thumb) { if (cpu->Num == 1) { @@ -464,7 +464,7 @@ void ReglessLDMSTM(ARM* cpu, const bool load, const u8 baseid, const bool writeb } else { - if (!cpu->DataWrite32(base, cpu->R[15])) + if (!cpu->DataWrite32(base, cpu->R[15] + (thumb ? 2 : 4))) { cpu->AddCycles_CD(); ((ARMv5*)cpu)->DataAbort(); @@ -500,7 +500,7 @@ void A_LDM(ARM* cpu) if (!(cpu->CurInstr & 0xFFFF)) [[unlikely]] { - ReglessLDMSTM(cpu, true, baseid, cpu->CurInstr & (1<<21), !(cpu->CurInstr & (1<<23)), preinc, cpu->CurInstr & (1<<22)); + ReglessLDMSTM(cpu, true, baseid, cpu->CurInstr & (1<<21), !(cpu->CurInstr & (1<<23)), preinc, cpu->CurInstr & (1<<22), false); return; } @@ -606,7 +606,7 @@ void A_STM(ARM* cpu) if (!(cpu->CurInstr & 0xFFFF)) [[unlikely]] { - ReglessLDMSTM(cpu, false, baseid, cpu->CurInstr & (1<<21), !(cpu->CurInstr & (1<<23)), preinc, false); + ReglessLDMSTM(cpu, false, baseid, cpu->CurInstr & (1<<21), !(cpu->CurInstr & (1<<23)), preinc, false, false); return; } @@ -804,7 +804,7 @@ void T_PUSH(ARM* cpu) if (!nregs) [[unlikely]] { - ReglessLDMSTM(cpu, false, 13, true, true, true, false); + ReglessLDMSTM(cpu, false, 13, true, true, true, false, true); return; } @@ -850,7 +850,7 @@ void T_POP(ARM* cpu) if (!(cpu->CurInstr & 0x1FF)) [[unlikely]] { - ReglessLDMSTM(cpu, true, 13, true, false, false, false); + ReglessLDMSTM(cpu, true, 13, true, false, false, false, true); return; } @@ -902,7 +902,7 @@ void T_STMIA(ARM* cpu) if (!(cpu->CurInstr & 0xFF)) [[unlikely]] { - ReglessLDMSTM(cpu, false, (cpu->CurInstr >> 8) & 0x7, true, false, false, false); + ReglessLDMSTM(cpu, false, (cpu->CurInstr >> 8) & 0x7, true, false, false, false, true); return; } @@ -938,7 +938,7 @@ void T_LDMIA(ARM* cpu) if (!(cpu->CurInstr & 0xFF)) [[unlikely]] { - ReglessLDMSTM(cpu, true, (cpu->CurInstr >> 8) & 0x7, true, false, false, false); + ReglessLDMSTM(cpu, true, (cpu->CurInstr >> 8) & 0x7, true, false, false, false, true); return; }