From 065573f316c1c2003837d81e645f6050e0fbd006 Mon Sep 17 00:00:00 2001 From: Jaklyy <102590697+Jaklyy@users.noreply.github.com> Date: Fri, 31 May 2024 18:09:45 -0400 Subject: [PATCH] fix writebacks overwriting registers swapped with spsr fixes gbarunner3 --- src/ARMInterpreter_LoadStore.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ARMInterpreter_LoadStore.cpp b/src/ARMInterpreter_LoadStore.cpp index 91acaacc..e21d7757 100644 --- a/src/ARMInterpreter_LoadStore.cpp +++ b/src/ARMInterpreter_LoadStore.cpp @@ -429,10 +429,10 @@ void A_LDM(ARM* cpu) if (!preinc) base += 4; } } - + + u32 pc; if (cpu->CurInstr & (1<<15)) { - u32 pc; if (preinc) base += 4; if (first) cpu->DataRead32 (base, &pc); else cpu->DataRead32S(base, &pc); @@ -440,8 +440,6 @@ void A_LDM(ARM* cpu) if (cpu->Num == 1) pc &= ~0x1; - - cpu->JumpTo(pc, cpu->CurInstr & (1<<22)); } if ((cpu->CurInstr & (1<<22)) && !(cpu->CurInstr & (1<<15))) @@ -466,6 +464,9 @@ void A_LDM(ARM* cpu) cpu->R[baseid] = wbbase; } + if (cpu->CurInstr & (1<<15)) + cpu->JumpTo(pc, cpu->CurInstr & (1<<22)); + cpu->AddCycles_CDI(); }