@Test public void shouldIncrementTheValueOfTheSourceRegister() { z80.set8BitRegisterValue(ANY_8BIT_SOURCE_REGISTER, ANY_8BIT_REGISTER_VALUE); Instruction instruction = new Inc8BitRegister(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 wasCyEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); if (wasCyEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } }
Inc8BitRegister extends Instruction { @Override public void execute() { byte registerValue = z80.get8BitRegisterValue(sourceRegister); byte result = (byte) (registerValue + 1); z80.set8BitRegisterValue(sourceRegister, result); z80.setLastInstructionExecutionTime(1); boolean wasCyEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); if (wasCyEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } } }
Inc8BitRegister extends Instruction { @Override public void execute() { byte registerValue = z80.get8BitRegisterValue(sourceRegister); byte result = (byte) (registerValue + 1); z80.set8BitRegisterValue(sourceRegister, result); z80.setLastInstructionExecutionTime(1); boolean wasCyEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); if (wasCyEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } } Inc8BitRegister(GBZ80 z80, Register sourceRegister); }
Inc8BitRegister extends Instruction { @Override public void execute() { byte registerValue = z80.get8BitRegisterValue(sourceRegister); byte result = (byte) (registerValue + 1); z80.set8BitRegisterValue(sourceRegister, result); z80.setLastInstructionExecutionTime(1); boolean wasCyEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); if (wasCyEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } } Inc8BitRegister(GBZ80 z80, Register sourceRegister); @Override void execute(); }
Inc8BitRegister extends Instruction { @Override public void execute() { byte registerValue = z80.get8BitRegisterValue(sourceRegister); byte result = (byte) (registerValue + 1); z80.set8BitRegisterValue(sourceRegister, result); z80.setLastInstructionExecutionTime(1); boolean wasCyEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); if (wasCyEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } } Inc8BitRegister(GBZ80 z80, Register sourceRegister); @Override void execute();  }