@Test public void shouldUse3CyclesAsLastInstructionExecutionTime() { Instruction instruction = new Load8BitImmPCPlusSPIntoHL(z80, mmu); instruction.execute(); assertEquals(3, z80.getLastInstructionExecutionTime()); }
@Override public void execute() { int programCounter = z80.getProgramCounter(); byte memoryValue = mmu.readByte(programCounter); z80.incrementProgramCounter(); int stackPointer = z80.getStackPointer(); int registerValue = (stackPointer + memoryValue) & 0xFFFF; z80.set16BitRegisterValue(Register.HL, registerValue); int check = stackPointer ^ (memoryValue) ^ ((stackPointer + memoryValue) & 0xFFFF); z80.resetFlagF(); if ((check & 0x100) == 0x100) { z80.enableFlagCY(); } if ((check & 0x10) == 0x10) { z80.enableFlagH(); } z80.setLastInstructionExecutionTime(3); }
Load8BitImmPCPlusSPIntoHL extends Instruction { @Override public void execute() { int programCounter = z80.getProgramCounter(); byte memoryValue = mmu.readByte(programCounter); z80.incrementProgramCounter(); int stackPointer = z80.getStackPointer(); int registerValue = (stackPointer + memoryValue) & 0xFFFF; z80.set16BitRegisterValue(Register.HL, registerValue); int check = stackPointer ^ (memoryValue) ^ ((stackPointer + memoryValue) & 0xFFFF); z80.resetFlagF(); if ((check & 0x100) == 0x100) { z80.enableFlagCY(); } if ((check & 0x10) == 0x10) { z80.enableFlagH(); } z80.setLastInstructionExecutionTime(3); } }
Load8BitImmPCPlusSPIntoHL extends Instruction { @Override public void execute() { int programCounter = z80.getProgramCounter(); byte memoryValue = mmu.readByte(programCounter); z80.incrementProgramCounter(); int stackPointer = z80.getStackPointer(); int registerValue = (stackPointer + memoryValue) & 0xFFFF; z80.set16BitRegisterValue(Register.HL, registerValue); int check = stackPointer ^ (memoryValue) ^ ((stackPointer + memoryValue) & 0xFFFF); z80.resetFlagF(); if ((check & 0x100) == 0x100) { z80.enableFlagCY(); } if ((check & 0x10) == 0x10) { z80.enableFlagH(); } z80.setLastInstructionExecutionTime(3); } Load8BitImmPCPlusSPIntoHL(GBZ80 z80, MMU mmu); }
Load8BitImmPCPlusSPIntoHL extends Instruction { @Override public void execute() { int programCounter = z80.getProgramCounter(); byte memoryValue = mmu.readByte(programCounter); z80.incrementProgramCounter(); int stackPointer = z80.getStackPointer(); int registerValue = (stackPointer + memoryValue) & 0xFFFF; z80.set16BitRegisterValue(Register.HL, registerValue); int check = stackPointer ^ (memoryValue) ^ ((stackPointer + memoryValue) & 0xFFFF); z80.resetFlagF(); if ((check & 0x100) == 0x100) { z80.enableFlagCY(); } if ((check & 0x10) == 0x10) { z80.enableFlagH(); } z80.setLastInstructionExecutionTime(3); } Load8BitImmPCPlusSPIntoHL(GBZ80 z80, MMU mmu); @Override void execute(); }
Load8BitImmPCPlusSPIntoHL extends Instruction { @Override public void execute() { int programCounter = z80.getProgramCounter(); byte memoryValue = mmu.readByte(programCounter); z80.incrementProgramCounter(); int stackPointer = z80.getStackPointer(); int registerValue = (stackPointer + memoryValue) & 0xFFFF; z80.set16BitRegisterValue(Register.HL, registerValue); int check = stackPointer ^ (memoryValue) ^ ((stackPointer + memoryValue) & 0xFFFF); z80.resetFlagF(); if ((check & 0x100) == 0x100) { z80.enableFlagCY(); } if ((check & 0x10) == 0x10) { z80.enableFlagH(); } z80.setLastInstructionExecutionTime(3); } Load8BitImmPCPlusSPIntoHL(GBZ80 z80, MMU mmu); @Override void execute();  }