@Test public void shouldStoreTheContentOfTheSourceRegisterIntoTheMemoryPointedByHLRegister() { z80.set16BitRegisterValue(Register.HL, ANY_16BIT_REGISTER_VALUE); z80.set8BitRegisterValue(ANY_8BIT_SOURCE_REGISTER, ANY_8BIT_REGISTER_VALUE); when(mmu.readByte(ANY_8BIT_REGISTER_VALUE)).thenReturn(ANY_MEMORY_BYTE_VALUE); Instruction instruction = new Load8BitRegisterAddressIntoHLAddress(z80, mmu, ANY_8BIT_SOURCE_REGISTER); instruction.execute(); verify(mmu).writeByte(ANY_16BIT_REGISTER_VALUE, ANY_MEMORY_BYTE_VALUE); }
@Override public void execute() { int registerValue = z80.get8BitRegisterValue(sourceRegister); byte memoryValue = mmu.readByte(registerValue); int address = z80.get16BitRegisterValue(Register.HL); mmu.writeByte(address, memoryValue); z80.setLastInstructionExecutionTime(2); }
Load8BitRegisterAddressIntoHLAddress extends Instruction { @Override public void execute() { int registerValue = z80.get8BitRegisterValue(sourceRegister); byte memoryValue = mmu.readByte(registerValue); int address = z80.get16BitRegisterValue(Register.HL); mmu.writeByte(address, memoryValue); z80.setLastInstructionExecutionTime(2); } }
Load8BitRegisterAddressIntoHLAddress extends Instruction { @Override public void execute() { int registerValue = z80.get8BitRegisterValue(sourceRegister); byte memoryValue = mmu.readByte(registerValue); int address = z80.get16BitRegisterValue(Register.HL); mmu.writeByte(address, memoryValue); z80.setLastInstructionExecutionTime(2); } Load8BitRegisterAddressIntoHLAddress(GBZ80 z80, MMU mmu, Register sourceRegister); }
Load8BitRegisterAddressIntoHLAddress extends Instruction { @Override public void execute() { int registerValue = z80.get8BitRegisterValue(sourceRegister); byte memoryValue = mmu.readByte(registerValue); int address = z80.get16BitRegisterValue(Register.HL); mmu.writeByte(address, memoryValue); z80.setLastInstructionExecutionTime(2); } Load8BitRegisterAddressIntoHLAddress(GBZ80 z80, MMU mmu, Register sourceRegister); @Override void execute(); }
Load8BitRegisterAddressIntoHLAddress extends Instruction { @Override public void execute() { int registerValue = z80.get8BitRegisterValue(sourceRegister); byte memoryValue = mmu.readByte(registerValue); int address = z80.get16BitRegisterValue(Register.HL); mmu.writeByte(address, memoryValue); z80.setLastInstructionExecutionTime(2); } Load8BitRegisterAddressIntoHLAddress(GBZ80 z80, MMU mmu, Register sourceRegister); @Override void execute();  }