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)