From fb13d9fdcecc92d3603c7d8ed556910bf93fcd65 Mon Sep 17 00:00:00 2001 From: "Adrian.Conlon" Date: Sun, 13 Aug 2017 21:34:19 +0100 Subject: [PATCH] Correct GB: SWAP r operation. The demoted high nibble was being effectively zeroed each time. Signed-off-by: Adrian.Conlon --- LR35902/src/LR35902.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LR35902/src/LR35902.cpp b/LR35902/src/LR35902.cpp index f0a8761..4e28c16 100644 --- a/LR35902/src/LR35902.cpp +++ b/LR35902/src/LR35902.cpp @@ -342,7 +342,7 @@ void EightBit::LR35902::ccf(uint8_t& a, uint8_t& f) { uint8_t EightBit::LR35902::swap(uint8_t& f, uint8_t operand) { auto low = lowNibble(operand); auto high = highNibble(operand); - operand = promoteNibble(low) | demoteNibble(high); + operand = promoteNibble(low) | high; adjustZero(f, operand); clearFlag(f, NF | HC | CF); return operand;