From: Toni Wilen Date: Fri, 9 Aug 2019 19:31:48 +0000 (+0300) Subject: 68020/030 DIVU.W divide by zero flag fix. Same behavior as 68000. X-Git-Tag: 4300~158 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=b275cd75896cdf644b1aa15f4db00cc2bc93bbe9;p=francis%2Fwinuae.git 68020/030 DIVU.W divide by zero flag fix. Same behavior as 68000. --- diff --git a/newcpu_common.cpp b/newcpu_common.cpp index 9784d5fd..c29c69c3 100644 --- a/newcpu_common.cpp +++ b/newcpu_common.cpp @@ -762,7 +762,7 @@ int getDivs68kCycles (uae_s32 dividend, uae_s16 divisor) /* DIV divide by zero * * 68000 Signed: NVC=0 Z=1. Unsigned: VC=0 N=(dst>>16)<0 Z=(dst>>16)==0 - * 68020 and 68030: Signed: Z=1 NVC=0. Unsigned: V=1, N>16)<0 Z=(dst>>16)==0, C=0. * 68040/68060 C=0. * */ @@ -770,13 +770,15 @@ void divbyzero_special (bool issigned, uae_s32 dst) { if (currprefs.cpu_model == 68020 || currprefs.cpu_model == 68030) { CLEAR_CZNV (); - if (issigned == false) { - if (dst < 0) - SET_NFLG (1); - SET_ZFLG (!GET_NFLG ()); - SET_VFLG (1); + if (issigned) { + SET_ZFLG(1); } else { - SET_ZFLG (1); + uae_s16 d = dst >> 16; + if (d < 0) + SET_NFLG(1); + else if (d == 0) + SET_ZFLG(1); + SET_VFLG (1); } } else if (currprefs.cpu_model >= 68040) { SET_CFLG (0);