public static void Initialize() { for (byte xControllerBaseAIdx = 0; xControllerBaseAIdx < GetControllerAddressCount(); xControllerBaseAIdx++) { var xOldValue = IOReadByte((ushort)(GetControllerAddress1(xControllerBaseAIdx) + ATA_STATUS)); IOWriteByte((ushort)(GetControllerAddress1(xControllerBaseAIdx) + ATA_STATUS), (byte)(xOldValue | 0x4)); IOWriteByte((ushort)(GetControllerAddress1(xControllerBaseAIdx) + ATA_STATUS), xOldValue); for (byte xDrive = 0; xDrive < 2; xDrive++) { IOWriteByte((ushort)(GetControllerAddress1(xControllerBaseAIdx) + ATA_DRIVEHEAD), (byte)((xControllerBaseAIdx << 4) | 0xA0 | (xDrive << 4))); Console.Write(" Drive " + xDrive); // we should wait 400ns IOReadByte((ushort)(GetControllerAddress1(xControllerBaseAIdx) + ATA_STATUS)); IOReadByte((ushort)(GetControllerAddress1(xControllerBaseAIdx) + ATA_STATUS)); IOReadByte((ushort)(GetControllerAddress1(xControllerBaseAIdx) + ATA_STATUS)); IOReadByte((ushort)(GetControllerAddress1(xControllerBaseAIdx) + ATA_STATUS)); // end wait 400ns if (IOReadByte((ushort)(GetControllerAddress1(xControllerBaseAIdx) + ATA_STATUS)) == 0x50) { ATA xATA = xATA = new ATA(String.Concat(mControllerNumbers[xControllerBaseAIdx], " ", mDriveNames[xDrive]), xControllerBaseAIdx, xDrive); Device.Add(xATA); } } } }