@Test public void shouldDecrementTheValueOfTheSourceRegister() { z80.set8BitRegisterValue(ANY_8BIT_SOURCE_REGISTER, ANY_8BIT_REGISTER_VALUE); Instruction instruction = new Dec8BitRegister(z80, ANY_8BIT_SOURCE_REGISTER); instruction.execute(); assertEquals(ANY_8BIT_REGISTER_VALUE - 1, z80.get8BitRegisterValue(ANY_8BIT_SOURCE_REGISTER)); }
@Override public void execute() { byte registerValue = z80.get8BitRegisterValue(sourceRegister); byte result = (byte) (registerValue - 1); z80.set8BitRegisterValue(sourceRegister, result); z80.setLastInstructionExecutionTime(1); boolean wasCEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); z80.enableFlagN(); if (wasCEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } }
Dec8BitRegister extends Instruction { @Override public void execute() { byte registerValue = z80.get8BitRegisterValue(sourceRegister); byte result = (byte) (registerValue - 1); z80.set8BitRegisterValue(sourceRegister, result); z80.setLastInstructionExecutionTime(1); boolean wasCEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); z80.enableFlagN(); if (wasCEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } } }
Dec8BitRegister extends Instruction { @Override public void execute() { byte registerValue = z80.get8BitRegisterValue(sourceRegister); byte result = (byte) (registerValue - 1); z80.set8BitRegisterValue(sourceRegister, result); z80.setLastInstructionExecutionTime(1); boolean wasCEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); z80.enableFlagN(); if (wasCEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } } Dec8BitRegister(GBZ80 z80, Register sourceRegister); }
Dec8BitRegister extends Instruction { @Override public void execute() { byte registerValue = z80.get8BitRegisterValue(sourceRegister); byte result = (byte) (registerValue - 1); z80.set8BitRegisterValue(sourceRegister, result); z80.setLastInstructionExecutionTime(1); boolean wasCEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); z80.enableFlagN(); if (wasCEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } } Dec8BitRegister(GBZ80 z80, Register sourceRegister); @Override void execute(); }
Dec8BitRegister extends Instruction { @Override public void execute() { byte registerValue = z80.get8BitRegisterValue(sourceRegister); byte result = (byte) (registerValue - 1); z80.set8BitRegisterValue(sourceRegister, result); z80.setLastInstructionExecutionTime(1); boolean wasCEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); z80.enableFlagN(); if (wasCEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } } Dec8BitRegister(GBZ80 z80, Register sourceRegister); @Override void execute();  }