Skip to content

Commit

Permalink
fix LDM bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Arisotura committed Oct 29, 2024
1 parent dfd6338 commit 7a4255b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/ARMInterpreter_LoadStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,23 +430,18 @@ void A_LDM(ARM* cpu)
}
}

u32 pc = 0;
if (cpu->CurInstr & (1<<15))
{
u32 pc;
if (preinc) base += 4;
if (first) cpu->DataRead32 (base, &pc);
else cpu->DataRead32S(base, &pc);
if (!preinc) base += 4;

if (cpu->Num == 1)
pc &= ~0x1;

cpu->JumpTo(pc, cpu->CurInstr & (1<<22));
}

if ((cpu->CurInstr & (1<<22)) && !(cpu->CurInstr & (1<<15)))
cpu->UpdateMode((cpu->CPSR&~0x1F)|0x10, cpu->CPSR, true);

if (cpu->CurInstr & (1<<21))
{
// post writeback
Expand All @@ -466,6 +461,12 @@ void A_LDM(ARM* cpu)
cpu->R[baseid] = wbbase;
}

if ((cpu->CurInstr & (1<<22)) && !(cpu->CurInstr & (1<<15)))
cpu->UpdateMode((cpu->CPSR&~0x1F)|0x10, cpu->CPSR, true);

if (cpu->CurInstr & (1<<15))
cpu->JumpTo(pc, cpu->CurInstr & (1<<22));

cpu->AddCycles_CDI();
}

Expand Down

0 comments on commit 7a4255b

Please sign in to comment.