Guest User

Untitled

a guest
Feb 17th, 2012
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. bool ReadSector(unsigned char cylinder, unsigned char head, unsigned char sector)
  2. {
  3.     //Seek(cylinder, head);
  4.     ReadTransfer();
  5.    
  6.     MotorOn();
  7.    
  8.     for (int i = 0; i<5; i++)
  9.     {
  10.         SendData(CMD_READ);
  11.         SendData(0 | (head<<2));
  12.         SendData(cylinder);
  13.         SendData(head);
  14.         SendData(sector);
  15.        
  16.         SendData(2);
  17.         SendData(18);
  18.         SendData(27);
  19.         SendData(0xFF);
  20.        
  21.         WaitIRQ();
  22.        
  23.         ReadData();  //st0
  24.         ReadData();  //st1
  25.         ReadData();  //st2
  26.         ReadData();  //cylinder
  27.         ReadData();  //head
  28.         ReadData();  //sector
  29.         ReadData();  //Sektorgröße
  30.        
  31.         if(inb(MSR) & 0xC0)
  32.         {
  33.           MotorOff();
  34.           return true;
  35.         }
  36.     }
  37.    
  38.     MotorOff();
  39.     return false;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment