diff --git a/cpu/decoder.cpp b/cpu/decoder.cpp index 9607fbc..f945d32 100644 --- a/cpu/decoder.cpp +++ b/cpu/decoder.cpp @@ -273,6 +273,7 @@ void Cpu::executeInstruction() data |= (1 << bit); break; } + // All ops except for BIT write the data back to where it came from if ((prefix_op & 0xC0) != 0x40) { @@ -299,10 +300,8 @@ void Cpu::executeInstruction() case 0xED: case 0xFD: break; - case 0x00: // defined NOP break; - case 0x0A: // Load A, [BC] state.A = bus->read8(state.BC); mcycles = 2; @@ -393,7 +392,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 @@ -402,7 +400,6 @@ void Cpu::executeInstruction() 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 @@ -411,19 +408,16 @@ void Cpu::executeInstruction() 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; state.halfcarry = false; break; - case 0x37: // SCF Set carry flag state.carry = true; state.subtract = false; state.halfcarry = false; break; - case 0x27: // DAA { u16 corr = 0; @@ -439,13 +433,11 @@ void Cpu::executeInstruction() state.carry = (res16 & 0x100); } break; - case 0x2F: // CPL Complement accumulator state.A = ~state.A; state.subtract = true; state.halfcarry = true; break; - case 0xC3: // JP nn state.PC = readPC16(); mcycles = 4; @@ -469,14 +461,12 @@ void Cpu::executeInstruction() state.IME = IME_SCHEDULED; mcycles = 4; break; - case 0xF3: // DI state.IME = IME_OFF; break; case 0xFB: // EI state.IME = IME_SCHEDULED; break; - case 0x76: // HALT state.halted = true; break; @@ -484,7 +474,6 @@ void Cpu::executeInstruction() (void)readPC8(); state.stopped = true; break; - case 0xE8: // ADD SP, e8 add16(*this, state.SP, state.SP, (s8)readPC8()); state.zero = false;