/// <summary>
        /// Sets the bit.
        /// </summary>
        /// <param name="bit">The bit.</param>
        protected void SetBit(byte bit)
        {
            switch (bits)
            {
            case 8: ioPort.Write8(SetBit(ioPort.Read8(), bit)); break;

            case 16: ioPort.Write16(SetBit(ioPort.Read16(), bit)); break;

            case 32: ioPort.Write32(SetBit(ioPort.Read32(), bit)); break;
            }
        }
        /// <summary>
        /// Performs the LBA28.
        /// </summary>
        /// <param name="operation">The operation.</param>
        /// <param name="drive">The drive NBR.</param>
        /// <param name="lba">The lba.</param>
        /// <param name="data">The data.</param>
        /// <param name="offset">The offset.</param>
        /// <returns></returns>
        protected bool PerformLBA28(SectorOperation operation, uint drive, uint lba, byte[] data, uint offset)
        {
            if (drive > MaximunDriveCount)
            {
                return(false);
            }

            FeaturePort.Write8(0);
            SectorCountPort.Write8(1);

            LBALowPort.Write8((byte)(lba & 0xFF));
            LBAMidPort.Write8((byte)((lba >> 8) & 0xFF));
            LBAHighPort.Write8((byte)((lba >> 16) & 0xFF));

            DeviceHeadPort.Write8((byte)(0xE0 | (drive << 4) | ((lba >> 24) & 0x0F)));

            if (operation == SectorOperation.Write)
            {
                CommandPort.Write8(IDECommands.WriteSectorsWithRetry);
            }
            else
            {
                CommandPort.Write8(IDECommands.ReadSectorsWithRetry);
            }

            if (!WaitForReqisterReady())
            {
                return(false);
            }

            BinaryFormat sector = new BinaryFormat(data);

            //TODO: Don't use PIO
            if (operation == SectorOperation.Read)
            {
                for (uint index = 0; index < 256; index++)
                {
                    sector.SetUShort(offset + (index * 2), DataPort.Read16());
                }
            }
            else
            {
                for (uint index = 0; index < 256; index++)
                {
                    DataPort.Write16(sector.GetUShort(offset + (index * 2)));
                }
            }

            return(true);
        }
 /// <summary>
 /// Writes to configuration space
 /// </summary>
 /// <param name="bus">The bus.</param>
 /// <param name="slot">The slot.</param>
 /// <param name="function">The function.</param>
 /// <param name="register">The register.</param>
 /// <param name="value">The value.</param>
 public void WriteConfig16(byte bus, byte slot, byte function, byte register, ushort value)
 {
     configAddress.Write32(GetIndex(bus, slot, function, register));
     configData.Write16(value);
 }