@Test public void shouldUseThreeCyclesAsLastInstructionExecutionTime() { Instruction instruction = new DecHLAddress(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 wasCEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); z80.enableFlagN(); if (wasCEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } }
DecHLAddress 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 wasCEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); z80.enableFlagN(); if (wasCEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } } }
DecHLAddress 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 wasCEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); z80.enableFlagN(); if (wasCEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } } DecHLAddress(GBZ80 z80, MMU mmu); }
DecHLAddress 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 wasCEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); z80.enableFlagN(); if (wasCEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } } DecHLAddress(GBZ80 z80, MMU mmu); @Override void execute(); }
DecHLAddress 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 wasCEnabled = z80.isFlagCYEnabled(); z80.resetFlagF(); z80.enableFlagN(); if (wasCEnabled) { z80.enableFlagCY(); } if (result == 0) { z80.enableFlagZ(); } if ((result & 0xF) == 0xF) { z80.enableFlagH(); } } DecHLAddress(GBZ80 z80, MMU mmu); @Override void execute();  }