Copyright 2010-2019 Hale Landis. All rights reserved.
Note: Also see files AHCDEMO.HTM and SCRIPTS.HTM.
AHCDEMO PORT=n [b:d:f] [general-options] POT=n - AHCI port number to use (0 to 31). b:d:f - b:d:f is the PCI bus, device and function for the AHCI controller. AV=n - size of array memory, 1=20Mbytes, 2=40Mbytes, 3=60Mbytes, 4=80Mbytes. GEN=n - Limit SATA speed to Generation n. LOG=fileName - Log file name. Nn=n - Set numeric variable OPT_Nn to a value. READOnly - Set read only mode. SCR=fileName - Script file to run. SLIST=fileName - Script list to run. Sn=string - Set string variable STR_Sn to a value.
Change screen size and colors
SET AHCDEMO=[size];[colors]
Change the screen size and the screen colors. See the AHCDEMO User Guide.
Setup I/O error trigger
SET ATAERROR=pppp:v1:v2:v3
Error trigger using port pppp (hex value from 0001H to FFFFH), and the data values v1, v2 and v3. See the AHCDEMO User Guide.
Setup Power Control Board
SET ATAPWRCTRL=pppp
Power Control Board uses Parallel Port I/O address pppp. See the AHCDEMO and Power Control Board User Guides. pppp is a hex value from 0001 to FFFF.
If the Command Type column is blank, the command is available in all versions of the program and can be entered from the keyboard or used in a script file. Values in the Command Type column indicate the following:
D - A device I/O command. F - Command is available only in the full/commercial version. R - Command can be used with the REPeat command. S - Command is valid only in a script file.
Command Command Type Syntax ------- --------------------------------------------------------- ? // go to SATA active state DF ACTIVE // auto commands after I/O error AFTERERror AFTERERror NONE AFTERERror OFf AFTERERror ON AFTERERror (n) AFTERERror [+]command [-]command ... command: SHOWPC, Dump, SHOWCH, SHOWLL, SHOWCB, Clear, RS and RESet. // auto commands after I/O with no error AFTERNOerror AFTERNOerror NONE AFTERNOerror OFf AFTERNOerror ON AFTERNOerror (n) AFTERNOerror [+]command [-]command ... command: SHOWPC, COMPx, Dump, SHOWCH, SHOWLL, SHOWCB, Clear, RS and RESet. // alter a byte in the I/O buffer ALTER sectorOffset byteOffset andMask orMask // ask for user input F ASK varName [text] F ASKSTR strVarName [text] F ASKYN varName [text] // override ATA Device register bits 7-4 for ATA commands ATARegs dh // override ATA registers for PACKET commands ATAPIRegs fr sc sn dh // array variables F AVCLEAR arrayName // clear array to zeroes except in I/O buffer F AVDELETE // delete all arrays F AVFETCH varName arrayName index // fetch an array value F AVNEW arrayName type size [BUFFER] // create a new array unsigned types: USBYTE, USWORD, USDWORD, USQWORD. signed types: BYTE, WORD, DWORD, QWORD. F AVSTORE arrayName index n // store an array value F // auto commands before an I/O command BEFORE BEFORE NONE BEFORE OFf BEFORE ON BEFORE (n) BEFORE [+]command [-]command ... command: SHOWPC, Dump, SHOWCH, SHOWLL, SHOWCB, Clear, RS, RESet and FILLx. // begin a subroutine FS BEGINSub subName [type] // start SATA BIST DF BIST fis dw1 dw2 // set sector/block size BLOCKSIZE [n] // break out of a while loop FS BReak // call a subroutine F CAll subName [ n1 n2 n3 n4 n5 n6 n7 n8 n9 ] F subName [ n1 n2 n3 n4 n5 n6 n7 n8 n9 ] // change SATA CFIS size or data CFIS CFIS SIZE n CFIS ICC n CFIS DW4 n // check bytes of buffer F CHKBUF sectorOffset byteOffset andMask op n ... // check ATA register value F CHKREG reg andMask op n regs: as, cm, dc, dh, er, fr, fr0, fr1, lba0, lba1, lba2, lba3, lba4, lba5, sn, cl, ch, sc, sc0, sc1, st. // compute 512-byte sector check sum CHKSUM // switch to CHS addressing CHS // convert LBA to CHS or CHS to LBA F CHSConv lba F CHSConv cyl head sect // setup CHS updating for REPeat'ed commadns F CHSIncr F CHSIncr chsIncr [numCyl numHead numSect] F CHSIncr Random [numCyl numHead numSect] F CHSIncr TL [numCyl numHead numSect] // clear trace buffers Clear // setup, measure and report command timing F CMDTime F CMDTime CONFIG F CMDTime OFf F CMDTime ON F CMDTime (n) // compare bytes in I/O buffer COMPare numBytes frSectorOffset frByteOffset toSectorOffset toByteOffset // perform data compare on I/O buffer data COMPIncr [n] COMPOne [n] COMPPat [n] COMPRand [n] COMPStart [n] COMPTag [n] COMPWord [n] COMPZero [n] // SATA COMRESET DR COMReset // return to top of WHILE loop FS COntinue // copy bytes in I/O buffer COPY numBytes frSectorOffset frByteOffset toSectorOffset toByteOffset // copy and re-order bytes in a variable F COPYBYtes n1 n2 n3 n4 frVarName toVarName // copy AHCI Received FIS data to I/O buffer COPYRFIS // ATA DMA read command DR DAR command feature sectorCount lba DR DAR command feature sectorCount cyl head sect // ATA DMA write command DFR DAW command feature sectorCount lba DFR DAW command feature sectorCount cyl head sect // execute DEVICE CONFIGURATION OVERLAY commands DR DCO DR DCO IDentify [NOSHOW] DR DCO REStore DR DCO SET // decrement value in a variable F DECR varName [n] // delay seconds, milliseconds or microseconds DELAY DELAY n DELAY MS n DELAY US n // change device type DEVice [n] // n=2 for ATA, n=3 for ATAPI DEVice ATA DEVice ATAPI // reset AHCI port DEVINIT // ATAPI Device Reset DR DEVRESet // DownLoad MicroCode command DF DLMCDMA feature blockCount bufferOffset DF DLMCPIO feature blockCount bufferOffset // switch between PIO and DMA commands DMA DMA OFf DMA ON DMA (n) // DOS COPy, DELete, DIR and RENanme F DOS COPy frFileSped toFileSpec F DOS DELete fileSpec F DOS DIR [fileSpec] F DOS REName fileSpec newFileSpec // PACKET read DMA DR DPR dmabc cdb0 cdb1 ... cdbn [etl] // PACKET write DMA DFR DPW dmabc cdb0 cdb1 ... cdbn [etl] // ATA DMA read DR DR feature sectorCount lba DR DR feature sectorCount cyl head sect // set driver time out in seconds DTO [n] // dump data in I/O buffer Dump Dump DEC Dump HEX Dump sectorOffset [ byteOffset [ numBytes ] ] // various data display commands F DUMPAV DUMPCt DUMPId F DUMPSub DUMPTag F DUMPVar [varName ...] // ATA DMA write DFR DW feature sectorCount lba DFR DW feature sectorCount cyl head sect // ATA DMA write FUA DWFUA feature sectorCount lba // script command echo on/off ECHO ECHO OFf ECHO ON ECHO (n) // edit file, keyboard buffer or script file F EDIT [fileName] F EDITKB [fileName] F EDITSF [fileName] // evaluate expression F EE n // IF ... ELSE ... ENDIF FS ELSE // IF ... ELSE ... ENDIF FS ENDIF // end of subroutine FS ENDSub [subName] // end of while loop FS ENDWHile // exit AHCDEMO (return to DOS) EXit [n] // expect next I/O command to get an error EXPEcterror // expect any error EXPEcterror ABRT // expect only an ABRT error EXPEcterror IDNF // expect only an IDNF error EXPEcterror UNC // expect only an UNC error // fetch data from the I/O buffer into a variable F FETCHBUF varName sectorOffset byteOffset size F FETCHBUF varName sectorOffset byteOffset size BE F FETCHBUF varName sectorOffset byteOffset size LE // fetch bytes of a PACKET (SCSI) CDB into a variable F FETCHCDB varName offset size // fill buffer with data pattern FILLIncr [sbv] FILLNUM n FILLOne FILLPat FILLPat n ... FILLPat + n ... FILLRand FILLStart FILLTag FILLWord [swv] FILLZero // clear NCQ/FPDMA command queue FPQCLEAR // execute commands in NCQ/FPDMA queue using repeat count FPQGO repeat lbaIncr [DC] FPQGO repeat Random [DC] FPQGO repeat TL [DC] FPQGO repeat -TL [DC] // execute commands in NCQ/FPDMA queue using run time in seconds FPQGOT runTime lbaIncr [DC] FPQGOT runTime Random [DC] FPQGOT runTime TL [DC] FPQGOT runTime -TL [DC] // add NCQ/FPDMA read or write command to NCQ/FPDMA queue D FPQR minSC maxSC minLBA maxLBA [ icc [ tag [FUA] [PRIO] ] DF FPQW minSC maxSC minLBA maxLBA [ icc [ tag [FUA] [PRIO] ] // execute a single NCQ/FPDMA read or write command DR FPR sectorCount lba [ icc [ tag [FUA] [PRIO] ] DFR FPW sectorCount lba [ icc [ tag [FUA] [PRIO] ] // change SATA speed (COMRESET/COMINIT required) GEN GEN n // GPL read or write commands DR GPL RLOG logAddr pageNum numPages [feature] DR GPL WLOG logAddr pageNum numPages [feature] // various help commands HELP // help for help commands HELP * // help summary for AHCDEMO commands HELP x // x is 'a' to 'z' HELPC // help for help commands HELPC * // help summary for ATA commads HELPC x // x is 'a' to 'z' HELPKb HELPKb ON HELPKb Off HELPKb (n) HELPP // help for help commands HELPP * // help summary for ATAPI commands HELPP x // x is '*' or 'a' to 'z' // execute an ATA or ATAPI IDENTIFY command DR ID [NOSHOW] [NOCHECK] [NOSET] // IF ... ELSE ... ENDIF FS IF n // increment value in a variable F INCR varName [n] // read from an x86 I/O port F INPORTByte ioAddr [varName] F INPORTWord ioAddr [varName] F INPORTDword ioAddr [varName] // execute ATAPI (SCSI) Inquiry command DR INQ // switch to LBA mode LBA LBA SET n LBA28 LBA28 SET n LBA32 LBA32 SET n LBA48 LBA48 SET n n // setup LBA updating for REPeat'ed commadns F LBAIncr F LBAIncr lbaIncr [numLba] F LBAIncr Random [numLba] F LBAIncr TL [numLba] // define local variable in a subroutine F LOCAL varName [=] n // log commands LOG LOG DELete LOG KML normal repeat LOG MAXimum LOG MINimum LOG NEW fileName LOG OFf LOG ON LOG SML normal repeat LOG SMLRestore n LOG (n) // execute an ATA Non-Data command DR ND command feature sectorCount lba DR ND command feature sectorCount cyl head sect // execute an ATA Non-Data command (CHS/LBA28 only) DF NDX fr sc sn cl ch dh cmd // same as Dump Next // auto on error options FS ONERRor FS ONERRor CAll subName [n] FS ONERRor COntinue FS ONERRor EXit FS ONERRor NExt FS ONERRor QUit // auto on ESC key options FS ONESCkey FS ONESCkey CAll subName [n] FS ONESCkey COntinue FS ONESCkey EXit FS ONESCkey NExt FS ONESCkey QUit // change value of a OPT_Nn variable F OPTNUMset OPT_Nn n // write to an x86 I/O port F OUTPORTByte ioAddr n F OUTPORTWord ioAddr n F OUTPORTDword ioAddr n // go to SATA Partial state DF PARTIAL // execute a PIO Data In command DR PDI command feature sectorCount lba [multiCount] DR PDI command feature sectorCount cyl head sect [multiCount] // execute a PIO Data In command (CHS/LBA28 only) DF PDIX fr sc sn cl ch dh cmd numSect [multiCnt] // execute a PIO Data Out command DFR PDO command feature sectorCount lba [multiCount] DFR PDO command feature sectorCount cyl head sect [multiCount] // execute a PIO Data Out command (CHS/LBA28 only) DF PDOX fr sc sn cl ch dh cmd numSect [multiCnt] // execute ATAPI (SCSI) Non-Data command DR PN bcl cdb0 cdb1 ... cdbn [etl] // pop ONERRor,ONESCkey, AFTERx, BEFORE, // COMPx, FILLx and TAG settings. FS POP // execute ATA power management commands DR POWER DR POWER CHeck DR POWER IDle DR POWER IDle n DR POWER SLeep DR POWER STandby DR POWER STandby n DR POWER UNload // execute ATAPI (SCSI) read command DR PR bcl cdb0 cdb1 ... cdbn [etl] // change ATAPI (SCSI) CDB size PS PS 12 PS 16 PS n // push ONERRor,ONESCkey, AFTERx, BEFORE, // COMPx, FILLx and TAG settings. FS PUSH // execute ATAPI (SCSI) write command DFR PW bcl cdb0 cdb1 ... cdbn [etl] // control drive's 5v and/or 12v supply // see ATAPWRCTRL environment variable PWRCTRL PORT n // set/change parallel port I/O address PWRCTRL AON AOFf // All on or off PWRCTRL PON POFf // 5v and 12v on or off PWRCTRL TON TOFf // trigger on or off PWRCTRL 5ON 5OFf 12ON 12OFf // 5v on or off, 12v on or off // quit SLIST, script or exit AHCDEMO QUit [SLIST] // execute ATA PIO or DMA read command // (see CHS, DMA and LBAx commands) DR R sectorCount lba [multiCount] DR R sectorCount cyl head sect [multiCount] // set random seed (see rand_num) RANDSEED n // execute READ BUFFER command DR RBUF [feature sectorCount lba] // execute ATAPI (SCSI) Read Capacity command DR RCAp // execute ATAPI (SCSI) Read CD command RCD tl lba [etl] // read data from a file into the I/O buffer READFile numBytes fileName [ offset [Check] ] READ numBytes fileName [ offset [Check] ] // read only on/off READOnly READOnly OFf READOnly ON READOnly (n) // repeat commands // (see CHSIncr, LBAIncr, R and W, etc) F REPeat count command // execute various resets DR RESet DR RESet COMReset DR RESet INVAlidsrst DR RESet PORT DR RESet SRST DR RESet PHYOff // return from a subroutine FS RETurn [n] // execute a READ NATIVE MAX command DR RNME // exeucte ATAPI (SCSI) Request Sense command DR RS // execute a sequence of command with various parameters // (see User Guide) DFR RSVW sequence lba minSC maxSC [multiCount] DFR RSVW sequence cyl head sect minSC maxSC [multiCount] sequence: combination of characters R S V and/or W. // execute ATAPI (SCSI) Read TOC command DR RTOc [format] // display or change the Run ID value // see start_time and run_id RUNID [n] // execute ATAPI (SCSI) Read10 command DR R10 tl lba [etl] // execute ATAPI (SCSI) Read12 command DR R12 tl lba [etl] // execute ATAPI (SCSI) Seek10 command DR S10 lba // write text to screen and log F SAY text // display large FAIL or PASS message F SAYFail F SAYPass // load, compile and execute a script file F SCRipt fileName // execute ATA SEEK command DR Seek lba DR Seek cyl head sect // define and/or assign a value to a variable F SET varName [=] n varName = n // various SET FEATURES commands DR SF DR SF PIo n DR SF SW n DR SF MW n DR SF ULtra n DR SF DRC DR SF ERC DR SF DWC DR SF EWC // various data display commands SHOW SHOW DEC SHOW HEX SHOWCB SHOWCH SHOWDCo SHOWCI SHOWDI SHOWFPq SHOWID SHOWINq SHOWLL SHOWPC SHOWRS SHOWTOc // execute a SLIST (See User Guide) F SLIST fileName // set SLIST looping options F SLOPTION [LOOP n] [TIME n] // go to SATA Slumber state DF SLUMBER // execute ATA SET MULTIPLE command DR SM multiCount // execute SMART commands DR SMART DR SMART ENable DR SMART DIsable DR SMART RData DR SMART RLog logAddr numPages DR SMART STatus DR SMART WLog logAddr numPages // execute SOFT RESET (SRST) DR SRST // script debugging (see User Guide) F SSS [option] // execute ATAPI (SCSI) Start Stop Unit command DR SSU [option] // store bytes into the I/O buffer STORE sectorOffset byteOffset n ... // store a variable's value into the I/O buffer F STOREBUF sectorOffset byteOffset size value F STOREBUF sectorOffset byteOffset size value BE F STOREBUF sectorOffset byteOffset size value LE // store a variable's value into the ATAPI (SCSI) CDB buffer F STORECDB offset size value // string commands F STRAVC fromAvNdx toAvNdx F STRAVF strVar avNdx F STRAVS avNdx strVar F STRCMP strVar1 strVar2 F STRCONV varName strVar F STRFBUF strVar sectorOffset byteOffset F STRFIND strVar1 strVar2 F STRLEN strVar F STRLWR strVar F STRPARSE strVar1 strVar2 strVar3 F STRSBUF sectorOffset byteOffset strVar F STRSET strVar [text] F STRSTRIP strVar F STRSUB strVar1 strVar2 offset length F STRUPR strVar // sector tag data on/off (see COMPx and FILLx) TAG TAG OFf TAG ON TAG (n) // execute ATAPI (SCSI) Test Unit Ready command DR TUR // cleanup user defined (global) variables F UDVAR SAVE F UDVAR CLEANUP F UDVAR DELETEALL // execute ATA READ VERIFY command DR V sectorCount lba DR V sectorCount cyl head sect // execute ATA PIO or DMA write command // (see CHS, DMA and LBAx commands) DFR W sectorCount lba [multiCount] DFR W sectorCount cyl head sect [multiCount] // execute WRITE BUFFER command DR WBUF [feature sectorCount lba] // begin a while loop FS WHILE n // window (menu) commands FS WINdow ASK varName FS WINdow CLEAR FS WINdow CLOSE FS WINdow COLOR fb FS WINdow GOTO n FS WINdow OPEN // write text to the log file F WL text // write data from the I/O buffer to a file WRITEFile numBytes fileName [Append] WRITE numBytes fileName [Append] // write text to a file F WRITEText fileName text // execute ATAPI (SCSI) Write10 comamand DFR W10 tl lba [etl] // execute ATAPI (SCSI) Write12 comamand DFR W12 tl lba [etl] // repeat previous keyboard command = == // repeat previous keyboard I/O command / //
// append a script file (see User Guide) F #NEXT fileName
bios_timer - system BIOS timer value buf_size - I/O buffer size in bytes buf_blks - I/O buffer size in sectors bytes_xfer - bytes transferred by last I/O command chk_sum - check sum - see CHKSUM command cmdt_avg - see CMDT command cmdt_cnt - see CMDT command cmdt_cur - see CMDT command cmdt_hi - see CMDT command cmdt_lo - see CMDT command cmdt_timer - see CMDT command cmdt_tot - see CMDT command cur_time - (string) current date/time demo_versi - program version (numeric) dev_bs - device block size dev_chslba - 0 if CHS, not zero if LBA dev_dto - current driver time out dev_num - current device number, always 0 dev_ps - current ATAPI command packet size dev_tag - not zero if TAG ON dev_type - 0 = none, 1 = unknown, 2 = ATA, 3 = ATAPI error_code - AHCIDRVR error code exp_err - 0 if EXPEcterror is off, 1 if on fill_num - see FILLNUM command fpq_iops - I/O Per Second for last FPQGO command. fpq_maxsc - maximum Sector Count allowed in FPQR and FPQW commands. fpq_numcmd - number of commands executed by last FPQGO command. fpq_numtag - number of commands in the FP Queue. fpq_runtim - execution time in seconds for the last FPQGO command. id_model - (string) device model id_serial - (string) device serial id_version - (string) device version io_am - 0 = CHS, 28 = LBA28, 32 = LBA32, 48 = LBA48 io_lba - the LBA of the last command io_lbalo - LBA28 or lower 32 bits of LBA32/LBA48 io_lbahi - upper 16 bits of LBA48 io_result - 0 = no error, 1 = I/O error, see error_code, 2 = data compare error, 4 = transfer length error io_sc - transfer length (sector/block count) of last I/O command io_tl - transfer length (sector/block count) of last I/O command log_sml - encoded current 'OG SML x x' setting log_name - (string) current log file name log_status - not zero if log disk is full max_cyl - see the ID and CHSIncr commands max_head - see the ID and CHSIncr commands max_lba - maximum LBA, same as (num_lba-1), see num_lba (below) and ID and LBAIncr commands max_sect - see the ID and CHSIncr commands num_bytes - number of bytes processed by various commands num_lba - number of LBA, same as (max_lba+1) see max_lba (above) and ID and LBAIncr commands opt_n0 - command line option N0=n opt_n1 - command line option N1=n opt_n2 - command line option N2=n opt_n3 - command line option N3=n opt_n4 - command line option N4=n opt_n5 - command line option N5=n opt_n6 - command line option N6=n opt_n7 - command line option N7=n opt_n8 - command line option N8=n opt_n9 - command line option N9=n pci_bus - host controller PCI bus number pci_dev - host controller PCI device number pci_fun - host controller PCI function number px_cmd - current value in AHCI PxCMD register px_tfd - current value in AHCI PxTFD register px_sig - current value in AHCI PxSIG register px_ssts - current value in AHCI PxSSTS register px_sctl - current value in AHCI PxSCTL register px_serr - current value in AHCI PxSERR register pgm_versio - (string) program version rand_num - random number read_only - no zero if write commands not allowed reg_as - last read of the Status register. reg_ch - last read of the Cylinder High register. reg_chs_c - last read of CHS Cylinder High and Low registers. reg_chs_h - last read of CHS Head value from Device/Head register. reg_chs_s - last read of CHS Sector Number register. reg_cl - last read of the Cylinder Low register. reg_cm - last write of the Command register. reg_dc - last write of the Device Control register. reg_dh - last read of the Device/Head register. reg_er - last read of the Error register. reg_fr - same as reg_fr0 reg_fr0 - last write of the Feature register bits 7:0. reg_fr1 - last write of the Feature register bits 15:8. reg_lba - last read of full LBA28/LBA32/LBA48. reg_lba0 - last read of LBA bits 7:0. reg_lba1 - last read of LBA bits 15:8. reg_lba2 - last read of LBA bits 23:16. reg_lba3 - last read of LBA bits 31:24. reg_lba4 - last read of LBA bits 39:32. reg_lba5 - last read of LBA bits 47:40. reg_sc - same as reg_sc0 reg_sc0 - last read of the Sector Count register bits 7:0. reg_sc1 - last read of the Sector Count register bits 15:8. reg_sn - last read of the Sector Number register (reg_lba0). reg_st - last read of the Status register. rep_num - current repeat number rep_prev - ending repeat of the most recent REPeat command run_id - current run id (a 4 byte value), see start_time run_time - AHCDEMO run time in seconds sata_gen - same as sata_genc sata_genc - current SATA GEN sata_genm - max SATA GEN supported by AHCI controller sata_genr - max SATA GEN allowed for next COMRESET/COMINIT scr_name - (string) same as script_nam script_fla - see SCRIPT command script_nam - (string) current script file name script_run - not zero if script running slist_loop - current slist loop count slist_run - not zero if slist running slist_sfn - (string) current slist script file name slist_time - current slist run time (mintues) slopt_loop - slist option loop count slopt_time - slist option run time start_time - AHCDEMO start time (a 4 byte value), see run_id str_result - result of last str* command str_s0 - (string) string 0 str_s1 - (string) string 1 str_s2 - (string) string 2 str_s3 - (string) string 3 str_s4 - (string) string 4 str_s5 - (string) string 5 str_s6 - (string) string 6 str_s7 - (string) string 7 str_s8 - (string) string 8 str_s9 - (string) string 9 sub_param - same as sub_param1 sub_param1 - subroutine parameter 1 sub_param2 - subroutine parameter 2 sub_param3 - subroutine parameter 3 sub_param4 - subroutine parameter 4 sub_param5 - subroutine parameter 5 sub_param6 - subroutine parameter 6 sub_param7 - subroutine parameter 7 sub_param8 - subroutine parameter 8 sub_param9 - subroutine parameter 9 sub_return - subroutine return value time_out - not zero if I/O time out error
-end-