@Test public void shouldDisableFlagN() { Instruction instruction = new Add8BitRegisterPlusAIntoA(z80, ANY_8BIT_SOURCE_REGISTER); instruction.execute(); assertFalse(z80.isFlagNEnabled()); }
@Override public void execute() { byte registerAValue = z80.get8BitRegisterValue(Register.A); byte sourceRegisterValue = z80.get8BitRegisterValue(sourceRegister); byte sum = (byte) (registerAValue + sourceRegisterValue); z80.set8BitRegisterValue(Register.A, sum); z80.setLastInstructionExecutionTime(1); z80.resetFlagF(); if (sum == 0) { z80.enableFlagZ(); } if ((sum & 0x100) == 0x100) { z80.enableFlagCY(); } if ((sum & 0x10) == 0x10) { z80.enableFlagH(); } }
Add8BitRegisterPlusAIntoA extends Instruction { @Override public void execute() { byte registerAValue = z80.get8BitRegisterValue(Register.A); byte sourceRegisterValue = z80.get8BitRegisterValue(sourceRegister); byte sum = (byte) (registerAValue + sourceRegisterValue); z80.set8BitRegisterValue(Register.A, sum); z80.setLastInstructionExecutionTime(1); z80.resetFlagF(); if (sum == 0) { z80.enableFlagZ(); } if ((sum & 0x100) == 0x100) { z80.enableFlagCY(); } if ((sum & 0x10) == 0x10) { z80.enableFlagH(); } } }
Add8BitRegisterPlusAIntoA extends Instruction { @Override public void execute() { byte registerAValue = z80.get8BitRegisterValue(Register.A); byte sourceRegisterValue = z80.get8BitRegisterValue(sourceRegister); byte sum = (byte) (registerAValue + sourceRegisterValue); z80.set8BitRegisterValue(Register.A, sum); z80.setLastInstructionExecutionTime(1); z80.resetFlagF(); if (sum == 0) { z80.enableFlagZ(); } if ((sum & 0x100) == 0x100) { z80.enableFlagCY(); } if ((sum & 0x10) == 0x10) { z80.enableFlagH(); } } Add8BitRegisterPlusAIntoA(GBZ80 z80, Register sourceRegister); }
Add8BitRegisterPlusAIntoA extends Instruction { @Override public void execute() { byte registerAValue = z80.get8BitRegisterValue(Register.A); byte sourceRegisterValue = z80.get8BitRegisterValue(sourceRegister); byte sum = (byte) (registerAValue + sourceRegisterValue); z80.set8BitRegisterValue(Register.A, sum); z80.setLastInstructionExecutionTime(1); z80.resetFlagF(); if (sum == 0) { z80.enableFlagZ(); } if ((sum & 0x100) == 0x100) { z80.enableFlagCY(); } if ((sum & 0x10) == 0x10) { z80.enableFlagH(); } } Add8BitRegisterPlusAIntoA(GBZ80 z80, Register sourceRegister); @Override void execute(); }
Add8BitRegisterPlusAIntoA extends Instruction { @Override public void execute() { byte registerAValue = z80.get8BitRegisterValue(Register.A); byte sourceRegisterValue = z80.get8BitRegisterValue(sourceRegister); byte sum = (byte) (registerAValue + sourceRegisterValue); z80.set8BitRegisterValue(Register.A, sum); z80.setLastInstructionExecutionTime(1); z80.resetFlagF(); if (sum == 0) { z80.enableFlagZ(); } if ((sum & 0x100) == 0x100) { z80.enableFlagCY(); } if ((sum & 0x10) == 0x10) { z80.enableFlagH(); } } Add8BitRegisterPlusAIntoA(GBZ80 z80, Register sourceRegister); @Override void execute();  }