home *** CD-ROM | disk | FTP | other *** search
- ;
- ; MHDD TERMINAL: Sample scripting batch and documentation
- ; Please also look at "STEST" for SCSI commands
- ; and "IDESCAN" for an advanced example
- ;
- ; ---------------------------------------------------------------------
- ; You can use symbols ";", "#", "//" to comment out anything
- ; ---------------------------------------------------------------------
- ;
- ;
- ; Variables:
- ; -----------------------------------------------------------------
- ; You can use variables without declaration. Variable name should
- ; start with "%" and contain only symbols. Names are not case sensitive.
- ;
- ; An example of using variables:
- ;
- ; %a = 4
- ; %myvariable = %a + 10
- ; print "Result = %myvariable"
- ;
- ; You can also assign any string to a variable.
- ; Please do not use quotes when assigning a string.
- ;
- ; %cmdread = 00 100 00 00 00 $e0 $20
- ; regs = %cmdread
- ;
- ;
- ; Labels/loops/if example:
- ; -------------------------------------------------------------------
- ; %a = 0
- ; @loop:
- ; %a = %a + 1
- ; print "A = %a"
- ; if %a = 10 @end
- ; goto @loop
- ; @end:
- ; print "\15Finished."
- ;
- ;
- ; All commands except SCSI (for SCSI commands please look into file STEST)
- ; -------------------------------------------------------------------
- ;
- ; Rx = yy put yy into register x
- ;
- ; REGS = yy1 yy2 yy3 yy4 yy5 yy6 yy7 // for LBA28 mode
- ; REGS48 = yy1 yy2 yy3 yy4 yy5 yy6 yy7 // for LBA48 mode
- ; put everything to registers
- ; hex values format: $xx, i.e. $FF
- ; To use LBA48 mode, use REGS48 instead of REGS
- ;
- ; REGS_PUTLBA28 put LBA to registers R3..R6, also clears R2
- ; please do not forget to set R2 after calling this
- ; procedure
- ;
- ; WAITNBSY wait-for-not-busy, i.e., wait for drive ready
- ;
- ; CHECKDRQ check for DRQ, exit if no DRQ
- ;
- ; CHECKERR check for ERROR, exit if ERROR
- ;
- ; CHECKESC check ESC pressed
- ;
- ; RESET reset the drive (need WAITNBSY after)
- ;
- ; SECTORSTO = xx
- ; read sectors from drive's data register
- ; to file xx (xx = filename)
- ; SECTORSFROM = xx
- ; write sectors to drive's data register
- ; from file xx (xx = filename)
- ;
- ; PRINT = "text"
- ; prints some text (text should be in quotes)
- ; see examples below on how to use colors
- ;
- ; XPRINT = "text"
- ; prints some text (text should be in quotes)
- ; printing always starts from the start of current
- ; line
- ;
- ; DISABLEDEBUG disables line-by-line output to the screen
- ; (useful if you use PRINT to put messages)
- ;
- ; TERMINATE terminate script (useful to for debugging)
- ; program will stop at this point
- ;
- ; GOTO @label goes to label
- ;
- ; IF <expr> @label
- ; if <expression> is true then goto @label
- ; example: if %myvariable = 3 @end
- ;
- ; Functions
- ; -------------------------------------------------------------------
- ;
- ; USERINPUT takes a string from keyboard
- ;
- ; ISERROR checks if error happened or no
- ;
- ; REGS_GETLBA28 gets LBA from registers R3..R6
- ; used to get error LBA number after an error
- ;
- ; Functions can be used only like this:
- ; %myvariable = USERINPUT ; this will put user input
- ; ; into the variable
- ;
- ; %myvariable = ISERROR ; this will return "1" in case of
- ; ; error or "0" if no error
- ; ------------------------------------------------------------------
- ;
- ; Following example will do:
- ; 1. device reset
- ; 2. identify device
- ; 3. read 100 sectors starting from lba 0
- ;
- ; To see more complicated example please look into "IDETEST" script
- ; ------------------------------------------------------------------
-
- disabledebug ; comment this out to see every string execution
- print = "^01 \14■\15 Simple test script"
- ; *******************************************************
- ; * Reset *
- ; *******************************************************
-
- print " \02■\07 Reset..."
- reset
- waitnbsy
- ; terminate ; uncomment this to stop at this point
-
- ; *******************************************************
- ; * Device identify *
- ; *******************************************************
-
- print " \02■\07 Getting identify information"
- r7 = $EC
- waitnbsy
- checkerr
- checkdrq
- sectorsto = identify.bin
- print " \15√\07 identify.bin has been written"
-
- ; *******************************************************
- ; * Read 100 sectors starting from LBA 0 *
- ; *******************************************************
-
- print " \02■\07 Reading 100 sectors starting from LBA 0"
- regs = 00 100 00 00 00 $e0 $20
- waitnbsy
- checkerr
- checkdrq
- sectorsto = lba0-99.bin
- print " \15√\07 lba0-99.bin has been written"
- print "^01 \14■\15 Everything is done."
-
- ; *******************************************************
- ; * End of script *
- ; *******************************************************
-