cz80, fix flags for OUT[ID]/OT[ID]R
authorkub <derkub@gmail.com>
Fri, 22 Jan 2021 21:33:23 +0000 (22:33 +0100)
committerkub <derkub@gmail.com>
Fri, 22 Jan 2021 21:33:37 +0000 (22:33 +0100)
cpu/cz80/cz80_opED.c

index c3b7ec6..875eae6 100644 (file)
@@ -680,7 +680,7 @@ OP_OUTX:
                res = (UINT32)zL + (UINT32)val;\r
                if (val & SF) F |= NF;\r
                if (res & 0x100) F |= HF | CF;\r
-               F |= SZP[(UINT8)(res & 0x07) - zB] & PF;\r
+               F |= SZP[(UINT8)(res & 0x07) ^ zB] & PF;\r
                zF = F;\r
                RET(12)\r
 \r
@@ -712,7 +712,7 @@ OP_OTXR:
                res = (UINT32)zL + (UINT32)val;\r
                if (val & SF) F |= NF;\r
                if (res & 0x100) F |= HF | CF;\r
-               F |= SZP[(UINT8)(res & 0x07) - zB] & PF;\r
+               F |= SZP[(UINT8)(res & 0x07) ^ zB] & PF;\r
                zF = F;\r
                if (zB)\r
                {\r