mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-25 18:46:55 +01:00
CPU: Fix overflow bit calculation in SUBFO instruction
Since rD can overlap with rA or rB the result needs to be stored in a temporary
This commit is contained in:
parent
47f1dcf996
commit
5328e9eb10
@ -212,11 +212,12 @@ static void PPCInterpreter_SUBF(PPCInterpreter_t* hCPU, uint32 opcode)
|
|||||||
|
|
||||||
static void PPCInterpreter_SUBFO(PPCInterpreter_t* hCPU, uint32 opcode)
|
static void PPCInterpreter_SUBFO(PPCInterpreter_t* hCPU, uint32 opcode)
|
||||||
{
|
{
|
||||||
// untested (Don't Starve Giant Edition uses this)
|
// Seen in Don't Starve Giant Edition and Teslagrad
|
||||||
// also used by DS Virtual Console (Super Mario 64 DS)
|
// also used by DS Virtual Console (Super Mario 64 DS)
|
||||||
PPC_OPC_TEMPL3_XO();
|
PPC_OPC_TEMPL3_XO();
|
||||||
hCPU->gpr[rD] = ~hCPU->gpr[rA] + hCPU->gpr[rB] + 1;
|
uint32 result = ~hCPU->gpr[rA] + hCPU->gpr[rB] + 1;
|
||||||
PPCInterpreter_setXerOV(hCPU, checkAdditionOverflow(~hCPU->gpr[rA], hCPU->gpr[rB], hCPU->gpr[rD]));
|
PPCInterpreter_setXerOV(hCPU, checkAdditionOverflow(~hCPU->gpr[rA], hCPU->gpr[rB], result));
|
||||||
|
hCPU->gpr[rD] = result;
|
||||||
if (opHasRC())
|
if (opHasRC())
|
||||||
ppc_update_cr0(hCPU, hCPU->gpr[rD]);
|
ppc_update_cr0(hCPU, hCPU->gpr[rD]);
|
||||||
PPCInterpreter_nextInstruction(hCPU);
|
PPCInterpreter_nextInstruction(hCPU);
|
||||||
|
Loading…
Reference in New Issue
Block a user