ldm base writeback fails with r15

This commit is contained in:
Jaklyy 2024-11-09 14:49:34 -05:00
parent 676f471ebe
commit 9f8cf8dad2

View File

@ -568,7 +568,7 @@ void A_LDM(ARM* cpu)
} }
// writeback to base // writeback to base
if (cpu->CurInstr & (1<<21)) if (cpu->CurInstr & (1<<21) && (baseid != 15))
{ {
// post writeback // post writeback
if (cpu->CurInstr & (1<<23)) if (cpu->CurInstr & (1<<23))
@ -624,7 +624,7 @@ void A_STM(ARM* cpu)
base -= 4; base -= 4;
} }
if (cpu->CurInstr & (1<<21)) if ((cpu->CurInstr & (1<<21)) && (baseid != 15))
cpu->R[baseid] = base; cpu->R[baseid] = base;
preinc = !preinc; preinc = !preinc;
@ -681,7 +681,7 @@ void A_STM(ARM* cpu)
return; return;
} }
if ((cpu->CurInstr & (1<<23)) && (cpu->CurInstr & (1<<21))) if ((cpu->CurInstr & (1<<23)) && (cpu->CurInstr & (1<<21)) && (baseid != 15))
cpu->R[baseid] = base; cpu->R[baseid] = base;