@Test public void shouldUseThreeCyclesAsLastInstructionExecutionTime() { Instruction instruction = new IncHLAddress(z80, mmu); instruction.execute(); assertEquals(3, z80.getLastInstructionExecutionTime()); }
@Override public void execute() { int address = z80.get16BitRegisterValue(Register.HL); byte memoryValue = mmu.readByte(address); byte result = (byte) (memoryValue + 1); mmu.writeByte(address, result); z80.setLastInstructionExecutionTime(3); boolean wasCyEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); if (wasCyEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } }
IncHLAddress extends Instruction { @Override public void execute() { int address = z80.get16BitRegisterValue(Register.HL); byte memoryValue = mmu.readByte(address); byte result = (byte) (memoryValue + 1); mmu.writeByte(address, result); z80.setLastInstructionExecutionTime(3); boolean wasCyEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); if (wasCyEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } } }
IncHLAddress extends Instruction { @Override public void execute() { int address = z80.get16BitRegisterValue(Register.HL); byte memoryValue = mmu.readByte(address); byte result = (byte) (memoryValue + 1); mmu.writeByte(address, result); z80.setLastInstructionExecutionTime(3); boolean wasCyEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); if (wasCyEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } } IncHLAddress(GBZ80 z80, MMU mmu); }
IncHLAddress extends Instruction { @Override public void execute() { int address = z80.get16BitRegisterValue(Register.HL); byte memoryValue = mmu.readByte(address); byte result = (byte) (memoryValue + 1); mmu.writeByte(address, result); z80.setLastInstructionExecutionTime(3); boolean wasCyEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); if (wasCyEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } } IncHLAddress(GBZ80 z80, MMU mmu); @Override void execute(); }
IncHLAddress extends Instruction { @Override public void execute() { int address = z80.get16BitRegisterValue(Register.HL); byte memoryValue = mmu.readByte(address); byte result = (byte) (memoryValue + 1); mmu.writeByte(address, result); z80.setLastInstructionExecutionTime(3); boolean wasCyEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); if (wasCyEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } } IncHLAddress(GBZ80 z80, MMU mmu); @Override void execute();  }