@Test public void shouldLoad8BitRegisterAIntoTheAddressPointedByThePCImmPortAddress() { z80.setProgramCounter(ANY_16BIT_REGISTER_VALUE); z80.set8BitRegisterValue(Register.A, ANY_8BIT_REGISTER_VALUE); Instruction instruction = new Load8BitRegisterAIntoPortAddressImmPC(z80, mmu); instruction.execute(); int expectedAddress = (mmu.readByte(ANY_16BIT_REGISTER_VALUE) & 0xFF) + 0xFF00; verify(mmu).writeByte(expectedAddress, ANY_8BIT_REGISTER_VALUE); }
@Override public void execute() { byte registerValue = z80.get8BitRegisterValue(Register.A); int address = (mmu.readByte(z80.getProgramCounter()) & 0xFF) + 0xFF00; mmu.writeByte(address, registerValue); z80.incrementProgramCounter(); z80.setLastInstructionExecutionTime(3); }
Load8BitRegisterAIntoPortAddressImmPC extends Instruction { @Override public void execute() { byte registerValue = z80.get8BitRegisterValue(Register.A); int address = (mmu.readByte(z80.getProgramCounter()) & 0xFF) + 0xFF00; mmu.writeByte(address, registerValue); z80.incrementProgramCounter(); z80.setLastInstructionExecutionTime(3); } }
Load8BitRegisterAIntoPortAddressImmPC extends Instruction { @Override public void execute() { byte registerValue = z80.get8BitRegisterValue(Register.A); int address = (mmu.readByte(z80.getProgramCounter()) & 0xFF) + 0xFF00; mmu.writeByte(address, registerValue); z80.incrementProgramCounter(); z80.setLastInstructionExecutionTime(3); } Load8BitRegisterAIntoPortAddressImmPC(GBZ80 z80, MMU mmu); }
Load8BitRegisterAIntoPortAddressImmPC extends Instruction { @Override public void execute() { byte registerValue = z80.get8BitRegisterValue(Register.A); int address = (mmu.readByte(z80.getProgramCounter()) & 0xFF) + 0xFF00; mmu.writeByte(address, registerValue); z80.incrementProgramCounter(); z80.setLastInstructionExecutionTime(3); } Load8BitRegisterAIntoPortAddressImmPC(GBZ80 z80, MMU mmu); @Override void execute(); }
Load8BitRegisterAIntoPortAddressImmPC extends Instruction { @Override public void execute() { byte registerValue = z80.get8BitRegisterValue(Register.A); int address = (mmu.readByte(z80.getProgramCounter()) & 0xFF) + 0xFF00; mmu.writeByte(address, registerValue); z80.incrementProgramCounter(); z80.setLastInstructionExecutionTime(3); } Load8BitRegisterAIntoPortAddressImmPC(GBZ80 z80, MMU mmu); @Override void execute();  }