Load8BitBCAddressIntoA extends Instruction { @Override public void execute() { int address = z80.get16BitRegisterValue(Register.BC); byte memoryValue = mmu.readByte(address); z80.set8BitRegisterValue(Register.A, memoryValue); z80.setLastInstructionExecutionTime(2); } Load8BitBCAddressIntoA(GBZ80 z80, MMU mmu); @Override void execute();  }
@Test public void shouldLoadTheByteOfMemoryPointedByBCRegisterIntoTheRegisterA() { z80.set16BitRegisterValue(Register.BC, ANY_16BIT_REGISTER_VALUE); when(mmu.readByte(ANY_16BIT_REGISTER_VALUE)).thenReturn(ANY_MEMORY_BYTE_VALUE); Instruction instruction = new Load8BitBCAddressIntoA(z80, mmu); instruction.execute(); assertEquals(ANY_MEMORY_BYTE_VALUE, z80.get8BitRegisterValue(Register.A)); }
@Test public void shouldUseTwoCyclesAsLastExecutionTime() { Instruction instruction = new Load8BitBCAddressIntoA(z80, mmu); instruction.execute(); assertEquals(2, z80.getLastInstructionExecutionTime()); }