/// <summary> /// ExA1 - SKNP Vx /// Skip next instruction if key with the value of Vx is not pressed. /// Checks the keyboard, and if the key corresponding to the value of Vx is currently in the up position, /// PC is increased by 2. /// </summary> /// <param name="machineState"> /// The machine State. /// </param> public void SkipNextInstructionIfRegisterNotEqualsKeyPressed(IMachineState machineState) { if (!machineState.Keys[machineState.VRegisters[machineState.XRegisterFromCurrentOpcode]]) { machineState.IncreaseProgramCounter(); } }
/// <summary> /// 9xy0 - SNE Vx, Vy /// Skip next instruction if Vx != Vy. /// The values of Vx and Vy are compared, and if they are not equal, the program counter is increased by 2. /// </summary> /// <param name="machineState"> /// The machine State. /// </param> public void SkipNextInstructionIfRegisterNotEqualsRegister(IMachineState machineState) { if (machineState.VRegisters[machineState.XRegisterFromCurrentOpcode] != machineState.VRegisters[machineState.YRegisterFromCurrentOpcode]) { machineState.IncreaseProgramCounter(); } }
/// <summary> /// 4xkk - SNE Vx, byte /// Skip next instruction if Vx != kk. /// The interpreter compares register Vx to kk, and if they are not equal, increments the program counter by 2. /// </summary> /// <param name="machineState"> /// The machine State. /// </param> public void SkipNextInstructionIfRegisterNotEqualsImmediate(IMachineState machineState) { if (machineState.VRegisters[machineState.XRegisterFromCurrentOpcode] != (machineState.CurrentOpcode & 0x00FF)) { machineState.IncreaseProgramCounter(); } }