home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 March / Chip_2011.03_CD.iso / BootCD / mix.uha / SCRIPTS / TEST < prev   
Encoding:
Text File  |  2008-02-16  |  5.4 KB  |  159 lines

  1. ;
  2. ; MHDD TERMINAL: Sample scripting batch and documentation
  3. ; Please also look at "STEST" for SCSI commands
  4. ; and "IDESCAN" for an advanced example
  5. ;
  6. ; ---------------------------------------------------------------------
  7. ; You can use symbols ";", "#", "//" to comment out anything
  8. ; ---------------------------------------------------------------------
  9. ;
  10. ;
  11. ;     Variables:
  12. ;     -----------------------------------------------------------------
  13. ; You can use variables without declaration. Variable name should
  14. ; start with "%" and contain only symbols. Names are not case sensitive.
  15. ;
  16. ;    An example of using variables:
  17. ;
  18. ; %a = 4
  19. ; %myvariable = %a + 10
  20. ; print "Result = %myvariable"
  21. ;
  22. ; You can also assign any string to a variable.
  23. ; Please do not use quotes when assigning a string.
  24. ;
  25. ; %cmdread = 00 100 00 00 00 $e0 $20
  26. ; regs = %cmdread
  27. ;
  28. ;
  29. ;     Labels/loops/if example:
  30. ;     -------------------------------------------------------------------
  31. ; %a = 0
  32. ; @loop:
  33. ; %a = %a + 1
  34. ; print "A = %a"
  35. ; if %a = 10 @end
  36. ; goto @loop
  37. ; @end:
  38. ; print "\15Finished."
  39. ;
  40. ;
  41. ;     All commands except SCSI (for SCSI commands please look into file STEST)
  42. ;     -------------------------------------------------------------------
  43. ;
  44. ;     Rx = yy        put yy into register x
  45. ;
  46. ;     REGS = yy1 yy2 yy3 yy4 yy5 yy6 yy7          // for LBA28 mode
  47. ;     REGS48 = yy1 yy2 yy3 yy4 yy5 yy6 yy7        // for LBA48 mode
  48. ;                    put everything to registers
  49. ;                    hex values format: $xx, i.e. $FF
  50. ;                    To use LBA48 mode, use REGS48 instead of REGS
  51. ;
  52. ;     REGS_PUTLBA28  put LBA to registers R3..R6, also clears R2
  53. ;                    please do not forget to set R2 after calling this
  54. ;                    procedure
  55. ;
  56. ;     WAITNBSY       wait-for-not-busy, i.e., wait for drive ready
  57. ;
  58. ;     CHECKDRQ       check for DRQ, exit if no DRQ
  59. ;
  60. ;     CHECKERR       check for ERROR, exit if ERROR
  61. ;
  62. ;     CHECKESC       check ESC pressed
  63. ;
  64. ;     RESET          reset the drive (need WAITNBSY after)
  65. ;
  66. ;     SECTORSTO = xx
  67. ;                    read sectors from drive's data register
  68. ;                    to file xx (xx = filename)
  69. ;     SECTORSFROM = xx
  70. ;                    write sectors to drive's data register
  71. ;                    from file xx (xx = filename)
  72. ;
  73. ;     PRINT = "text"
  74. ;                    prints some text (text should be in quotes)
  75. ;                    see examples below on how to use colors
  76. ;
  77. ;     XPRINT = "text"
  78. ;                    prints some text (text should be in quotes)
  79. ;                    printing always starts from the start of current
  80. ;                    line
  81. ;
  82. ;     DISABLEDEBUG   disables line-by-line output to the screen
  83. ;                    (useful if you use PRINT to put messages)
  84. ;
  85. ;     TERMINATE      terminate script (useful to for debugging)
  86. ;                    program will stop at this point
  87. ;
  88. ;     GOTO @label    goes to label
  89. ;
  90. ;     IF <expr> @label
  91. ;                    if <expression> is true then goto @label
  92. ;                    example: if %myvariable = 3 @end
  93. ;
  94. ;     Functions
  95. ;     -------------------------------------------------------------------
  96. ;
  97. ;     USERINPUT      takes a string from keyboard
  98. ;
  99. ;     ISERROR        checks if error happened or no
  100. ;
  101. ;     REGS_GETLBA28  gets LBA from registers R3..R6
  102. ;                    used to get error LBA number after an error
  103. ;
  104. ;     Functions can be used only like this:
  105. ;         %myvariable = USERINPUT    ; this will put user input
  106. ;                                    ; into the variable
  107. ;
  108. ;         %myvariable = ISERROR      ; this will return "1" in case of
  109. ;                                    ; error or "0" if no error
  110. ;     ------------------------------------------------------------------
  111. ;
  112. ;     Following example will do:
  113. ;        1. device reset
  114. ;        2. identify device
  115. ;        3. read 100 sectors starting from lba 0
  116. ;
  117. ;     To see more complicated example please look into "IDETEST" script
  118. ;     ------------------------------------------------------------------
  119.  
  120. disabledebug      ; comment this out to see every string execution
  121. print = "^01 \14■\15 Simple test script"
  122. ;  *******************************************************
  123. ;  *    Reset                                            *
  124. ;  *******************************************************
  125.  
  126. print " \02■\07 Reset..."
  127. reset
  128. waitnbsy
  129. ; terminate    ; uncomment this to stop at this point
  130.  
  131. ;  *******************************************************
  132. ;  *    Device identify                                  *
  133. ;  *******************************************************
  134.  
  135. print " \02■\07 Getting identify information"
  136. r7 = $EC
  137. waitnbsy
  138. checkerr
  139. checkdrq
  140. sectorsto = identify.bin
  141. print " \15√\07 identify.bin has been written"
  142.  
  143. ;  *******************************************************
  144. ;  *    Read 100 sectors starting from LBA 0             *
  145. ;  *******************************************************
  146.  
  147. print " \02■\07 Reading 100 sectors starting from LBA 0"
  148. regs = 00 100 00 00 00 $e0 $20
  149. waitnbsy
  150. checkerr
  151. checkdrq
  152. sectorsto = lba0-99.bin
  153. print " \15√\07 lba0-99.bin has been written"
  154. print "^01 \14■\15 Everything is done."
  155.  
  156. ;  *******************************************************
  157. ;  *    End of script                                    *
  158. ;  *******************************************************
  159.