diff --git a/cpu/decoder.cpp b/cpu/decoder.cpp index 03e9eca..926e1af 100644 --- a/cpu/decoder.cpp +++ b/cpu/decoder.cpp @@ -97,6 +97,12 @@ void Cpu::executeInstruction() aluop8(aluop, rhs); } + else if((op & 0xC7) == 0xC6) // ADD n, ADC n, SUB n, SBC n, AND n, XOR n, OR n, CP n + { + AluOp aluop = (AluOp)((op >> 3) & 0x3); + aluop8(aluop, readPC8()); + mcycles = 2; + } else if((op & 0xC6) == 0x04) // INC r; INC [HL]; DEC r; DEC [HL]; { AluOp aluop = (op & 0x1) ? SUB : ADD; @@ -387,22 +393,6 @@ void Cpu::executeInstruction() bus->write16(readPC16(), state.SP); mcycles = 5; break; case 0xF9: // LD SP, HL state.SP = state.HL; mcycles = 2; break; - case 0xC6: // ADD n - aluop8(ADD, readPC8()); mcycles = 2; break; - case 0xD6: // SUB n - aluop8(SUB, readPC8()); mcycles = 2; break; - case 0xE6: // AND n - aluop8(AND, readPC8()); mcycles = 2; break; - case 0xF6: // OR n - aluop8(OR, readPC8()); mcycles = 2; break; - case 0xCE: // ADC n - aluop8(ADC, readPC8()); mcycles = 2; break; - case 0xDE: // SBC n - aluop8(SBC, readPC8()); mcycles = 2; break; - case 0xEE: // XOR n - aluop8(XOR, readPC8()); mcycles = 2; break; - case 0xFE: // CP n - aluop8(CP, readPC8()); mcycles = 2; break; case 0x3F: // CCF complement carry flag state.carry = !state.carry; state.subtract = false;