From 77bd32114a11ae1c62b734ca2e84199def85ef4f Mon Sep 17 00:00:00 2001 From: MadMaurice Date: Wed, 30 Aug 2023 13:34:14 +0200 Subject: [PATCH] cpu/decoder - Join code for INC rr and DEC rr --- cpu/decoder.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/cpu/decoder.cpp b/cpu/decoder.cpp index f945d32..989e199 100644 --- a/cpu/decoder.cpp +++ b/cpu/decoder.cpp @@ -119,14 +119,9 @@ void Cpu::executeInstruction() break; } } - else if((op & 0xCF) == 0x03) // INC rr + else if((op & 0xC7) == 0x03) // INC rr; DEC rr { - state.reg16((op >> 4) & 0x3) += 1; - mcycles = 2; - } - else if((op & 0xCF) == 0x0B) // DEC rr - { - state.reg16((op >> 4) & 0x3) -= 1; + state.reg16((op >> 4) & 0x3) += ((op & 0x08) ? -1 : 1); mcycles = 2; } else if((op & 0xE7) == 0xC2) // JP cc, nn: