Fix IOP bltzal and bgezal opcodes

This commit is contained in:
Kingcom 2015-12-27 17:31:10 +01:00 committed by Gregory Hainaut
parent aca2f1434b
commit ae763523d3
2 changed files with 8 additions and 11 deletions

View File

@ -39,9 +39,9 @@ void psxBGEZ() // Branch if Rs >= 0
void psxBGEZAL() // Branch if Rs >= 0 and link void psxBGEZAL() // Branch if Rs >= 0 and link
{ {
_SetLink(31);
if (_i32(_rRs_) >= 0) if (_i32(_rRs_) >= 0)
{ {
_SetLink(31);
doBranch(_BranchTarget_); doBranch(_BranchTarget_);
} }
} }
@ -62,9 +62,9 @@ void psxBLTZ() // Branch if Rs < 0
void psxBLTZAL() // Branch if Rs < 0 and link void psxBLTZAL() // Branch if Rs < 0 and link
{ {
_SetLink(31);
if (_i32(_rRs_) < 0) if (_i32(_rRs_) < 0)
{ {
_SetLink(31);
doBranch(_BranchTarget_); doBranch(_BranchTarget_);
} }
} }

View File

@ -1163,13 +1163,12 @@ void rpsxBLTZAL()
_psxDeleteReg(31, 0); _psxDeleteReg(31, 0);
_psxFlushAllUnused(); _psxFlushAllUnused();
PSX_SET_CONST(31);
g_psxConstRegs[31] = psxpc + 4;
if( PSX_IS_CONST1(_Rs_) ) { if( PSX_IS_CONST1(_Rs_) ) {
if( (int)g_psxConstRegs[_Rs_] >= 0 ) if( (int)g_psxConstRegs[_Rs_] >= 0 )
branchTo = psxpc+4; branchTo = psxpc+4;
else {
PSX_SET_CONST(_Rt_);
g_psxConstRegs[31] = psxpc+4;
}
psxRecompileNextInstruction(1); psxRecompileNextInstruction(1);
psxSetBranchImm( branchTo ); psxSetBranchImm( branchTo );
@ -1181,7 +1180,6 @@ void rpsxBLTZAL()
psxSaveBranchState(); psxSaveBranchState();
MOV32ItoM((uptr)&psxRegs.GPR.r[31], psxpc+4);
psxRecompileNextInstruction(1); psxRecompileNextInstruction(1);
psxSetBranchImm(psxpc); psxSetBranchImm(psxpc);
@ -1205,11 +1203,12 @@ void rpsxBGEZAL()
_psxDeleteReg(31, 0); _psxDeleteReg(31, 0);
_psxFlushAllUnused(); _psxFlushAllUnused();
PSX_SET_CONST(31);
g_psxConstRegs[31] = psxpc + 4;
if( PSX_IS_CONST1(_Rs_) ) { if( PSX_IS_CONST1(_Rs_) ) {
if( (int)g_psxConstRegs[_Rs_] < 0 ) if( (int)g_psxConstRegs[_Rs_] < 0 )
branchTo = psxpc+4; branchTo = psxpc+4;
else
MOV32ItoM((uptr)&psxRegs.GPR.r[31], psxpc+4);
psxRecompileNextInstruction(1); psxRecompileNextInstruction(1);
psxSetBranchImm( branchTo ); psxSetBranchImm( branchTo );
@ -1219,8 +1218,6 @@ void rpsxBGEZAL()
CMP32ItoM((uptr)&psxRegs.GPR.r[_Rs_], 0); CMP32ItoM((uptr)&psxRegs.GPR.r[_Rs_], 0);
u32* pjmp = JGE32(0); u32* pjmp = JGE32(0);
MOV32ItoM((uptr)&psxRegs.GPR.r[31], psxpc+4);
psxSaveBranchState(); psxSaveBranchState();
psxRecompileNextInstruction(1); psxRecompileNextInstruction(1);