From e95e7452fe362d767bc297999b11a88c06844f13 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Thu, 18 Aug 2022 14:31:39 +0200 Subject: [PATCH] Emulator: Change register af 16-bit => a 8-bit --- src/cpu.cpp | 8 ++++---- src/cpu.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cpu.cpp b/src/cpu.cpp index b1837e2..0e632d3 100644 --- a/src/cpu.cpp +++ b/src/cpu.cpp @@ -33,13 +33,13 @@ void CPU::add(uint8_t byte, uint8_t immediate) // clock += 8; // Flags: Z0HC - m_z = (m_af >> 8) + immediate == 0; + m_z = m_a + immediate == 0; m_n = 0; - m_h = (m_af >> 8) + immediate > 16; - m_c = (m_af >> 8) + immediate > 255; + m_h = m_a + immediate > 16; + m_c = m_a + immediate > 255; // A = A + r - m_af = m_af + (immediate << 8); + m_a += immediate; break; default: break; diff --git a/src/cpu.h b/src/cpu.h index 45346df..ba4955c 100644 --- a/src/cpu.h +++ b/src/cpu.h @@ -37,15 +37,15 @@ public: // Miscellaneous Instructions private: - // 16-bit registers - uint16_t m_af { 0 }; // Accumulator & Flags + // Registers + uint8_t m_a { 0 }; // Accumulator uint16_t m_bc { 0 }; // BC uint16_t m_de { 0 }; // DE uint16_t m_hl { 0 }; // HL uint16_t m_sp { 0 }; // Stack Pointer uint16_t m_pc { 0 }; // Program Counter - // 8-bit registers (flags) + // Flags uint8_t m_z { 0 }; // Zero flag uint8_t m_n { 0 }; // Subtraction flag (BCD) uint8_t m_h { 0 }; // Half Carry flag (BCD)