CPU: Fix BGEZAL with rs == ra
This commit is contained in:
parent
273f010d17
commit
bea727bbe4
|
@ -800,15 +800,15 @@ void Core::ExecuteInstruction(Instruction inst)
|
|||
// bgez is the inverse of bltz, so simply do ltz and xor the result
|
||||
const bool bgez = ConvertToBoolUnchecked(rt & u8(1));
|
||||
const bool branch = (static_cast<s32>(ReadReg(inst.i.rs)) < 0) ^ bgez;
|
||||
if (branch)
|
||||
{
|
||||
const bool link = ConvertToBoolUnchecked((rt >> 4) & u8(1));
|
||||
|
||||
// register is still linked even if the branch isn't taken
|
||||
const bool link = (rt & u8(0x1E)) == u8(0x10);
|
||||
if (link)
|
||||
m_regs.ra = m_regs.npc;
|
||||
|
||||
if (branch)
|
||||
Branch(m_regs.pc + (inst.i.imm_sext32() << 2));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case InstructionOp::cop0:
|
||||
|
|
|
@ -214,10 +214,10 @@ struct Registers
|
|||
};
|
||||
};
|
||||
|
||||
u32 pc;
|
||||
u32 hi;
|
||||
u32 lo;
|
||||
u32 npc;
|
||||
u32 pc; // at execution time: the address of the next instruction to execute (already fetched)
|
||||
u32 npc; // at execution time: the address of the next instruction to fetch
|
||||
};
|
||||
|
||||
enum class Cop0Reg : u8
|
||||
|
|
Loading…
Reference in New Issue