From fce0555a09283f7d5fdf6f195b4a9d8d2088b484 Mon Sep 17 00:00:00 2001 From: Jaklyy <102590697+Jaklyy@users.noreply.github.com> Date: Sat, 9 Nov 2024 22:07:17 -0500 Subject: [PATCH] slightly fix error in writeback handling --- src/ARMInterpreter_LoadStore.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ARMInterpreter_LoadStore.cpp b/src/ARMInterpreter_LoadStore.cpp index 97bef0b0..159fc86f 100644 --- a/src/ARMInterpreter_LoadStore.cpp +++ b/src/ARMInterpreter_LoadStore.cpp @@ -115,6 +115,7 @@ void LoadSingle(ARM* cpu, u8 rd, u8 rn, s32 offset) if constexpr (size == 32) val = ROR(val, ((addr&0x3)<<3)); + if constexpr (writeback >= Writeback::Post) addr += offset; if constexpr (writeback != Writeback::None) cpu->R[rn] = addr; if (rd == 15) @@ -160,8 +161,9 @@ void StoreSingle(ARM* cpu, u8 rd, u8 rn, s32 offset) ((ARMv5*)cpu)->DataAbort(); return; } - - if constexpr (writeback != Writeback::None) cpu->R[rn] += offset; + + if constexpr (writeback >= Writeback::Post) addr += offset; + if constexpr (writeback != Writeback::None) cpu->R[rn] = addr; }