JumpToHLAddress extends Instruction { @Override public void execute() { int value = z80.get16BitRegisterValue(Register.HL); z80.setProgramCounter(value); z80.setLastInstructionExecutionTime(1); } JumpToHLAddress(GBZ80 z80, MMU mmu); @Override void execute();  }
@Test public void shouldUseOneCycleAsLastInstructionExecutionTime() { Instruction instruction = new JumpToHLAddress(z80, mmu); instruction.execute(); assertEquals(1, z80.getLastInstructionExecutionTime()); }
@Test public void shouldUpdateProgramCounterWithTheHLRegisterValue() { z80.set16BitRegisterValue(Register.HL, ANY_16BIT_REGISTER_VALUE); Instruction instruction = new JumpToHLAddress(z80, mmu); instruction.execute(); assertEquals(ANY_16BIT_REGISTER_VALUE, z80.getProgramCounter()); }