From 502b9d20230446f7fa60e617a92f30b294ad1572 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 8 Nov 2023 22:06:58 -0500 Subject: [PATCH] Simplify implementation of DAA. --- InstructionSets/x86/Implementation/BCD.hpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/InstructionSets/x86/Implementation/BCD.hpp b/InstructionSets/x86/Implementation/BCD.hpp index f8de9e6fd..1d86e865a 100644 --- a/InstructionSets/x86/Implementation/BCD.hpp +++ b/InstructionSets/x86/Implementation/BCD.hpp @@ -162,22 +162,15 @@ void daa( The SF, ZF, and PF flags are set according to the result. The OF flag is undefined. */ const uint8_t old_al = al; - const auto old_carry = context.flags.template flag(); - context.flags.template set_from(0); if((al & 0x0f) > 0x09 || context.flags.template flag()) { - context.flags.template set_from(old_carry | (al > 0xf9)); al += 0x06; context.flags.template set_from(1); - } else { - context.flags.template set_from(0); } - if(old_al > 0x99 || old_carry) { + if(old_al > 0x99 || context.flags.template flag()) { al += 0x60; context.flags.template set_from(1); - } else { - context.flags.template set_from(0); } context.flags.template set_from(al);