X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libpcsxcore%2Fpsxinterpreter.c;h=e904cee6fefce269abbe9dac3304ec7557f1fd21;hb=9e0fad6aaa0ca02dff050abb730688e0bba41ed3;hp=cf3de7985a3df639a4644e02bfdcd2151a31edf0;hpb=247fc699be6b3bd95fd9126541e0804cc8dffdd4;p=pcsx_rearmed.git diff --git a/libpcsxcore/psxinterpreter.c b/libpcsxcore/psxinterpreter.c index cf3de798..e904cee6 100644 --- a/libpcsxcore/psxinterpreter.c +++ b/libpcsxcore/psxinterpreter.c @@ -39,6 +39,14 @@ static u32 branchPC; #define debugI() #endif +#ifndef NDEBUG +#include "debug.h" +#else +void StartDebugger() {} +void ProcessDebug() {} +void StopDebugger() {} +#endif + void execI(); // Subsets @@ -501,14 +509,20 @@ void psxSLTU() { if (!_Rd_) return; _rRd_ = _u32(_rRs_) < _u32(_rRt_); } // Rd * Format: OP rs, rt * *********************************************************/ void psxDIV() { - if (_i32(_rRt_) != 0) { - _i32(_rLo_) = _i32(_rRs_) / _i32(_rRt_); - _i32(_rHi_) = _i32(_rRs_) % _i32(_rRt_); - } - else { - _i32(_rLo_) = _i32(_rRs_) >= 0 ? 0xffffffff : 1; - _i32(_rHi_) = _i32(_rRs_); - } + if (!_i32(_rRt_)) { + _i32(_rHi_) = _i32(_rRs_); + if (_i32(_rRs_) & 0x80000000) { + _i32(_rLo_) = 1; + } else { + _i32(_rLo_) = 0xFFFFFFFF; + } + } else if (_i32(_rRs_) == 0x80000000 && _i32(_rRt_) == 0xFFFFFFFF) { + _i32(_rLo_) = 0x80000000; + _i32(_rHi_) = 0; + } else { + _i32(_rLo_) = _i32(_rRs_) / _i32(_rRt_); + _i32(_rHi_) = _i32(_rRs_) % _i32(_rRt_); + } } void psxDIVU() {