@Test public void shouldUseTwoCyclesAsLastInstructionExecutionTime() { Instruction instruction = new LoadHLAddressIntoAAndIncrementHL(z80, mmu); instruction.execute(); assertEquals(2, z80.getLastInstructionExecutionTime()); }
@Override public void execute() { int address = z80.get16BitRegisterValue(Register.HL); byte memoryValue = mmu.readByte(address); z80.set8BitRegisterValue(Register.A, memoryValue); z80.setLastInstructionExecutionTime(2); int newHLRegisterValue = z80.get16BitRegisterValue(Register.HL) + 1; z80.set16BitRegisterValue(Register.HL, newHLRegisterValue); }
LoadHLAddressIntoAAndIncrementHL extends Instruction { @Override public void execute() { int address = z80.get16BitRegisterValue(Register.HL); byte memoryValue = mmu.readByte(address); z80.set8BitRegisterValue(Register.A, memoryValue); z80.setLastInstructionExecutionTime(2); int newHLRegisterValue = z80.get16BitRegisterValue(Register.HL) + 1; z80.set16BitRegisterValue(Register.HL, newHLRegisterValue); } }
LoadHLAddressIntoAAndIncrementHL extends Instruction { @Override public void execute() { int address = z80.get16BitRegisterValue(Register.HL); byte memoryValue = mmu.readByte(address); z80.set8BitRegisterValue(Register.A, memoryValue); z80.setLastInstructionExecutionTime(2); int newHLRegisterValue = z80.get16BitRegisterValue(Register.HL) + 1; z80.set16BitRegisterValue(Register.HL, newHLRegisterValue); } LoadHLAddressIntoAAndIncrementHL(GBZ80 z80, MMU mmu); }
LoadHLAddressIntoAAndIncrementHL extends Instruction { @Override public void execute() { int address = z80.get16BitRegisterValue(Register.HL); byte memoryValue = mmu.readByte(address); z80.set8BitRegisterValue(Register.A, memoryValue); z80.setLastInstructionExecutionTime(2); int newHLRegisterValue = z80.get16BitRegisterValue(Register.HL) + 1; z80.set16BitRegisterValue(Register.HL, newHLRegisterValue); } LoadHLAddressIntoAAndIncrementHL(GBZ80 z80, MMU mmu); @Override void execute(); }
LoadHLAddressIntoAAndIncrementHL extends Instruction { @Override public void execute() { int address = z80.get16BitRegisterValue(Register.HL); byte memoryValue = mmu.readByte(address); z80.set8BitRegisterValue(Register.A, memoryValue); z80.setLastInstructionExecutionTime(2); int newHLRegisterValue = z80.get16BitRegisterValue(Register.HL) + 1; z80.set16BitRegisterValue(Register.HL, newHLRegisterValue); } LoadHLAddressIntoAAndIncrementHL(GBZ80 z80, MMU mmu); @Override void execute();  }