From: notaz Date: Tue, 25 Oct 2011 21:01:47 +0000 (+0300) Subject: psxinterpreter: a bit more accurate Cause reg handling X-Git-Tag: r11~23 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=commitdiff_plain;h=48e74ef5e10804f8809fae397be4234e8bf613a7;hp=15d0ba027cfbe88c69b539cc0c9ac6769e577c78 psxinterpreter: a bit more accurate Cause reg handling --- diff --git a/libpcsxcore/psxinterpreter.c b/libpcsxcore/psxinterpreter.c index 66730d97..ff494913 100644 --- a/libpcsxcore/psxinterpreter.c +++ b/libpcsxcore/psxinterpreter.c @@ -780,10 +780,9 @@ void psxMFC0() { if (!_Rt_) return; _i32(_rRt_) = (int)_rFs_; } void psxCFC0() { if (!_Rt_) return; _i32(_rRt_) = (int)_rFs_; } void psxTestSWInts() { - // the next code is untested, if u know please - // tell me if it works ok or not (linuzappz) if (psxRegs.CP0.n.Cause & psxRegs.CP0.n.Status & 0x0300 && - psxRegs.CP0.n.Status & 0x1) { + psxRegs.CP0.n.Status & 0x1) { + psxRegs.CP0.n.Cause &= ~0x7c; psxException(psxRegs.CP0.n.Cause, branch); } } @@ -797,7 +796,8 @@ void MTC0(int reg, u32 val) { break; case 13: // Cause - psxRegs.CP0.n.Cause = val & ~(0xfc00); + psxRegs.CP0.n.Cause &= ~0x0300; + psxRegs.CP0.n.Cause |= val & 0x0300; psxTestSWInts(); break; diff --git a/libpcsxcore/r3000a.c b/libpcsxcore/r3000a.c index cccfa602..f5996acf 100644 --- a/libpcsxcore/r3000a.c +++ b/libpcsxcore/r3000a.c @@ -89,7 +89,7 @@ void psxException(u32 code, u32 bd) { } // Set the Cause - psxRegs.CP0.n.Cause = code; + psxRegs.CP0.n.Cause = (psxRegs.CP0.n.Cause & 0x300) | code; // Set the EPC & PC if (bd) {