@Test public void shouldUseTwoCyclesAsLastInstructionExecutionTime() { Instruction instruction = new Add8BitImmPCPlusAIntoA(z80, mmu); instruction.execute(); assertEquals(2, z80.getLastInstructionExecutionTime()); }
@Override public void execute() { int address = z80.getProgramCounter(); byte memoryValue = mmu.readByte(address); byte registerAValue = z80.get8BitRegisterValue(Register.A); byte sum = (byte) (memoryValue + registerAValue); z80.set8BitRegisterValue(Register.A, sum); z80.incrementProgramCounter(); z80.setLastInstructionExecutionTime(2); z80.resetFlagF(); if (sum == 0) { z80.enableFlagZ(); } if ((sum & 0x100) == 0x100) { z80.enableFlagCY(); } if ((sum & 0x10) == 0x10) { z80.enableFlagH(); } }
Add8BitImmPCPlusAIntoA extends Instruction { @Override public void execute() { int address = z80.getProgramCounter(); byte memoryValue = mmu.readByte(address); byte registerAValue = z80.get8BitRegisterValue(Register.A); byte sum = (byte) (memoryValue + registerAValue); z80.set8BitRegisterValue(Register.A, sum); z80.incrementProgramCounter(); z80.setLastInstructionExecutionTime(2); z80.resetFlagF(); if (sum == 0) { z80.enableFlagZ(); } if ((sum & 0x100) == 0x100) { z80.enableFlagCY(); } if ((sum & 0x10) == 0x10) { z80.enableFlagH(); } } }
Add8BitImmPCPlusAIntoA extends Instruction { @Override public void execute() { int address = z80.getProgramCounter(); byte memoryValue = mmu.readByte(address); byte registerAValue = z80.get8BitRegisterValue(Register.A); byte sum = (byte) (memoryValue + registerAValue); z80.set8BitRegisterValue(Register.A, sum); z80.incrementProgramCounter(); z80.setLastInstructionExecutionTime(2); z80.resetFlagF(); if (sum == 0) { z80.enableFlagZ(); } if ((sum & 0x100) == 0x100) { z80.enableFlagCY(); } if ((sum & 0x10) == 0x10) { z80.enableFlagH(); } } Add8BitImmPCPlusAIntoA(GBZ80 z80, MMU mmu); }
Add8BitImmPCPlusAIntoA extends Instruction { @Override public void execute() { int address = z80.getProgramCounter(); byte memoryValue = mmu.readByte(address); byte registerAValue = z80.get8BitRegisterValue(Register.A); byte sum = (byte) (memoryValue + registerAValue); z80.set8BitRegisterValue(Register.A, sum); z80.incrementProgramCounter(); z80.setLastInstructionExecutionTime(2); z80.resetFlagF(); if (sum == 0) { z80.enableFlagZ(); } if ((sum & 0x100) == 0x100) { z80.enableFlagCY(); } if ((sum & 0x10) == 0x10) { z80.enableFlagH(); } } Add8BitImmPCPlusAIntoA(GBZ80 z80, MMU mmu); @Override void execute(); }
Add8BitImmPCPlusAIntoA extends Instruction { @Override public void execute() { int address = z80.getProgramCounter(); byte memoryValue = mmu.readByte(address); byte registerAValue = z80.get8BitRegisterValue(Register.A); byte sum = (byte) (memoryValue + registerAValue); z80.set8BitRegisterValue(Register.A, sum); z80.incrementProgramCounter(); z80.setLastInstructionExecutionTime(2); z80.resetFlagF(); if (sum == 0) { z80.enableFlagZ(); } if ((sum & 0x100) == 0x100) { z80.enableFlagCY(); } if ((sum & 0x10) == 0x10) { z80.enableFlagH(); } } Add8BitImmPCPlusAIntoA(GBZ80 z80, MMU mmu); @Override void execute();  }