From 80c68035c5b5a799fa5ef717a85c8e31e31453fd Mon Sep 17 00:00:00 2001 From: Riyyi Date: Sat, 15 Oct 2022 11:11:06 +0200 Subject: [PATCH] Emulator: Fix non-prefix rotate opcodes --- src/cpu.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cpu.cpp b/src/cpu.cpp index d4f3fbf..0c8a8f1 100644 --- a/src/cpu.cpp +++ b/src/cpu.cpp @@ -1241,7 +1241,7 @@ void CPU::ra() m_cf = (m_a & 0x80) == 0x80; // Rotate register A left - m_a = (m_a >> 7) | (m_a << 1); + m_a = ((m_a >> 7) | (m_a << 1)) & 0xff; break; case 0x0f: // RRCA @@ -1256,7 +1256,7 @@ void CPU::ra() m_cf = (m_a & 0x1) == 0x1; // Rotate register A right - m_a = (m_a >> 1) | (m_a << 7); + m_a = ((m_a >> 1) | (m_a << 7)) & 0xff; break; case 0x17: { // RLA @@ -1272,7 +1272,7 @@ void CPU::ra() m_cf = (m_a & 0x80) == 0x80; // Rotate register A left through carry - m_a = old_carry | (m_a << 1); + m_a = (old_carry | (m_a << 1)) & 0xff; break; } case 0x1f: { // RRA @@ -1289,7 +1289,7 @@ void CPU::ra() m_cf = (m_a & 0x1) == 0x1; // Rotate register A right through carry - m_a = (m_a >> 1) | (old_carry << 7); + m_a = ((m_a >> 1) | (old_carry << 7)) & 0xff; break; } default: