From e17a94a409970a457ec4448ccbc2347cda014f4d Mon Sep 17 00:00:00 2001 From: SarahW Date: Tue, 9 Oct 2018 22:10:29 +0100 Subject: [PATCH] FDIVP/FDIVRP should pop the stack when a divide by zero occurs and the exception is masked. Fixes software rendering on Need for Speed III. --- src/x87_ops.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/x87_ops.h b/src/x87_ops.h index dd46f91..b1cc843 100644 --- a/src/x87_ops.h +++ b/src/x87_ops.h @@ -18,15 +18,15 @@ static int rounding_modes[4] = {FE_TONEAREST, FE_DOWNWARD, FE_UPWARD, FE_TOWARDZ { \ if (((double)src2) == 0.0) \ { \ - cpu_state.npxs |= STATUS_ZERODIVIDE; \ - if (cpu_state.npxc & STATUS_ZERODIVIDE) \ + cpu_state.npxs |= STATUS_ZERODIVIDE; \ + if (cpu_state.npxc & STATUS_ZERODIVIDE) \ dst = src1 / (double)src2; \ else \ { \ pclog("FPU : divide by zero\n"); \ picint(1 << 13); \ + return 1; \ } \ - return 1; \ } \ else \ dst = src1 / (double)src2; \