Sample of DM Script Writing — HDD
Please copy the content below and paste it in DriveMaster’s Script Window to run this sample script.
//"Cls" is used to clear the content in the log window.
CLS //There is a set of print commands for user to display the information in the log window. //PRNS[R], PRNL[R], PRNSL[R], PRNSX[R], PRNF PRNS "==================================================" //"Script" displays the name of current script; "VER" displays the version number //of current DriveMaster; "DEVNAME" displays the information of current tested //device including model number, serial number and firmware revision; "DATE"/"TIME" //displays current date and time SCRIPT; VER; DEVNAME; DATE; TIME PRNS "==================================================" PRNS "*** CLEAR DISK ***" PRNS "* BY DMA CMD *" //"Echo On" or "Echo Off" is used to control the display of command issued to be //echoed to the Log window. Default is "Echo On" ECHO OFF //"Log1"/"Log2"/"LogOff" is used to control how detail information will be displayed //on the Log Window when command failed. Default is "Log2" LOG2 //"HaltErr On" or "HaltErr Off" is used to control if script will be halted //when command fails. Default is "HaltErr Off"
HALTERR ON //"UPD ON" or "UPD OFF" is used to control how frequent the screen display will be //refreshed. When "Upd On", the screen will be refreshed by every second; When "Upd Off",
//the screen will be refreshed by each script line. Default is "UPD off" //UPD ON PRNS "SOFT RESET" //Issue "ATA Soft Reset" command
REST //"Wait" will let script wait for number of milliseconds before continuing //to execute //next script line.
WAIT 2000 //Issue "Set Feature" command to set PIO mode 4
SETF 3,0ch,0 //set PIO MODE 4 //Issue ATA "Identify" command
IDFY SETF 3,45h,0 //set UDMA MODE 5 (UDMA100) //Get the Total Lba address of the current tested HDD and save the value to variable "V0" //V0-V99, G0-G99, I-I10, J-J10, K-K10 are DWORD Global variables for general purpose. //Also user can define the meaningful variables/arrays by "DIM" V0 = totallba PRNSL "total lba=",V0 G8=256 //G8 is set for sector count per write/read //Math/logical/conditional/assignment operators work same as C language V0 = V0/1000 //shorten the size for sample purpose //Issue "Read DMA" command with LBA 0, Length 256 //Besides ATA/ATAPI standard commands, user also can send Vendor specified ATA,ATAPI //commands by using "WTF28", "WTF48", "PACKET"
RDMA 0,256 //Issue Read DMA command //There is a set of buffer filling commands to let user fill buffer with different //patterns: PAT, PATI, PATZ, PATD, PATR, PATV, and PATF PATZ "WRITE" //fill write buffer with 0 WDMA 0,256 //write from WRITE buffer RDMA 0,256 //read to READ buffer //Also there is a set of buffer management commands to let user control buffer easily. //RPOINT, WPOINT, RR[W], RW[W], WRB[W], WWB[W], R[B]FILE, W[B]FILE, SAVB(O) //NEW, SETSIZE, FREE, COPY, CMPSET, CMP, APPEND, SWAP, MOD
CMP //compare READ and WRITE buffer PRNSR "Write Start "; time PRNS "" G8=256 //sector count per write/read //"For...EndFor" let user control scripts in loop. Similar commands include //"Do...Until", "While...EndWhile"
FOR (G9=0; G9<(V0-1); G9+=G8 ) //"PRNF" will let user print information into a formatted text. PRNF "\r UDMA WRITE LBA %09ld ", G9 //"If...ElseIf...Else...EndIf" will let user control conditional execution IF ( (G9+G8)>=V0 ) G8=V0-G9; ENDIF //CHECK OUT OF BOUND WDMA G9,G8 ENDFOR PRNS "" PRNSR "Write End"; time G8=256 //sector count per write/read PRNSR "Read Start"; time PRNS"" FOR (G9=0; G9<(V0-1); G9+=G8 ) PRNF "\r UDMA READ LBA %09ld", G9 IF ( (G9+G8)>=V0 ) G8=V0-G9; ENDIF //CHECK OUT OF BOUND RDMA G9,G8 G7=G8*512; //bytes //"CmpSet" works with "Cmp" together to control the location/size of buffer comparison //instead of comparing the whole buffers by default.
CMPSET 1,0,G7 //type, offset, size CMP ENDFOR PRNS "" PRNSR "Read End "; time //Restore to the defaults Logging control parameters
ECHO ON Log2 HaltErr Off Upd OFF Prns "End of Test" End //User also can use "Sub"/"Call" functions to generate more complex scripts as needed.