diff --git a/src/ARM.h b/src/ARM.h index 38f60c6f..cb47f287 100644 --- a/src/ARM.h +++ b/src/ARM.h @@ -144,6 +144,7 @@ public: virtual void AddCycles_CI(s32 numI) = 0; virtual void AddCycles_CDI_LDR() = 0; virtual void AddCycles_CDI_LDM() = 0; + virtual void AddCycles_CDI_SWP() = 0; virtual void AddCycles_CD_STR() = 0; virtual void AddCycles_CD_STM() = 0; @@ -329,6 +330,7 @@ public: void AddCycles_CDI_LDR() override; void AddCycles_CDI_LDM() override; + void AddCycles_CDI_SWP() override { AddCycles_CD_STR(); } // uses the same behavior as str void AddCycles_CD_STR() override; void AddCycles_CD_STM() override; @@ -466,6 +468,7 @@ public: void AddCycles_CDI(); void AddCycles_CDI_LDR() override { AddCycles_CDI(); } void AddCycles_CDI_LDM() override { AddCycles_CDI(); } + void AddCycles_CDI_SWP() override { AddCycles_CDI(); } // checkme? void AddCycles_CD(); void AddCycles_CD_STR() override { AddCycles_CD(); } void AddCycles_CD_STM() override { AddCycles_CD(); } diff --git a/src/ARMInterpreter_LoadStore.cpp b/src/ARMInterpreter_LoadStore.cpp index dd7f9762..d874fb9a 100644 --- a/src/ARMInterpreter_LoadStore.cpp +++ b/src/ARMInterpreter_LoadStore.cpp @@ -462,7 +462,7 @@ void A_SWP(ARM* cpu) u32 numD = cpu->DataCycles; if (cpu->DataWrite32(base, rm)) { - cpu->AddCycles_CDI_LDR(); + cpu->AddCycles_CDI_SWP(); // rd only gets updated if both read and write succeed u32 rd = (cpu->CurInstr >> 12) & 0xF; if (rd != 15) @@ -484,10 +484,10 @@ void A_SWP(ARM* cpu) else if (cpu->Num == 1) // for some reason these jumps don't work on the arm 9? cpu->JumpTo(ROR(val, 8*(base&0x3)) & ~1, cpu->ILT_Norm); } - else cpu->AddCycles_CDI_LDR(); + else cpu->AddCycles_CDI_SWP(); cpu->DataCycles += numD; } - else cpu->AddCycles_CDI_LDR(); + else cpu->AddCycles_CDI_SWP(); } void A_SWPB(ARM* cpu) @@ -502,7 +502,7 @@ void A_SWPB(ARM* cpu) u32 numD = cpu->DataCycles; if (cpu->DataWrite8(base, rm)) { - cpu->AddCycles_CDI_LDR(); + cpu->AddCycles_CDI_SWP(); // rd only gets updated if both read and write succeed u32 rd = (cpu->CurInstr >> 12) & 0xF; if (rd != 15) @@ -516,10 +516,10 @@ void A_SWPB(ARM* cpu) else if (cpu->Num == 1)// for some reason these jumps don't work on the arm 9? cpu->JumpTo(val & ~1); } - else cpu->AddCycles_CDI_LDR(); + else cpu->AddCycles_CDI_SWP(); cpu->DataCycles += numD; } - else cpu->AddCycles_CDI_LDR(); + else cpu->AddCycles_CDI_SWP(); }