From 5b08c181270ec056dc47bf25a50f7e2c7c49bfdc Mon Sep 17 00:00:00 2001 From: Riyyi Date: Fri, 2 Sep 2022 16:35:43 +0200 Subject: [PATCH] Emulator: Fix DAA carry flag, opcode: 0x27 --- src/cpu.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cpu.cpp b/src/cpu.cpp index 2a43b5d..51d12cd 100644 --- a/src/cpu.cpp +++ b/src/cpu.cpp @@ -548,6 +548,8 @@ void CPU::daa() if (!m_nf) { if (m_cf || m_a > 0x99) { m_a += 0x60; + // Carry flag + m_cf = 1; } if (m_hf || (m_a & 0xf) > 0x9) { @@ -564,9 +566,6 @@ void CPU::daa() } } - // Carry flag - m_cf = (m_a & 0x100) == 0x100; - m_a = m_a & 0xff; // Set flags