diff --git a/Z80/inc/Profiler.h b/Z80/inc/Profiler.h index c7ebded..4943a38 100644 --- a/Z80/inc/Profiler.h +++ b/Z80/inc/Profiler.h @@ -21,8 +21,8 @@ namespace EightBit { private: std::array m_instructions; std::array m_addresses; - Disassembler& m_disassembler; Z80& m_cpu; + Disassembler& m_disassembler; void dumpInstructionProfiles() const; void dumpAddressProfiles() const; diff --git a/Z80/src/Z80.cpp b/Z80/src/Z80.cpp index 14d725b..fa1365c 100644 --- a/Z80/src/Z80.cpp +++ b/Z80/src/Z80.cpp @@ -327,16 +327,18 @@ void EightBit::Z80::compare(uint8_t& f, uint8_t check, uint8_t value) { uint8_t EightBit::Z80::rlc(uint8_t& f, uint8_t operand) { clearFlag(f, NF | HC); - setFlag(f, CF, operand & Bit7); - operand = _rotl8(operand, 1); + const auto carry = operand & Bit7; + operand = (operand << 1) | (carry >> 7); + setFlag(f, CF, carry); adjustXY(f, operand); return operand; } uint8_t EightBit::Z80::rrc(uint8_t& f, uint8_t operand) { clearFlag(f, NF | HC); - setFlag(f, CF, operand & Bit0); - operand = _rotr8(operand, 1); + const auto carry = operand & Bit0; + operand = (operand >> 1) | (carry << 7); + setFlag(f, CF, carry); adjustXY(f, operand); return operand; } @@ -372,7 +374,7 @@ uint8_t EightBit::Z80::sla(uint8_t& f, uint8_t operand) { uint8_t EightBit::Z80::sra(uint8_t& f, uint8_t operand) { clearFlag(f, NF | HC); setFlag(f, CF, operand & Bit0); - operand = (operand >> 1) | operand & Bit7; + operand = (operand >> 1) | (operand & Bit7); adjustXY(f, operand); return operand; }