@Test public void shouldIncrementProgramCounterOnceAfterTheInstructionExecution() { int originalProgramCounter = z80.getProgramCounter(); Instruction load8BitImm = new Load8BitImmPCInto8BitRegister(z80, mmu, ANY_8BIT_DESTINY_REGISTER); load8BitImm.execute(); assertEquals(originalProgramCounter + 1, z80.getProgramCounter()); }
@Override public void execute() { int address = z80.getProgramCounter(); byte registerValue = mmu.readByte(address); z80.set8BitRegisterValue(destinyRegister, registerValue); z80.incrementProgramCounter(); z80.setLastInstructionExecutionTime(2); }
Load8BitImmPCInto8BitRegister extends Instruction { @Override public void execute() { int address = z80.getProgramCounter(); byte registerValue = mmu.readByte(address); z80.set8BitRegisterValue(destinyRegister, registerValue); z80.incrementProgramCounter(); z80.setLastInstructionExecutionTime(2); } }
Load8BitImmPCInto8BitRegister extends Instruction { @Override public void execute() { int address = z80.getProgramCounter(); byte registerValue = mmu.readByte(address); z80.set8BitRegisterValue(destinyRegister, registerValue); z80.incrementProgramCounter(); z80.setLastInstructionExecutionTime(2); } Load8BitImmPCInto8BitRegister(GBZ80 z80, MMU mmu, Register destinyRegister); }
Load8BitImmPCInto8BitRegister extends Instruction { @Override public void execute() { int address = z80.getProgramCounter(); byte registerValue = mmu.readByte(address); z80.set8BitRegisterValue(destinyRegister, registerValue); z80.incrementProgramCounter(); z80.setLastInstructionExecutionTime(2); } Load8BitImmPCInto8BitRegister(GBZ80 z80, MMU mmu, Register destinyRegister); @Override void execute(); }
Load8BitImmPCInto8BitRegister extends Instruction { @Override public void execute() { int address = z80.getProgramCounter(); byte registerValue = mmu.readByte(address); z80.set8BitRegisterValue(destinyRegister, registerValue); z80.incrementProgramCounter(); z80.setLastInstructionExecutionTime(2); } Load8BitImmPCInto8BitRegister(GBZ80 z80, MMU mmu, Register destinyRegister); @Override void execute();  }