From d33de14694da804d97d5531335934bafda6aac3b Mon Sep 17 00:00:00 2001 From: Riyyi Date: Sat, 15 Oct 2022 11:13:54 +0200 Subject: [PATCH] Emulator: Fix swap opcodes --- src/cpu-prefix.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cpu-prefix.cpp b/src/cpu-prefix.cpp index 97009f2..164e84d 100644 --- a/src/cpu-prefix.cpp +++ b/src/cpu-prefix.cpp @@ -365,8 +365,7 @@ void CPU::swap() m_wait_cycles += 8; // Swap upper 4 bits in register r8 with lower 4 bits - register_ = register_ & 0xff; - register_ = (register_ >> 4) | (register_ << 4); + register_ = ((register_ >> 4) | (register_ << 4)) & 0xff; // Set flags m_zf = (register_ == 0);