home *** CD-ROM | disk | FTP | other *** search
/ Chip 2009 November / Chip_2009.11_CD.iso / BootCD / mix.uha / SCRIPTS / IDESCAN next >
Encoding:
Text File  |  2008-02-16  |  1.8 KB  |  58 lines

  1. //
  2. // This is a good example of a scan script:
  3. //
  4.  
  5. disabledebug;                          // Switch extended logging off
  6.  
  7. print "^01\15Surface Scan (LBA28, 128GB Limit)"
  8.  
  9. xprint "Enter start LBA: "
  10. %StartLba = userinput                  // Get some values from keyboard
  11.  
  12. xprint "Enter end LBA: "
  13. %EndLba = userinput                    // Get some values from keyboard
  14.  
  15. print ""
  16. print "Start: %StartLba, End: %EndLba."
  17.  
  18. %CurrentLba = %StartLba                // Setting %CurrentLBA to start position
  19. print "Scanning..."
  20.  
  21. @scanloop:                             // Label
  22.  
  23.    if %currentlba > %endlba @endscan   // If we reached the end LBA then
  24.                                        // stop the test.
  25.    %temp = %endlba - %currentlba
  26.    %temp = %temp + 1
  27.    if %temp < 256 @putcmd
  28.    %temp = 0                           // 0 means 256
  29.    @putcmd:
  30.    regs_putlba28 = %currentlba         // Put current LBA number into registers
  31.    r2 = %temp                          // Sector Count. 0 means 256
  32.    r7 = $40                            // Put 0x040 (cmd 40H, verify sectors) into Command register
  33.  
  34.    waitnbsy                            // Wait for ready
  35.    checkesc                            // Check if <ESC> pressed
  36.    %error = iserror                    // Check for error
  37.    if %error = 0 @noerror
  38.       %error = regs_getlba28           // Get error LBA from registers
  39.       print "\12Error: LBA %error"
  40.       %currentlba = %error + 1         // Restart scan from the next sector after error
  41.       goto @scanloop
  42.    @noerror:
  43.  
  44.    xprint "\07LBA: \15%currentlba"     // Print without CR
  45.  
  46.    if %temp > 0 @increment
  47.    %temp = 256
  48.    @increment:
  49.    %currentlba = %currentlba + %temp   // Increment CurrentLBA
  50.  
  51.    goto @scanloop
  52.  
  53. @endscan:
  54.  
  55. print ""
  56. %currentlba = %currentlba - 1
  57. print "Last scanned LBA: %currentlba"
  58.