Fix an issue with SUB and CMP opcodes where the carry flag would not be calculated correctly

This commit is contained in:
Luke Usher 2017-09-13 06:33:05 +01:00 committed by PatrickvL
parent 1cd9cafb78
commit ab5138a3b9
1 changed files with 2 additions and 2 deletions

View File

@ -812,7 +812,7 @@ bool EmuX86_Opcode_CMP(LPEXCEPTION_POINTERS e, _DInst& info)
return false;
// SUB Destination with src (cmp internally is a discarded subtract)
uint32_t result = dest - src;
uint64_t result = dest - src;
EmuX86_SetFlag(e, EMUX86_EFLAG_CF, (result >> 32) > 0);
EmuX86_SetFlag(e, EMUX86_EFLAG_OF, (result >> 31) != (dest >> 31));
@ -923,7 +923,7 @@ bool EmuX86_Opcode_SUB(LPEXCEPTION_POINTERS e, _DInst& info)
return false;
// SUB Destination with src
uint32_t result = dest - src;
uint64_t result = dest - src;
// Write result back
EmuX86_Operand_Write(e, info, 0, result);