/// <summary> /// Helper function for setting the bits of the ppu control register. /// </summary> /// <param name="flag">The flag to set</param> /// <param name="v">The value of the bit [0,1]</param> private void SetControlFlag(FLAGS2C02_Control flag, bool v) { if (v) { _ppuControlReg |= (byte)flag; } else { _ppuControlReg &= (byte)~flag; } }
/// <summary> /// Helper function to get the state of a specific bit of the control register. /// </summary> /// <param name="flag">The bit flag to return</param> /// <returns>1 or 0</returns> public bool GetControlFlag(FLAGS2C02_Control flag) { return((byte)(_ppuControlReg & (byte)flag) > 0 ? true : false); }