@Test public void shouldEnableFlagN() { Instruction instruction = new Sub8BitRegisterToAIntoA(z80, ANY_8BIT_SOURCE_REGISTER); instruction.execute(); assertTrue(z80.isFlagNEnabled()); }
@Override public void execute() { byte sourceValue = z80.get8BitRegisterValue(sourceRegister); byte registerAValue = z80.get8BitRegisterValue(Register.A); byte result = (byte) (registerAValue - sourceValue); z80.set8BitRegisterValue(Register.A, result); z80.setLastInstructionExecutionTime(1); z80.resetFlagF(); z80.enableFlagN(); if (result == 0) { z80.enableFlagZ(); } if (((result & 0xF) < (sourceValue & 0xF))) { z80.enableFlagH(); } if ((result & 0xff) < (sourceValue & 0xff)) { z80.enableFlagCY(); } }
Sub8BitRegisterToAIntoA extends Instruction { @Override public void execute() { byte sourceValue = z80.get8BitRegisterValue(sourceRegister); byte registerAValue = z80.get8BitRegisterValue(Register.A); byte result = (byte) (registerAValue - sourceValue); z80.set8BitRegisterValue(Register.A, result); z80.setLastInstructionExecutionTime(1); z80.resetFlagF(); z80.enableFlagN(); if (result == 0) { z80.enableFlagZ(); } if (((result & 0xF) < (sourceValue & 0xF))) { z80.enableFlagH(); } if ((result & 0xff) < (sourceValue & 0xff)) { z80.enableFlagCY(); } } }
Sub8BitRegisterToAIntoA extends Instruction { @Override public void execute() { byte sourceValue = z80.get8BitRegisterValue(sourceRegister); byte registerAValue = z80.get8BitRegisterValue(Register.A); byte result = (byte) (registerAValue - sourceValue); z80.set8BitRegisterValue(Register.A, result); z80.setLastInstructionExecutionTime(1); z80.resetFlagF(); z80.enableFlagN(); if (result == 0) { z80.enableFlagZ(); } if (((result & 0xF) < (sourceValue & 0xF))) { z80.enableFlagH(); } if ((result & 0xff) < (sourceValue & 0xff)) { z80.enableFlagCY(); } } Sub8BitRegisterToAIntoA(GBZ80 z80, Register sourceRegister); }
Sub8BitRegisterToAIntoA extends Instruction { @Override public void execute() { byte sourceValue = z80.get8BitRegisterValue(sourceRegister); byte registerAValue = z80.get8BitRegisterValue(Register.A); byte result = (byte) (registerAValue - sourceValue); z80.set8BitRegisterValue(Register.A, result); z80.setLastInstructionExecutionTime(1); z80.resetFlagF(); z80.enableFlagN(); if (result == 0) { z80.enableFlagZ(); } if (((result & 0xF) < (sourceValue & 0xF))) { z80.enableFlagH(); } if ((result & 0xff) < (sourceValue & 0xff)) { z80.enableFlagCY(); } } Sub8BitRegisterToAIntoA(GBZ80 z80, Register sourceRegister); @Override void execute(); }
Sub8BitRegisterToAIntoA extends Instruction { @Override public void execute() { byte sourceValue = z80.get8BitRegisterValue(sourceRegister); byte registerAValue = z80.get8BitRegisterValue(Register.A); byte result = (byte) (registerAValue - sourceValue); z80.set8BitRegisterValue(Register.A, result); z80.setLastInstructionExecutionTime(1); z80.resetFlagF(); z80.enableFlagN(); if (result == 0) { z80.enableFlagZ(); } if (((result & 0xF) < (sourceValue & 0xF))) { z80.enableFlagH(); } if ((result & 0xff) < (sourceValue & 0xff)) { z80.enableFlagCY(); } } Sub8BitRegisterToAIntoA(GBZ80 z80, Register sourceRegister); @Override void execute();  }