From d73111515e9b1f353d849664b7527824116f34d8 Mon Sep 17 00:00:00 2001 From: sBubshait Date: Thu, 6 Jun 2024 00:47:06 +0100 Subject: [PATCH] Fix Overflow handling in Subtraction DP Register, w/ T --- src/execute.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/execute.c b/src/execute.c index cc5d0ba..fc436af 100644 --- a/src/execute.c +++ b/src/execute.c @@ -262,7 +262,7 @@ static void executeDPRegister(Machine *state, a64inst_instruction *inst) { writeRegister(state, dest, regType, result); updateCondNZ(state, result, regType); - state->conditionCodes.Overflow = src1Val < result; + state->conditionCodes.Overflow = getMSB(src1Val, regType) != getMSB(src2Val, regType) && getMSB(src1Val, regType) != getMSB(result, regType); state->conditionCodes.Carry = src1Val >= src2Val; break;