@Test public void shouldPopTheContentOfTheMemoryPointedByTheStackPointerIntoTheDestinyRegister() { z80.setStackPointer(ANY_STACK_POINTER_VALUE); when(mmu.readByte(ANY_STACK_POINTER_VALUE)).thenReturn((byte) 0xF1); when(mmu.readByte(ANY_STACK_POINTER_VALUE + 1)).thenReturn((byte) 0xF2); Instruction instruction = new Pop16BitRegister(z80, mmu, ANY_16BIT_DESTINY_REGISTER); instruction.execute(); assertEquals(0xF2F1, z80.get16BitRegisterValue(ANY_16BIT_DESTINY_REGISTER)); }
@Override public void execute() { if (destinyRegister == Register.AF) { int registerValue = popTwice(); z80.set16BitRegisterValue(destinyRegister, registerValue & 0xFF00); } else { int registerValue = popTwice(); z80.set16BitRegisterValue(destinyRegister, registerValue); } z80.setLastInstructionExecutionTime(3); }
Pop16BitRegister extends Instruction { @Override public void execute() { if (destinyRegister == Register.AF) { int registerValue = popTwice(); z80.set16BitRegisterValue(destinyRegister, registerValue & 0xFF00); } else { int registerValue = popTwice(); z80.set16BitRegisterValue(destinyRegister, registerValue); } z80.setLastInstructionExecutionTime(3); } }
Pop16BitRegister extends Instruction { @Override public void execute() { if (destinyRegister == Register.AF) { int registerValue = popTwice(); z80.set16BitRegisterValue(destinyRegister, registerValue & 0xFF00); } else { int registerValue = popTwice(); z80.set16BitRegisterValue(destinyRegister, registerValue); } z80.setLastInstructionExecutionTime(3); } Pop16BitRegister(GBZ80 z80, MMU mmu, Register destinyRegister); }
Pop16BitRegister extends Instruction { @Override public void execute() { if (destinyRegister == Register.AF) { int registerValue = popTwice(); z80.set16BitRegisterValue(destinyRegister, registerValue & 0xFF00); } else { int registerValue = popTwice(); z80.set16BitRegisterValue(destinyRegister, registerValue); } z80.setLastInstructionExecutionTime(3); } Pop16BitRegister(GBZ80 z80, MMU mmu, Register destinyRegister); @Override void execute(); }
Pop16BitRegister extends Instruction { @Override public void execute() { if (destinyRegister == Register.AF) { int registerValue = popTwice(); z80.set16BitRegisterValue(destinyRegister, registerValue & 0xFF00); } else { int registerValue = popTwice(); z80.set16BitRegisterValue(destinyRegister, registerValue); } z80.setLastInstructionExecutionTime(3); } Pop16BitRegister(GBZ80 z80, MMU mmu, Register destinyRegister); @Override void execute();  }