AHCDEMO

AHCI Demo Program

User Guide

Version 3A5d

Copyright 2010-2019 Hale Landis. All rights reserved.

Note: Also see files CMD-SUM.HTM and SCRIPTS.HTM.

NOTICE: Marvell 88SE6145 AHCI Controller
This model controller (Vendor ID 11AB) identifies itself as AHCI but it really is not AHCI compatible. While it may appear to operate for a few commands, it will normally not work with AHCDEMO. This controller is found on some Intel motherboards as a second AHCI (RAID?) controller.

TABLE OF CONTENTS

(Go To TOC)

INTRODUCTION

AHCDEMO is a powerful test program for testing SATA ATA and ATAPI devices (hard disk, solid state disk, and CD/DVD/tape) devices. The device to be tested must be attached to an AHCI SATA host controller operating in AHCI mode.

AHCDEMO accepts simple command input from the keyboard or script files to assemble ATA or ATAPI commands and execute those commands. The scripting language includes IF/ELSE, WHILE, subroutines, built-in and user defined variables (numeric and string) and many other powerful features.

AHCDEMO is a DOS DPMI program. It requires a DPMI driver (the DPMI driver CWSDPMI.EXE is provided with AHCDEMO).

AHCDEMO is not shareware or freeware. AHCDEMO is a commercial product and you or your company must have purchased a copy of the program in order to legally use the full function version of the program. There is a demonstration/evaluation version of the program that has reduced function. The demonstration/evaluation version of AHCDEMO has no use or distribution restrictions but shall be used only to evaluate the program.

(Go To TOC)

REQUIREMENTS

AHCDEMO requires the following basic system and test devices:

AHCDEMO does not use the system BIOS - AHCDEMO directly accesses the AHCI controller registers and takes full control of the of all AHCI ports and attached devices. During startup AHCDEMO resets the AHCI controller and places it into AHCI mode. All AHCI ports except the port used by AHCDEMO are disabled and access to any devices attached to those ports is not allowed.

(Go To TOC)

INSTALLATION

Create a bootable DOS device (floppy disk or USB boot device) with no CONFIG.SYS or AUTOEXEC.BAT files. Place the AHCDEMO.EXE and CWSDPMI.EXE files on the boot device.

Boot your system from the boot device. This insures that you are not loading some strange device drivers that may interfere with AHCDEMO.

(Go To TOC)

RUNNING AHCDEMO

To run AHCDEMO, set up the test system and devices:

The easy way to start AHCDEMO is by using the command line


   AHCDEMO PORT=n

where n is the AHCI port number for the device to be tested.

When AHCDEMO starts it will find the AHCI controller(s). If more than one AHCI controller is found AHCDEMO will need to be restarted using the b:d:f command line option. During startup AHCDEMO will reset and initialize the AHCI controller and port to be used. All other AHCI ports will be disabled. If startup initialization is successful testing will begin. The program will switch to "full screen" mode during testing. This screen shows the testing progress. AHCDEMO also writes a detailed log file.

If you wish to record all your AHCDEMO activities to a file, use the LOG command to open the AHCDEMO.LOG file. When the log file is open all keyboard input and program output is recorded in the log file.

(Go To TOC)

COMMAND LINE OPTIONS

The AHCDEMO command line syntax is:


   AHCDEMO [PORT=n] [b:d:f] [options]

If no options are specified the program displays command line help information and terminates.

Except for the LOG=x option, the command line options are processed left to right. If an option is specified more than once, the last (rightmost) specification is used. Only the first LOG=x option is used, any addtional LOG=x options are ignored.

Port and Controller Options

(Go To TOC)

[ PORT=n ]


PORT=n

Selects the AHCI port to be used, 0 to 31. The default is PORT=0.

Also see:  b:d:f

(Go To TOC)

[ b:d:f ]


b:d:f

b:d:f is the PCI bus, device and function for an AHCI controller.

When this option is not specified AHCDEMO will scan PCI buses 0 to 15 for supported AHCI host controllers.

This option is not required if there is only one AHCI controller in the system.

If the desired AHCI host controller is not found on PCI buses 0 to 15 then this option can be used to specify a PCI bus number up to 255.

Also see:  PORT=n

General Options

(Go To TOC)

[ AV=n ]


AV=n

This option determines the size of the array variable memory area:

The default is AV=1.

Also see:  AVCLEAR AVDELETE AVFETCH AVNEW AVSTORE

(Go To TOC)

[ GEN=n ]


GEN=n

Set the allowed maximum SATA interface speed used by the AHCI host conroller:

This command line option sets the initial max speed. The max speed can be changed later using the GEN command.

The actual speed negotiated between the host and the drive may be less than the max allowed by this command line option.

Also see:  GEN

(Go To TOC)

[ LOG=fileName ]


LOG=fileName
LOG=*n
LOG=NUL
LOG=NULL

NOTE: Only the first LOG=x option found on the command line is used, any additional LOG=x options are ignored.

The default log file name is ".\AHCDEMO.LOG". Use this option to specify a different log file name.

LOG=*n can be use to generate unique log file names based on the date/time. The generated file name replaces the *n characters and all following charactes. The LOG=*n options are:

where

LOG=*n examples:


   LOG=*1          -- LOG=4E0B47AC.LOG
   LOG=*2          -- LOG=2C181452.LOG
   LOG=\logs\*3    -- LOG=\logs\1K25F33B.LOG
   LOG=dvt\test\*4 -- LOG=dvt\test\E17G4135.LOG

Use LOG=NUL or LOG=NULL to suppress generation of the log file.

(Go To TOC)

[ Nn=n ]


Nn=n

Set the built-in numeric variable OPT_Nn to a decimal or hex value.

Also see:  ASK Nn=n opt_n* Sn=string

(Go To TOC)

[ READONLY ]


READONLY

Places AHCDEMO into read only mode. In this mode the DPW, DW, PDO, PW, W, W10 and W12 commands are not allowed. This option is in effect for the entire execution of AHCDEMO and can not be turned off using the READOnly command.

Warning: While the READONLY option and the READOnly command can be used to disable write commands, be careful, some Non-Data (ND) commands do write to the device media!

Also see:  READOnly

(Go To TOC)

[ SCR=fileName ]


SCR=fileName

Run the specified script file. See the SCRIPT FILES below.

(Go To TOC)

[ SLIST=fileName ]


SLIST=fileName

Run the specified script list. See the SCRIPT LISTS below.

Also see the SLIST and SLOPTION commands.

(Go To TOC)

[ Sn=string ]


Sn=string

Set the built-in string variable STR_Sn to the string value. The value 'string' can be 0 to 32 characters and should be restricted to the character a-z, A-Z and 0-9.

Also see:  ASKSTR Nn=n STRx str_s*

(Go To TOC)

ENVIRONMENT VARIABLES

These DOS Environment variables must be set using the DOS SET command before AHCDEMO is started.

SET AHCDEMO=x

The DOS environment variable AHCDEMO is used to control the AHCDEMO screen size and the screen colors. This variable is set using the DOS SET command:


   SET AHCDEMO=[size];[colors]

where size is the number of screen rows, usually 25, 43, etc, and colors is a list of seven foreground/background colors. There are seven types of messages or areas of the screen:

Each of these can be set to a different color by specifying a pair of characters for the foreground and background colors. The colors are:


   k or K - black
   b or B - blue
   g or G - green
   c or C - cyan
   r or R - red
   m or M - magenta
   y or Y - yellow
   w or W - white

The lower case character results in a low intensity color and a upper case character results in a high intensity color.

The AHCDEMO default on a color monitor is:


   SET AHCDEMO=25;wkckykgkwkWkMk

The AHCDEMO default on a monochrome monitor is:


   SET AHCDEMO=25;wkwkwkwkWkWkWk

The following example sets the screen size to 43 lines and changes the screen colors:


   set ahcdemo=43;WkCkYkGkWkkWMk

SET ATAERROR=x

The DOS environment variable ATAERROR is used to enable a trigger signal when an error is detected. This variable is set using the DOS SET command:


   SET ATAERROR=port:v1:v2:v3

where port is an I/O port address and v1, v2 and v3 are values to be written to that port. port must be a hex value in the range 1 to FFFF. v1, v2 and v3 are hex values between 0 and FF.

When this environment variable is in effect, the values v1, v2 and v3 will be written to the I/O port whenever an error is detected (before the error message is displayed.

For example:


   SET ATAERROR=300:0:ff:0

will toggle the data at I/O port 300H from 00H to FFH to 00H.

SET ATAPWRCTRL=x

See the Power Control Board User Guide (POWER.HTM).

The DOS environment variable ATAPWRCTRL is used to set the Parallel Port I/O address used by the ATA-ATAPI.COM Power Control Board. This variable is set using the DOS SET command:

The Parallel Port I/O address is used by the PWRCTRL command to turn on and off the 5 and 12 volt supply to a drive and to control a trigger signal.


   SET ATAERROR=port

where port is an I/O port address. port must be a hex value in the range 1 to FFFF.

Standard Parallel Port I/O addresses are 0278, 0378 and 03BC. Parallel Ports on PCI plug in cards can be at any I/O port address higher than 03FF.

For example:


   SET ATAPWRCTRL=E010

Also see:  PWRCTRL pwr_ctrlc pwr_ctrlp

(Go To TOC)

USER INTERFACE

This section describes the normal user interface of AHCDEMO. A script file may use an alternative user interface known as window mode, see the next section.

AHCDEMO uses a full screen format for the output. The screen layout is:


   lines      use
   ---------  -----------------------------
    1         program identification line
    2 to n-2  scrolling output area
    n-1       status message
    n         prompt and input area

The user interface operates in one of two modes: normal mode and review mode. Commands are entered and executed in normal mode. In review mode, previous output is displayed.

In normal mode the following keys are used:


   BS    - move the cursor to the left and delete one character
   DEL   - delete the character at the cursor position
   DOWN  - recall commands in the command history buffer
   END   - move the cursor to the end of the line
   ENTER - completes the input
   HOME  - move the cursor to the begining of the line
   INS   - toggle insert/replace mode
   LEFT  - move the cursor left one character
   PGDN  - enter review mode
   PGUP  - enter review mode
   RIGHT - move the cursor right one character
   UP    - recall commands in the command history buffer
   CTRL-END - delete characters to right of cursor position

In review mode the following keys are used:


   DOWN  - scroll down one line
   ESC   - return to normal mode
   PGDN  - scroll down one screen
   PGUP  - scroll up one screen
   UP    - scroll up one line

(Go To TOC)

WINDOW INTERFACE

A script file can place AHCDEMO into an alternative user interface mode known as window mode. In window mode the script can control what is displayed in all but the bottom two rows of the screen and the script can display simple menus to retrieve user input. In window mode the script can ask the user to select from a memnu of items and ask the user for numeric and Yes/No input.

When a script presents a menu of items and asks the user to select one of those items the following keys can be used:


   DOWN  - move up one item
   END   - go to the last item
   ENTER - select the item
   HOME  - go to the first item
   UP    - move down one item

In window mode the ASK and ASKYN commands operate the same as in normal mode except the PGUP and PGDN keys are ignored. See the ASK, ASKYN and WINdow command descriptions for more information.

In window mode all program messages continue to be logged to the AHCDEMO log file (see the ECHO and LOG commands). The results of executing commands, especially device I/O commands, is not displayed. A script should allow the user to return to normal mode so that the current log file can be seen or so that review mode can be used.

See SCRIPT FILES below and also see the DEMO.DSF and EXAMPLE.DSF files for examples of window mode.

(Go To TOC)

MESSAGE LOGGING

All AHCDEMO messages belong to a message level. The ECHO and LOG commands can be used to control the message levels that are displayed and written to the log file.

There are nine message levels:

There are four message level control settings:

The keyboard message levels are controlled using the LOG KML command. The script file message levels are controlled by the LOG SML command. The ECHO, LOG MAXimum and LOG MINimum commands provide a simple way to control the message levels.

Setting a message level off does not affect the execution of a command that produces messages in that message level. For example, turning off informational (M) messages will not affect the result of executing a TAG ON or TAG OFF command but the messages produced by the TAG command will not appear.

(Go To TOC)

COMMAND SUMMARY

Help, Exit/Quit Commands

ATA High Level Commands

ATA Low Level Commands

ATAPI High Level Commands

ATAPI Low Level Commands

Repeating and Automatic Commands

Device Option Commands

Data Compare and Generation Commands

Data Display and Trace Display Commands

Delay and Timing Commands

Script Commands

Message, Window and Log File Commands

String Commands

Low Level I/O Port Commands

Editor Commands

(Go To TOC)

COMMAND DESCRIPTION FORMAT

In the following command descriptions, words in UPPERCASE are entered as shown. Words in lower case represent variable data that is usually numeric. Words within brackets ([]) are optional. Ellipses (...) indicate that the previous word may be repeated one or more times. Case is ignored in commands ("ABC" is the same as "abc" or "aBc").

Command parameters are literal value, a numeric value, built-in or user defined variables or an expression. For example:


   ON                      - a literal
   COntinue                - a literal
   0                       - a numeric
   -5                      - a numeric
   bytes_xfer              - a built-in variable
   myvar                   - a user defined variable
   (4 + myvar * 3)         - an expression
   ((a1+b2)*(c3/d4)!=10)   - an expression

Numeric Values

Numeric values are entered as follows:

A number starting with a '-' is a negative number, for example, -2 or -0xff.

Recommendation: Use the '0' or '0x' prefix on all hex numbers. This will avoid the problem with certain numeric values being confused with a variable name.

Some AHCDEMO commands have an 'lba' parameter. These values are treated as unsigned 32-bit values. LBA values greater than 0x7fffffff should be specified in hex. Be careful when performing arithmetic on large LBA values (arithmetic operators use and produce signed values).

An asterisk (*) can be used in place of any command parameter value. An asterisk leaves the value of the numeric parameter unchanged.

(Go To TOC)

VARIABLES

Variables are supported in the full version of AHCDEMO. Variable names may be used as AHCDEMO command parameters and may also be used in expressions. There are two basic type of variables:

Variable names are 1 to 10 characters. Variable names over 10 characters are truncated to 10 characters. For example "demo_version" is the same as "demo_versi". Variable names must start with an alphabetic character. Additional characters in a variable name may be alphabetic or numeric characters. Built-in variable names contain one or more underscore (_) characters. Variable names are not case sensitive.

Valid variable name examples:


   abc               (user defined)
   aBc               (same as abc)
   ABC               (same as abc)
   dev_tag           (built-in)
   Dev_Tag           (same as dev_tag)
   DEV_TAG           (same as dev_tag)
   thisisalon        (max length name)
   thisisalongname   (same as thisisalon)
   ThisIsALongOne    (same as thisisalon)

Invalid variable name examples:


   4me               (starts with a numeric character)
   _index            (starts with an underscore)
   loop$count        (invalid character $)

Built-in Variables

Built-in variables contain numeric or string data. These variables contain information describing the current program configuration, device configuration and status, and the results of AHCDEMO and I/O commands.

All built-in variables are read-only. Except for the sub_param variables, built-in variables are global variables. The sub_param variables are local to each subroutine. The sub_param variables do not exist in the main part of a script.

Built-in Numeric Variables

Note: See the UDVAR command.

The following built-in numeric variables are defined:

         


   bios_timer  - time of day, increments every 55ms, resets
               - to zero at midnight. Also see cmdt_timer.

   buf_size    - total/max size of the AHCDEMO I/O buffer in bytes.
   buf_blks    - current number of sectors/blocks that fit into
                 the AHCDEMO I/O buffer.

   bytes_xfer  - number of bytes transferred by the
                 last device I/O command.

   chk_sum     - see CHKSUM command.

 


   cmdt_avg    - CMDTime average command time in us (see note2).
   cmdt_cnt    - CMDTime number of commands (see note2).
   cmdt_cur    - CMDTime time for last command in us (see note1).
   cmdt_high   - CMDTime highest command time in us (see note2).
   cmdt_low    - CMDTime lowest command time in us (see note2).
   cmdt_timer  - CMDTime counter that increments every microsecond (see note1).
   cmdt_tot    - CMDTime total time in ms (see note2).

Note1: cmdt_cur and cmdt_timer are valid when the command timing feature configuration was successful. Also see bios_timer.

Note2: cmdt_avg, cmdt_high, cmdt_low and cmdt_tot are valid only when the command timing feature configuration was successful cmdt_cnt is greater than 0.

 


   demo_version - AHCDEMO version.

Note: The AHCDEMO version is encoded as two or three ASCII characters, 0x0000xxyy or 0x00xxxxyy, where xxxx is the major version number and yy is the minor version letter. Characters following the minor version letter are not included. For example, version 1A2 is encoded as 0x00003141, and version 12B5 is encoded as 0x00313242.

Note: See the pgm_version built-in string variable.

 


   dev_bs      - current device block size.
   dev_chslba  - current device sector addressing mode,
                 0 is CHS, not 0 is LBA.
   dev_dto     - current driver time out in seconds
   dev_num     - current device number, always 0.
   dev_ps      - current ATAPI command packet size, 12 or 16.
   dev_tag     - current device TAG ON/OFf state,
                 0 is off, 1 is on.
   dev_type    - current device type,
                 0 = none, 1 = unknown, 2 = ATA, 3 = ATAPI.

     


   error_code  - AHCIDRVR error code for the
                 last device I/O command.

   exp_err     - 0 if EXPEcterror is off, 1 if on

   fill_num    - current FILLNUM.

 


   fpq_iops    - I/O Per Second for last FPQGO/FPQGOT command.
   fpq_maxsc   - Maximum Sector Count allowed in FPQR and FPQW commands.
   fpq_numcmd  - Number of commands executed by last FPQGO/FPQGOT command.
   fpq_numtag  - Number of commands in the FP Queue.
   fpq_runtim  - Execution time in seconds for the last FPQGO/FPQGOT command.

 


   io_am       - current sector/block addressing mode:
                 0 = CHS
                 28 = LBA28
                 32 = LBA32
                 48 = LBA48
   io_lba      - same as io_lbalo
   io_lbalo    - lower 28 of LBA28 or lower 32 bits of LBA32/LBA48 value.
   io_lbahi    - upper 16 bits of LBA48 value
   io_result   - result of last I/O or data compare command,
                 this is the actual result,
                 not affected by EXPEcterror,
                 0 = no error
                 1 = I/O error, see error_code
                 2 = data compare error
                 4 = transfer length error, see bytes_xfer
   io_sc       - transfer length (sector/block count)
                 used by the last I/O command.
   io_tl       - transfer length (sector/block count)
                 used by the last I/O command.

   


   log_sml     - encoded current 'LOG SML x x' setting
   log_status  - not zero if the log file is full.

 


   max_cyl     - see the ID and CHSIncr commands.
   max_head    - see the ID and CHSIncr commands.
   max_lba     - max LBA - see ID and LBAIncr commands,
                 same as (num_lba-1), see num_lba below.
   max_sect    - see the ID and CHSIncr commands.

   


   num_bytes   - number of bytes processed by various commands.
   num_lba     - total LBAs - see ID and LBAIncr commands,
                 same as (max_lba+1), see max_lba above.

Note: num_bytes is changed by several commands, the value should be saved in a user defined variable if it is needed. For example, see the READ command.

 


   opt_n0      - option N0=n
   opt_n1      - option N1=n
   opt_n2      - option N2=n
   opt_n3      - option N3=n
   opt_n4      - option N4=n
   opt_n5      - option N5=n
   opt_n6      - option N6=n
   opt_n7      - option N7=n
   opt_n8      - option N8=n
   opt_n9      - option N9=n

These variable can be assigned a non-zero value only by using the Nn=n command line options.

   


   pci_bus     - PCI bus number (not valid if -1)
   pci_dev     - PCI device number (not valid if -1)
   pci_fun     - PCI function number (not valid if -1)

   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

   


   pwr_ctrlc   - current power control settings:
                 0x04 - trigger on
                 0x10 - 12v on
                 0x20 - 5v on
   pwr_ctrlp   - current power control I/O port address

     


   rand_num    - a 32-bit random number (a new value
                 each time rand_num is used).
   read_only   - current READONLY/READOnly state,
                 0 = readonly off, not 0 = readonly on.

   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 count (1, 2, 3, ... n)
                 during REPeat commands, value is 0 at
                 all other times.
   rep_prev    - ending repeat count for most recent REPeat
                 command.

                   


   run_id      - current Run ID, see RUNID and start_time

   run_time    - the number of seconds since AHCDEMO started.

   sata_gen    - same as sata_gen

   sata_genc   - Current SATA generation number.

   sata_genm   - Max SATA generation supported by AHCI controller.

   sata_genr   - Max SATA gereration allowed for next COMRESET/COMINIT.

   script_flag - script execution flag.

   slist_loop  - the number of SLIST loops completed.

   slist_sfn   - SLIST script file name (not the before or after script).

   slist_time  - The run time in minutes when the most recent SLIST loop
                 completed.

   slopt_loop  - SLOPTION LOOP n

   slopt_time  - SLOPTION TIME n

   start_time  - initial Run ID (program start time), see RUNID and run_id

   str_result  - result of last STRx command.

 


   sub_param   - same as sub_param1.
   sub_param1  - first subroutine parameter.
   sub_param2  - second subroutine parameter.
   sub_param3  - third subroutine parameter.
   sub_param4  - fourth subroutine parameter.
   sub_param5  - fifth subroutine parameter.
   sub_param6  - sixth subroutine parameter.
   sub_param7  - seventh subroutine parameter.
   sub_param8  - eighth subroutine parameter.
   sub_param9  - nineth subroutine parameter.

Note: The sub_param variables are local to the current subroutine. They do not exist in the main part of a script.

   


   sub_return  - last subroutine's return value, see the RETURN
                 command.

   time_out    - ATADRVR time out flag for the
                 last device I/O command.

Built-in String Variables

Built-in string variables are used in the 'text' parameter of the ASK, ASKYN, ASKSTR, SAY, STRSET, WL and WRITEText commands. The STRx commands can perform various operations on the str_s* variables.

These variables have a numeric value of 0 at all times.

The following built-in string variables are defined:

               


   cur_time    - Current date and time string.
   id_model    - Model number string.
   id_serial   - Serial number string.
   id_version  - Version number string.
   log_name    - current log file name.
   pgm_version - AHCDEMO version (see below).
   scr_name    - same as script_nam.
   script_nam  - current script file name.
   slist_sfn   - current slist file name.
   str_s0      - String variable 0
   str_s1      - String variable 1
   str_s2      - String variable 2
   str_s3      - String variable 3
   str_s4      - String variable 4
   str_s5      - String variable 5
   str_s6      - String variable 6
   str_s7      - String variable 7
   str_s8      - String variable 8
   str_s9      - String variable 9

The id_* variables are assigned a new value whenever an ID command is sucessful.

The pgm_version variable contains the AHCDEMO version, either two or three ASCII characters: "NX" or "NNX" where N or NN is the major version number and X is the minor version letter. For example, version 1A2 is encoded as "1A" and version 12B5 is encoded as "12B". Also see the demo_version built-in variable.

The str_s* can store strings of 0 to 96 characters. These string variables can be assigned values using the Sn=string command line options and by the ASKSTR and STRx commands. There is also an array of 100 string variables that are accessed using the STRAVC, STRAVF and STRAVS commands.

User Defined Numeric Variables

User defined variables are defined and given a value by the following commands:


   ASK
   ASKYN
   COPYBYtes
   FETCHBUF
   FETCHCDB
   INPORTByte, INPORTWord and INPORTDword
   LOCAL
   SET
   WINdow ASK

A variable must be defined before it can be used in place of a numeric command parameter or within an expression.

There are two kinds of user defined variables, global and local:

The following rules determine when and how variables are defined:

New global variables are defined by

Existing global variables are updated by

New local variables are defined by

* Existing local variables are updated by

Some commands are able to create new variables or update existing variables. These commands are ASK, ASKYN, COPYBYtes, FETCHx, INPORTx, and WINdow ASK. If the variable used in these commands does not exist then a new global variable is created. If the variable exists, as a local variable in the current subroutine or as a global variable, then the existing variable is updated.

User defined global variables (created by the SET and AVNEW commands are not deleted when a script file ends.

Example of global and local variables used in a script file:


   ; main part begins here
   set a = 1         ; a is a global
   set a = 2         ; global a is updated
   local a = 3       ; global a is updated (warning message)
   fetchbuf a 0 0 1  ; global a is updated
   local b = 1       ; b is a global (warning message)
   local b = 2       ; global b is updated (warning message)
   set b = 3         ; global b is updated
   fetchbuf b 0 0 1  ; global b is updated
   call sub1
   quit
   ; main part ends here
   beginsub sub1
      set a = 4         ; global a is updated
      fetchbuf a 0 0 1  ; global a is updated
      local b = 1       ; local b replaces global b
      local b = 2       ; local b is updated
      set b = 3         ; local b is updated (warning message)
      fetchbuf b 0 0 1  ; local b is updated
      call sub2
      fetchbuf c 0 0 1  ; global c is updated
      local d = 1       ; d is a local
      fetchbuf d 0 0 1  ; local d is updated
   endsub sub1
   beginsub sub2
      set a = 5         ; global a is updated
      fetchbuf a 0 0 1  ; global a is updated
      local b = 1       ; local b replaces global b
      local b = 2       ; local b is updated
      set b = 3         ; local b is updated (warning message)
      fetchbuf b 0 0 1  ; local b is updated
      fetchbuf c 0 0 1  ; c is a global
      local d = 1       ; d is a local
      fetchbuf d 0 0 1  ; local d is updated
   endsub sub2

User Defined Array Variables

Array variables may be defined and accesed using the AVCLEAR, AVDELETE, AVFETCH, AVNEW and AVSTORE commands. Array variables can be allocated in the array variable memory area or overlay the I/O buffer. The size of the array variable memory area is set by the AV=n command line option.

Like all user defined global variables, array variables are not deleted when script file execution ends. A script file that uses array variable should either a) use the AVDELETE command to delete all array variables before creating them again, or b) have some flag the will tell the script file to bypass creating the array variables again.

Also see:  AV=n AVCLEAR AVDELETE AVFETCH AVNEW AVSTORE DUMPAv

Variable Names That Look Like Numbers Or Keywords

Special care must be taken with some variable names that can be interpreted as either a numeric variable or variable name. These variables names contain only the characters A, B, C D, E, and/or the character H and X. For example:


   A        - could be the variable "A" or the
              numeric value 10 (0xa).
   f0x      - could be the variable "f0x" or the
              numeric value 240 (0xf0).
   H0       - could be the variable "H0" or the
              numeric value 0 (0x0).

If the variable name is defined, the current value of that variable is used. To avoid this confusion, use the "0" or "0x" prefix on hex numbers.

User defined variable names are not restricted and may be the same as keywords used in some commands, such as, ON, OFf, DEFAULT, etc. This can cause confusion and incorrect execution of script files. To prevent confusion or incorrect execution:


   set on = 0
   tag on      ; turns tagging on ("on" is a keyword)
   tag (on)    ; turns tagging off ("on" is a variable)

   set xyz = 583
   tag xyz     ; "xyz" is an invalid keyword
   tag (xyz)   ; turns tagging on ("xyz" is a variable)

(Go To TOC)

EXPRESSIONS

An expression is enclosed within a pair of parenthesis. All operations within an expression use 32-bit signed integers. There is no error if the expression results in an overflow or underflow. Division by zero is not allowed. The result of an expression is a signed 32-bit integer.

Some AHCDEMO commands have an 'lba' parameter. These values are treated as unsigned 32-bit values. LBA values greater than 0x7fffffff should be specified in hex. Be careful when performing arithmetic on large LBA values (arithmetic operators use and produce signed values).

The general format of an expresion is


   ( [operator] token [operator token] ... )

A token is either a constant numeric value or variable name. The valid operators are


   ~ !               - bitwise NOT, logical NOT
   * / %             - multiply, divide, remainder
   + -               - add, subtract
   & | ^             - bitwise AND, OR and XOR
   << >>             - unsigned bit shift left and right
   == != < <= > >=   - comparison
   && ||             - logical AND and OR

Operators are evaluated in the precedence shown above from the top down (~ and ! have the highest precedence). Parentheis can be used to change the order of evaluation.

The ~ and ! operators are valid only as prefix operators. The + and - operators may be used as prefix operators.

An expression that consists of only a variable name or only a numeric value is valid but will evaluate slower than the same variable name or numeric value not coded as an expression. For example:


   (0)     is the same as 0
   (myvar) is the same as myvar
   (-3)    is the same as -3

Commands that have ON and OFf parameters, such as the DMA command, also accept an expression that is evaluated (0 equals OFf, not 0 equals ON). In these commands this expression must be enclosed in parentheis (even if the expression is a single token). For example: "(3)" is equivalent to ON.

Examples of valid expressions:


   (a*b+c/d)
   ( (a*b) + (c/d) )
   (!myvar)
   (((-3)+(g)))
   ( (xx<<4) &0x30 != (y*4) || z == -5)

Examples of invalid expressions:


   a*b+c          missing "(" and ")"
   ((3*t)         missing ")"
   (*4)           invalid prefix operator
   ((a+b)(c/d))   missing operator
                  between ")" and "("

(Go To TOC)

TEXT STRING FORMATING

The ASK, ASKYN, SAY, WL and WRITEText commands are able to create formated text strings containing the values of built-in and user defined variables. To include the current value of a variable place the variable name within brace characters in the text string:


   {varName}      - display variable in decimal,
                    or display a string variable.
   {#varName}     - display variable in decimal,
                    pad on left with spaces to a field width of #.
   {*varName}     - display variable in hex.
   {*#varName}    - display variable in hex,
                    pad on left with '0' to a field width of #.

The maximum length of a formated text string is about 200 characters.

Examples:


   set xyz = 127

   say The current value of xyz is ({xyz}) ({*xyz}H).

      Displays the message:

      "The current value of xyz is (127) (7FH)."

   say The current value of xyz is ({5xyz}) ({*5xyz}H).

      Displays the message:

      "The current value of xyz is (  127) (0007FH)."

   say Drive Model: {id_model}

      Displays a message like this:

      "Drive Model: SuperDupper Corp Really Fast Disk"

(Go To TOC)

FILE NAMES

Some AHCDEMO commands have a fileName parameter - see the LOG NEW, READ, SCRipt, WRITE and WRITEText commands. The fileName parameter may be specified in three different formats:

For case 3, to include the current value of a variable place the variable name within brace characters in the text string:


   {varName}      - convert the variable to decimal.
   {*varName}     - convert the variable to hex.

See the individual commands for examples.

(Go To TOC)

SCRIPT FILES

The commercial/full version of AHCDEMO supports script files. A script file is an easy way to have AHCDEMO execute a series of commands in a "batch" mode. Create a script file with your favorite ASCII text editor. Use the SCR= command line option or the SCRipt command at the keyboard to load and execute a script file.

Script files can also be used to defined the equivalent of a new AHCDEMO command. This is done by defining a subroutine in a script file and then using the subroutine name as if it was an AHCDEMO command. The CAll command from the keyboard can also be used to execute the subroutine.

Most AHCDEMO commands can be entered at the keyboard or executed from within a script file. However, many AHCDEMO commands are valid only when executed via a script file, such as the IF, ELSE, RETURN and WHILE commands. These commands provide a powerful programming facility within a script file.

Script files can be appened to each other using the #NEXT directive.

Script files are described in detail, with examples, in the documentation file SCRIPTS.HTM.

(Go To TOC)

SCRIPT LISTS

The SLIST command line option and/or SLIST command are used to start the execution of a Script List. A Script List is a list of script files that are part of a larger testing sequence. For example, each script file might perform a test of a single ATA command sequence. Each script file can be preceeded by a "Before" script and followed by an "After" script. For example:


   execute the Before script
   execute test script number 1
   execute the After script
   execute the Before script
   execute test script number 2
   execute the After script
   execute the Before script
   etc...

There is also a Script List example at


      www.ata-atapi.com/techsupp.html

The Before and After scripts can be used to verify the test device is operational, change logging options, etc. The Before and After scripts are optional.

Execution of the Script List continues until either:

Script List execution will continue with the next script if any type of QUit command is executed.

If a script executes a SCRipt command the new script file is executed as part of the before, test of after script that contained the SCRipt command.

All other script file execution rules are not affected by executing a script from within a script file list.

A Script List file contains one of more text lines. These lines are:

During the execution of a before or after script the slist_sfn built-in string variable contains the name of test that will run following the before script executes or the test that just ran when the after script executes.

A script list can be repeated based on a loop count and/or a max time. The SLOPTION command is used to set the loop count or max time. The slist_loop built-in variable contains the number of SLIST loops completed. The slist_time built-in variable contains the run time in minutes when the most recent SLIST loop completed.

See the SLIST.SL and TESTnn.DSF files for an example of an script list.

(Go To TOC)

COMMAND CLASSES

Commands that are supported only in the commercial/full version are marked with the symbol [FULL].

Commands that perform device I/O commands are marked with the symbol [DIO]. These commands can be repeated using the REPeat command and by using the / and // commands.

Commands that may be used with the REPeat command are marked with the symbol [REP].

Commands that invoke the automatic before and after commands are marked with the symbol [AUTO].

Commands that valid only within a script file are marked with the symbol [SCRIPT]. These commands can not be entered at the keyboard.

(Go To TOC)

COMMAND EXECUTION

AHCDEMO commands are executed one at a time, however, some commands can be combined using the AFTERx and BEFORE comamnds. This can create powerful combinations of AHCDEMO functions. The following commands can be used to set up these combinations of AHCDEMO functions:


   AFTERERror           CHSIncr              ONERRor
   AFTERNOerror         EXPEcterror          ONESCkey
   BEFORE               LBAIncr              REPeat

For device I/O commands (see the commands flagged with symbol [DIO]) the following is the sequence of events for the execution of a single command.


   1) Get and process the command parameters. This is performed
      only for the first execution of a repeated command.
   2) If repeating, update the CHS or LBA. This may terminate
      the repeating.
   3) Execute the BEFORE commands in effect.
   4) Execute the device I/O command.
   5) Check the I/O command result and set up the
      AFTERx commands to be processed.
      If there was an I/O error,
         execute the AFTERERror commands in effect
      else
         execute the AFTERNOerror commands in effect.
   6) Apply EXPEcterror to the command result in step 4.
   7) Apply the ONERRor condition in effect. This may
      terminate the repeating.

For the CHKBUF, CHKREG and COMPx commands the following is the sequence of events for the execution of a command. Note that these commands can not be repeated and that the only error reported by these commands is a data compare error.


   1) Get and process the command parameters.
   2) Execute the command.
   3) Check the command result and set up the
      AFTERx commands to be processed.
      If there was an error,
         execute the AFTERERror commands in effect
      else
         execute the AFTERNOerror commands in effect.
   4) Apply EXPEcterror to the command result from step 2.
   5) Apply the ONERRor condition in effect.

(Go To TOC)

COMMAND REFERENCE

(Go To TOC)

[ (QuestionMark) ]


(QuestionMark)

A ? character anywhere on a command line entered from the keyboard is equivalent to using the Help command.

If the ? character is the first non-blank character then this is equivalent to the Help command. If there are non-blank characters before the ? character then this is equivlant to the Help x command where x is the first non-blank character.

Also see:  Help HELPKb

(Go To TOC)

[ ACTIVE ]


ACTIVE

[DIO] [FULL]

Place the SATA interface into Active mode.

Note: Moving directly between Partial and Slumber modes is not legal. Partial or Slumber can only be entered from Active mode.

Also see:  PARTIAL SLUMBER

(Go To TOC)

[ AFTERx ]

See AFTERERror and AFTERNOerror below.

(Go To TOC)

[ AFTERERror ]


AFTERERror

Display the current after error automatic commands (see the commands marked with the symbol [AUTO]).


AFTERERror OFf
AFTERERror ON
AFTERERror (n)

Disable or enable automatic commands following a device I/O command (see the commands marked with the symbol [AUTO]) that ends with an error. These commands do not change the automatic commands that are selected.

For AFTERERror (n), a zero value is the same as OFf and a non zero value is the same as ON.

Warning: See "Variables that look like keywords" above.

The default is AFTERERror ON.

Also see:  AFTERNOerror BEFORE EXPEcterror


AFTERERror [+]command [-]command ...
AFTERERror NONE

Select automatic commands executed following a device I/O command (see the commands marked with the symbol [AUTO]) that ends with an error.

If the automatic command name is prefixed with '+' (for example +Dump), that automatic command is enabled. If the automatic command name is prefixed with '-' (for example, -Dump), that automatic command is disabled.

Valid commands are: SHOWPC, Dump, SHOWCH, SHOWLL, SHOWCB, Clear, RS and RESet. NONE disables all commands.

When enabled the commands are executed in the order shown.

Note: RESet includes SATA port reset (if there was a time out error on the previous command). See the RESet command description.

Dump does not display any data for PIO or DMA commands that transfer more sectors than fit into the I/O buffer.

Also see:  AFTERNOerror BEFORE EXPEcterror

(Go To TOC)

[ AFTERNOerror ]


AFTERNOerror

Display the current after no error automatic commands (see the commands marked with the symbol [AUTO]).


AFTERNOerror OFf
AFTERNOerror ON
AFTERNOerror (n)

Disable or enable automatic commands following a device I/O command (see the commands marked with the symbol [AUTO]) that ends with no error. These commands do not change the automatic commands that are selected.

For AFTERNOerror (n), a zero value is the same as OFf and a non zero value is the same as ON.

Warning: See "Variables that look like keywords" above.

The default is AFTERNOerror ON.

Also see:  AFTERERror BEFORE EXPEcterror


AFTERNOerror [+]command [-]command ...
AFTERNOerror NONE

Select automatic commands executed following a device I/O command (see the commands marked with the symbol [AUTO]) that ends with no error.

If the automatic command name is prefixed with '+' (for example +Dump), that automatic command is enabled. If the automatic command name is prefixed with '-' (for example, -Dump), that automatic command is disabled.

Valid commands are: SHOWPC, COMPx, Dump, SHOWCH, SHOWLL, SHOWCB, Clear, RS and RESet. NONE disables all commands.

When enabled the commands are executed in the order shown.

COMPx is performed only after read commands (DPR, DR, PDI, PR, R, RCD, R10 and R12).

Note: When COMPx is used with PIO read commands that transfer more sectors than fit into the I/O buffer, only the sector tag data is actually compared. See the COMPTag and TAG commands.

Dump does not display any data for PIO or DMA commands that transfer more sectors than fit into the I/O buffer.

Also see:  AFTERERror BEFORE EXPEcterror

(Go To TOC)

[ ALTER ]


ALTER sectorOffset byteOffset andMask orMask

Alter the value of a byte in the buffer. The byte in the buffer is fetched, AND'ed with the andMask value, OR'ed with the orMask value, and stored back into the buffer.

sectorOffset is 0 to one less than the maximum number of sectors that fit into the buffer.

byteOffset is 0 to one less than the size of a sector.

andMask and orMask are a value from 0 to 255.

Note: The sector/block size of an ATA device can be an even number between 512 and 32768. The sector/block size is determined by the BLOCKSIZE and/or ID commands.

Note: The sector/block size of an ATAPI device can be 1 to 32768. The sector/block size is determined by the BLOCKSIZE or the RCAp commands.

Also see:  BLOCKSIZE ID RCAp STORE

(Go To TOC)

[ ASK ]


ASK varName [text]

[FULL]

See the description of "user defined variables" above.

Ask for input from the keyboard. The input is a single numeric value. The value is assigned to the user defined variable varName.

Either the optional message 'text' is displayed or the following message is displayed when the keyboard input is requested:


   ASK: Enter value for variable varName ? [cur-value]

See the section TEXT STRING FORMATING for the rules on how 'text' strings are used with this command.

Also see:  ASKYN ASKSTR SAYx WL WRITEText

(Go To TOC)

[ ASKSTR ]


ASKSTR strVar [text]

[FULL]

Ask for string input from the keyboard.

The string entered is assigned to the built-in string variable strVar (str_s*). Leading and trailing spaces are removed from the string entered.

str_result is set to the length of the string entered.

Either the optional message 'text' is displayed or the following message is displayed when the keyboard input is requested:


   ASKSTR: Enter value for string strVar ?

See the section TEXT STRING FORMATING for the rules on how 'text' strings are used with this command.

Also see:  ASK ASKYN SAYx STRx WL WRITEText str_s* Sn=string

(Go To TOC)

[ ASKYN ]


ASKYN varName [text]

[FULL]

See the description of "user defined variables" above.

Ask for Yes/No input from the keyboard. If the first character entered is y or Y, the user defined variable varName is set to 1. If the first character entered is n or N, the user defined variable varName is set to 0.

Either the optional message 'text' is displayed or the following message is displayed when the keyboard input is requested:


   ASK: Enter Y or N for variable varName ? [cur-value]

See the section TEXT STRING FORMATING for the rules on how 'text' strings are used with this command.

Also see:  ASK ASKSTR SAYx WL WRITEText

(Go To TOC)

[ ATARegs ]


ATARegs dh

Specify the value of bits 7 and 5 in the ATA Device (Drive/Head or Head) register used by ATADRVR when the next ATA command is issued. Only bits 7 and 5 of the value specified are used.

These bits default to zero and are reset to zero after issuing the next ATA command.

Also see:  ATAPIRegs

(Go To TOC)

[ ATAPIRegs ]


ATAPIRegs fr sc sn dh

Sets the values used by ATADRVR when the next Packet (A0H) command is issued. AHCIDRVR normally places zero into the Feature, Sector Count, Sector Number and Device/Head (bits 3,2,1,0) registers when a Packet command is issued. Use this command before the DPR, DPW, PN, PR, PW or other command that results in a Packet (A0H) command (such as R10).

fr is the value, 0 to 255, that should be used in the Features register.

sc is the value, 0 to 255, that should be used in the Sector Count register.

sn is the value, 0 to 255, that should be used in the Sector Number register.

dh is the value, 0 to 15, that should be used in bits 3, 2, 1 and 0 of the Device/Head register.

These values default to zero and are reset to zero after issuing the next Packet command.

Also see:  ATARegs

(Go To TOC)

[ AVCLEAR ]


AVCLEAR arrayName

[FULL]

Clears the entire array to zero. Array variables that overlay the I/O buffer can not be cleared by this command.

Also see:  AV=n AVDELETE AVFETCH AVNEW AVSTORE DUMPAv

(Go To TOC)

[ AVDELETE ]


AVDELETE

[FULL]

Deletes all arrays.

Also see:  AV=n AVCLEAR AVFETCH AVNEW AVSTORE DUMPAv

(Go To TOC)

[ AVFETCH ]


AVFETCH varName arrayName index

[FULL]

Fetch the value of arrayName[index] into varName.

See AVNEW for the description of how signed and unsigned values are handled.

Also see:  AV=n AVCLEAR AVDELETE AVNEW AVSTORE DUMPAv

(Go To TOC)

[ AVNEW ]


AVNEW arrayName type size [BUFFER]

[FULL]

Create a new data array in array memory or can overlay the I/O buffer.

Array names are user defined global variable and are not deleted when a script ends.

The first index of an array the overlays the I/O buffer starts at the first byte, word, dword or qword of the I/O buffer. Arrays defined in the I/O buffer can not be cleared to zero by the AVCLEAR command (see the FILLZero command).

'arrayName' is the name of the new array. The name follows the rules for user defined variables. The array name 'cmdt' as a special use with the CMDTime commands.

'type' is the data type of the array:

'size' is the number of elements in the array.

'BUFFER' indicates the array overlays the I/O buffer.

If the array does not overlay the I/O buffer the array values are cleared to zero when the array is created.

Fetch and store values in the array using the AVFETCH and AVSTORE commands. When signed values are fetched from a signed array the sign bit of the value fetched is extened to a full 64-bit signed value.

Example 1:


      AVNEW mydata BYTE 100
      AVSTORE mydata 50 -1
      AVSTORE mydata 60 1
      AVFETCH temp mydata 50
      // temp = -1 (a 64-bit value)
      AVFETCH temp mydata 60
      // temp = 1 (a 64-bit value)
      AVFETCH temp mydata 10
      // temp = 0 (a 64-bit value)

Example 2:


      // increment an array value
      AVNEW mydata BYTE 100
      AVFETCH temp mydata 75
      AVSTORE mydata 75 ( temp + 1 )

Example 3:


      // execute an IDENTIFY command
      ID
      // create a word array over the ID data
      AVNEW idData usword 256 BUFFER
      // fetch the value of ID word 54
      AVFETCH idword54 idData 54

Also see:  AV=n AVCLEAR AVDELETE AVFETCH AVSTORE CMDTime DUMPAv

(Go To TOC)

[ AVSTORE ]


AVSTORE arrayName index n

[FULL]

Store the value n into arrayName[index].

See AVNEW for the description of how signed and unsigned values are handled.

Also see:  AV=n AVCLEAR AVDELETE AVFETCH AVNEW DUMPAv

(Go To TOC)

[ BEFORE ]


BEFORE

Display the current before automatic commands (see the commands marked with the symbol [AUTO]).


BEFORE OFf
BEFORE ON
BEFORE (n)

Disable or enable automatic commands prior a device I/O command (see the commands marked with the symbol [AUTO]). These commands do not change the automatic commands that are selected.

For BEFORE (n), a zero value is the same as OFf and a non zero value is the same as ON.

Warning: See "Variables that look like keywords" above.

The default is BEFORE ON.

Also see:  AFTERx EXPEcterror


BEFORE [+]command [-]command ...
BEFORE NONE

Valid commands are: SHOWPC, Dump, SHOWCH, SHOWLL, SHOWCB, CLear, RS, RESet and FILLx. NONE disables all commands.

When enabled the commands are executed in the order shown.

Select automatic commands executed prior to a device I/O command (see the commands marked with the symbol [AUTO]).

Dump displays only the first sector/block in the I/O buffer.

FILLx is performed only before write commands (DPW, DW, PDO, PW, W, W10 and W12).

If the automatic command name is prefixed with '+' (for example +Dump), that automatic command is enabled. If the automatic command name is prefixed with '-' (for example, -Dump), that automatic command is disabled.

Also see:  AFTERx EXPEcterror

(Go To TOC)

[ BEGINSub ]


BEGINSub subName [type]

[FULL] [SCRIPT]

Define the beginning of a script file subroutine.

subName is the name of the subroutine and type is either PRIVate or PUBlic. If type is omitted, type defaults to PUBlic.

PRIVate subroutines can be called only by using a CAll, ONERRor or ONESCkey command within a script file. PUBlic subroutines can be called by a CAll or ONERRor command within a script file and can also be called by entering a CAll command from the keyboard.

Subroutine names can be the same as AHCDEMO commands. See the CAll command for an explanation of how a subroutine can replace an AHCDEMO command.

Warning: Be careful when selecting subroutine names. Any AHCDEMO command, including commands like QUit and Exit, can be replaced by a PUBlic subroutine of the same name.

Also see:  CAll ONERRor ONESCkey

(Go To TOC)

[ BIST ]


BIST dw0 dw1 dw2

[DIO] [FULL]

Send a H2D Start BIST FIS to the device.

dw0 is the data for the first word of the H2D FIS. This value should contain 0x58 in the lowest 8 bits.

dw1 and dw2 are the two data words in the H2D FIS.

This command sets up the H2D FIS and sends it to the device. The AHCI PxSERR register, accessed by using the px_serr built-in variable, can be monitored for any errors.

BIST operations on the SATA interface continue until the host execute COMReset.

The following examnple shows how to use the BIST command.


   // start clean
   comreset
   // start BIST with T=1 and P=1 and 0xBC data
   BIST 0x00840058 0xbcbcbcbc 0xbcbcbcbc
   // go for 10 seconds
   endtime = ( run_time + 10 )
   while ( run_time <= endtime )
      // check for error every 10 milliseconds
      delay ms 10
      if ( px_serr )
         // report error
         say ! PxSERR = 0x{*8px_serr}
      endif
   endwhile
   // stop BIST
   comreset

(Go To TOC)

[ BLOCKSIZE ]


BLOCKSIZE

Display the sector/block size for the currently selected device.


BLOCKSIZE n

Specify the size in bytes of sectors/blocks for the currently selected device.

The default for an ATA device is 512. The sector/block size of an ATA device can be an even number between 512 and 32768. The ID command will set the sector/block size of an ATA device using IDENTIFY data words 106 and 117-118.

The default for an ATAPI device is 2048. The sector/block size of an ATAPI device can be 1 to 32768. The ID and RCAp commands will set the sector/block size.

The device sector/block size must be set before using the commands COMPx or FILLx are used and before any media access commands are used (such as R, W, R10, W10, etc). Note that for RCD commands BLOCKSIZE 2352 should be used.

This sector/blocksize does not affect the size of sectors/blocks transferred by non-media access commands (such as ID).

Note: To use sector tagging n must be equal to or greater than 512 - see the TAG comand.

Also see:  COMPx DEVice FILLx ID RCAp RCD R10 R12 TAG W10 W12

(Go To TOC)

[ BReak ]


BReak

[FULL] [SCRIPT]

Exit from the current WHILE loop.

(Go To TOC)

[ CAll ]


CAll subName [ n1 n2 n3 n4 n5 n6 n7 n8 n9 ]
subName [ n1 n2 n3 n4 n5 n6 n7 n8 n9 ]

[FULL]

Call a script file subroutine and optionally pass one to nine parameters to the subroutine.

The values n1, n2, ..., n9 are assigned to the built-in variables sub_param1, sub_param2, ..., sub_param9 when the subroutine is entered. Any missing parameter values are set to 0.

The first format of the CAll command must be used within script files. The second format of the CAll command is not valid within a script file.

The first or second formats can be used from the keyboard to call PUBlic subroutines that were defined by the currently loaded script file. The second format makes the a PUBlic subroutine appear to be an AHCDEMO command.

Warning: Be careful when selecting subroutine names. Any AHCDEMO command, including commands like QUit and Exit, can be replaced by a PUBlic subroutine of the same name.

Also see:  BEGINSub ENDSub DUMPSub SCRipt

(Go To TOC)

[ CFIS ]


CFIS
CFIS SIZE n
CFIS ICC n
CFIS DW4 n

Create a non-standard SATA Command FIS (CFIS) when the next device I/O command is issued. The CFIS command affects only the next device I/O command.

SIZE n changes the number of double words in the next CFIS - n is 1 to 16 (4 to 64 bytes). The default is 5 (20 bytes).

ICC n changes the value in the CFIS ICC byte - n is 0 to 255. The default is 0.

DW4 n changes the value in CFIS double word 4 and any additional words beyond double word 4 - n is 0 to 0xffffffff. The default is 0.

(Go To TOC)

[ CHKBUF ]


CHKBUF sectorOffset byteOffset andMask op n ...

[AUTO] [FULL]

The value of a buffer byte is AND'ed with the value andMask and the result is compared to the value n using compare operator op. If the result is false, the CHKBUF command ends with an error. byteOffset is incremented by one and the next buffer byte is compared to the next n value.

sectorOffset is 0 to one less than the maximum number of sectors that fit into the buffer.

byteOffset is 0 to one less than the size of a sector.

andMask must be a value in the range 0 to 255.

op must be ==, !=, <, <=, <, <=.

n must be a value in the range 0 to 255.

Also see:  CHKREG ID ONERRor RCAp

Example:


   chkbuf 0 0 ffh == 80h 40h 20h 10h

   This example checks the first four bytes of the buffer.

(Go To TOC)

[ CHKREG ]


CHKREG reg andMask op n

[AUTO] [FULL]

The contents of register reg is AND'ed with the value andMask and the result is compared to the value n using compare operator op. If the result is false, the CHKREG command ends with an error.

regName must be AS, CH, CL, DH, ER, SC, SN or ST.

andMask must be a value in the range 0 to 255.

op must be ==, !=, <, <=, <, <=.

n must be a value in the range 0 to 255.

Note: AHCIDRVR reads all of the registers at the end of every command or reset. The SHOWCB command can be used to force a read of the registers.

Also see:  CHKBUF ONERRor

Example:


   chkreg sc ffh <= 80h

   This example checks the Sector Count register for the
   value less than or equal to 80H.

(Go To TOC)

[ CHKSUM ]


CHKSUM

The CHKSUM command computes the standard ATA check sum over the first 512 bytes of the data buffer and reports the result. The CHKSUM command will end with an error if the check sum is not 00H. In a script file use the EXPECTERRor command to ignore this error, see the examples below.

CHKSUM also computes (over the first 511 bytes of the data buffer) the value that should be placed into offset 511 of the buffer to make the check sum equal to 00H. This value is placed into the variable chk_sum.

Example 1:


   fillrand
   expecterror
   chksum               // should get an error
   store 0 511 chk_sum  // fix check sum
   chksum               // should not get an error

Example 2:


   pdi 0xb1 0xc2 1 0    // execute a DCO ID command
   store 0 14 0xf8      // DCO disable SMART
   expecterror          // expect error
   chksum               // check/compute check sum
   store 0 511 chk_sum  // update check sum in buffer
   chksum               // verify check sum is now 00H
   pdo 0xb1 0xc3 1 0    // execute a DCO SET command

Also see:  chk_sum DCO

(Go To TOC)

[ CHS ]


CHS

Switch to CHS sector addressing. This is the default sector addressing mode.

Also see:  LBA

(Go To TOC)

[ CHSConv ]


CHSConv lba
CHSConv cyl head sect

[FULL]

Convert an LBA to a CHS -or- convert a CHS to an LBA. The conversion uses the current CHSIncr setting for the number of cylinders, heads and sectors.

The input and results of this command are available in the reg_chs_c, reg_chs_h, reg_chs_s and reg_lba built-in variables.

Also see:  CHSIncr reg_*

(Go To TOC)

[ CHSIncr ]


CHSIncr

[FULL]

Display the current CHSIncr settings.

The CHSIncr command uses the following terms. Some of these values can be read using built-in variables.

curCHS is the CHS used in the current command, see the io_lbalo and io_lbahi built-in variables. In the LBAIncr command this value is equivalent to the curLBA value.

baseCHS is the CHS specified by the AHCDEMO command being repeated. In the LBAIncr command this value is equivalent to the baseLBA value.

numCyl is the number of cylinders in the current CHS geometry, (max_cyl + 1).

numHead is the number of heads in the current CHS geometry (max_head + 1).

numSect is the number of sectors in the current CHS geometry (max_sect).

numCHS is the number of sectors in the current CHS geometry or (numCyl * numHead * numSect ). In the LBAIncr command this value is equivalent to the numLBA value.

incrCHS is the current CHS increment. In the LBAIncr command this value is equivalent to the incrLBA value.

sectCnt is the number of sectors that the current command will attempt to transfer.

The ID command will set max_cyl (numCyl-1), max_head (numHead-1), max_sect (numSect) and numCHS to the values in ATA Identify data words 54-56 (or if words 54-56 are not valid, to words 1, 3 and 6). Remember that cylinders are numbered from 0 to max_cyl, heads are numbered 0 to (max_head) and sectors are numbered from 1 to max_sect. CHSIncr can be used to override the values set by ID.

Also see:  ID LBAIncr RCAp REPeat

Examples: See "Using CHSIncr, LBAIncr and REPeat Commands" below.


CHSIncr TL [numCyl numHead numSect]
CHSIncr n [numCyl numHead numSect]
CHSIncr -TL [numCyl numHead numSect]
CHSIncr -n [numCyl numHead numSect]
CHSIncr Random [numCyl numHead numSect]

These CHSIncr commands are used with the REPeat command.

These CHSIncr commands operate the same as the LBAIncr commands but using CHS sector addresses instead of LBA sector addresses. See the LBAIncr command for a complete description.

The default is


   CHSIncr 0 1024 16 63

so that CHS addresses are not incremented by the REPeat command until either an ID or CHSIncr command is executed.

Examples: See "Using CHSIncr, LBAIncr and REPeat Commands" below.

Warning: See "Variables that look like keywords" above.

Also see:  ID LBAIncr RCAp REPeat

(Go To TOC)

[ Clear ]


Clear

Clear the command history and low level trace buffers.

Also see:  SHOWx

(Go To TOC)

[ CMDTime ]


CMDTime

[FULL]

Displays the current settings for the command timing facility.


CMDTime CONFIG

[FULL]

Configure the timers used by the command timing facility. Several seconds may be required to complete the configuration. The command timing facility is configured during AHCDEMO start-up. Use this command only if the configuration failed during AHCDEMO start-up.

Also see:  cmdt_*


CMDTime OFf
CMDTime ON
CMDTime (n)

[FULL]

Turn command timing on and off.

The command timing facility keeps four numbers: the number of commands executed, the total time required to perform those commands, the average command time, the minimum command time and the highest command time. The times do not include any AHCDEMO command processing overhead (it does include all of the AHCIDRVR processing time). The execution time of all commands is counted, even comands that end with I/O errors and commands that fail due to an AHCIDRVR time out.

If an array named "cmdt" is defined then the individual command time are also stored into that array. The cmdt array must be the first array defined and it must be defined as "AVNEW CMDT DOWRD n" where n is the size of the array. See example below. If the array size is less than the number of commands executed then only the first n times are stored into the array.

CMDTime ON resets the number of command counter and the time values and enables command timing. Command timing remains in effect until a CMDTime OFf comand is executed.

CMDTime OFf displays the command time information and disables command timing.

For CMDTime (n), a zero value is the same as OFf and a non zero value is the same as ON.

Warning: See "Variables that look like keywords" above.

Also see the CMDT_* built-in variables.

Example 1: Measure the times for 1000 random single sector read commands.


   lbaincr random
   cmdtime on
   repeat 1000 r 1 0
   cmdtime off

Example 2: Same as above but also store times into cmdt array.


   avdelete
   avnew cmdt dword 1000
   lbaincr random
   cmdtime on
   repeat 1000 r 1 0
   cmdtime off
   avfetch time1 cmdt 0   // fetch first command time value
   avfesth time2 cmdt 999 // fetch last command time value

Also see:  AVCLEAR AVDELETE AVFETCH AVNEW AVSTORE

(Go To TOC)

[ COMPare ]


COMPare numBytes sectorOffset1 byteOffset1 sectorOffset2 byteOffset2

Compare data at one location in the buffer to another location in the buffer.

numBytes is the number of bytes to compare. numBytes is 0 to the current buffer size.

sectorOffset1 is 0 to one less than the maximum number of sectors that fit into the buffer.

byteOffset1 is 0 to one less than the size of a sector.

sectorOffset2 is 0 to two less than the maximum number of sectors that fit into the buffer.

byteOffset2 is 0 to one less than the size of a sector.

If there is a miscompare, only the first byte that does not compare is displayed.

See the io_result built-in variable.


   onerror cont
   compare 10 0 0 1 0
   if io_result
      say "! Compare Error !"
   endif
   onerror quit

Also see:  BLOCKSIZE COPY ID RCAp

(Go To TOC)

[ COMPx ]

General information for the COMPx commands.

The COMPx commands check the data in the I/O buffer. All data compare is based on the current BLOCKSIZE for the device.

There are three ways to use the COMPx commands:

The best way to perform data compare on data read into the I/O buffer is to use the AFTERNOerror command with the COMPx command. When used with the AFTERNOerror command the COMPx command will compare the data read by a read data I/O command as part of the execution of the read data I/O command.

If used without the 'n' parameter, a COMPx command will compare the data in the I/O buffer if the last device command read data into the I/O buffer.

A 'COMPx n' command forces data compare for the first n sectors in the I/O buffer.

The COMPx commands change the value of the io_result built-in variable.

See COMPIncr, COMPOne, COMPPat, COMPRand, COMPStart, COMPTag, COMPWord and COMPZero below. Also see the FILLx commands (and the examples in the FILLx general description).

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG

Some examples of COMPx commands...

Example 1: These commands show the 'normal' use of the COMPx (and FILLx) commands:


   BEFORE FILLRand         // fill buffer before write
   AFTERNOerror COMPRand   // compare data after read
   W 1 0                   // write a sector
   R 1 0                   // read a sector

Example 2: This is equivalent to example 1.


   FILLRand          // fill buffer
   W 1 0             // write a sector
   R 1 0             // read a sector
   COMPRand          // compare the data

Example 3: Will not compare data because AHCDEMO knows that ID, INQ, RCAP, RS, RTOC commands transfer 'special' data that would not compare.


      AFTERNOerror COMPZero
      ID

Example 4: This would most likely generate a data compare error because it is unlikely a device would have Identify data that was 00H in each byte.


      ID
      COMPZero 1

(Go To TOC)

[ COMPIncr ]


COMPIncr [n]

[AUTO]

See the general description of the COMPx commands above.

Compare sectors in the buffer with the incrementing byte pattern (00H, 01H, 02H, ..., FFH, 00H, ...). The last I/O command executed is used to determine the number of sectors and the size of each sector.

If TAG is ON the sector tag data will also be verified.

Specify n (1 to current number of sectors/blocks in the I/O buffer) to force data compare even if the last device I/O command was not a read command.

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG

(Go To TOC)

[ COMPOne ]


COMPOne [n]

[AUTO]

See the general description of the COMPx commands above.

Compare sectors in the buffer with FFH bytes. The last I/O command executed is used to determine the number of sectors and the size of each sector.

If TAG is ON the sector tag data will also be verified.

Specify n (1 to current number of sectors/blocks in the I/O buffer) to force data compare even if the last device I/O command was not a read command.

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG

(Go To TOC)

[ COMPPat ]


COMPPat [n]

[AUTO]

See the general description of the COMPx commands above.

Compare sectors in the buffer with the current pattern specified by the FILLPat command. The last I/O command executed is used to determine the number of sectors and the size of each sector.

If TAG is ON the sector tag data will also be verified.

Specify n (1 to current number of sectors/blocks in the I/O buffer) to force data compare even if the last device I/O command was not a read command.

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG

(Go To TOC)

[ COMPRand ]


COMPRand [n]

[AUTO]

See the general description of the COMPx commands above.

Compare sectors in the buffer with a random data pattern. See the FILLRand command. The first 4 bytes of the sector are used as the expected data pattern. The last I/O command executed is used to determine the number of sectors and the size of each sector.

If TAG is ON the sector tag data will also be verified.

Specify n (1 to current number of sectors/blocks in the I/O buffer) to force data compare even if the last device I/O command was not a read command.

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG

(Go To TOC)

[ COMPStart ]


COMPStart [n]

[AUTO]

See the general description of the COMPx commands above.

Compare sectors in the buffer with the Run ID (a 4 byte value). The last I/O command executed is used to determine the number of sectors and the size of each sector.

If TAG is ON the sector tag data will also be verified.

Specify n (1 to current number of sectors/blocks in the I/O buffer) to force data compare even if the last device I/O command was not a read command.

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG

(Go To TOC)

[ COMPTag ]


COMPTag [n]

[AUTO]

See the general description of the COMPx commands above.

Compare only the sector tag data of the sectors in the buffer.

Specify n (1 to current number of sectors/blocks in the I/O buffer) to force data compare even if the last device I/O command was not a read command.

Also see:  AFTERx BEFORE BLOCKSIZE COMPx DUMPCt DUMPTag FILLx POP PUSH TAG

(Go To TOC)

[ COMPWord ]


COMPWord [n]

[AUTO]

See the general description of the COMPx commands above.

Compare sectors in the buffer with the incrementing word pattern (0000H, 0001H, ..., FFFFH, 0000H, ...). The last I/O command executed is used to determine the number of sectors and the size of each sector.

If TAG is ON the sector tag data will also be verified.

Specify n (1 to current number of sectors/blocks in the I/O buffer) to force data compare even if the last device I/O command was not a read command.

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG

(Go To TOC)

[ COMPZero ]


COMPZero [n]

[AUTO]

See the general description of the COMPx commands above.

Compare sectors in the buffer with 00H bytes. The last I/O command executed is used to determine the number of sectors and the size of each sector.

If TAG is ON the sector tag data will also be verified.

Specify n (1 to current number of sectors/blocks in the I/O buffer) to force data compare even if the last device I/O command was not a read command.

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG

(Go To TOC)

[ COMReset ]


COMReset

Execute COMRESET. Same as 'RESet COMReset'.

Also see:  RESet

(Go To TOC)

[ COntinue ]


COntinue

[FULL] [SCRIPT]

Skip the remainder of the current WHILE loop and continue execution at the top of the WHILE.

(Go To TOC)

[ COPY ]


COPY numBytes frSectorOffset frByteOffset toSectorOffset toByteOffset

Copy data from one location in the buffer to another location in the buffer. An overlapping copy gives an undefined result.

numBytes is the number of bytes to copy. numBytes is 0 to the current buffer size.

frSectorOffset is 0 to one less than the maximum number of sectors that fit into the buffer.

frByteOffset is 0 to one less than the size of a sector.

toSectorOffset is 0 to two less than the maximum number of sectors that fit into the buffer.

toByteOffset is 0 to one less than the size of a sector.

Also see:  BLOCKSIZE COMPare ID RCAp

(Go To TOC)

[ COPYBYtes ]


COPYBYtes n1 n2 n3 n4 frVarName toVarName

[FULL]

Creates or updates a user defined variable by copying 1 to 4 bytes from frVarName into toVarName.

The resulting value in toVarName is:


   bits 63-32 are set to 0
   bits 31-24 are set to byte n1 of frVarName
   bits 23-16 are set to byte n2 of frVarName
   bits 15- 8 are set to byte n3 of frVarName
   bits  7- 0 are set to byte n4 of frVarName

If an n1 to n4 value is zero then zero is copied into the byte position of toVarName.

The bytes in frVarName are numbered as follows:


   5 = bits 63-56 (the most significant byte)
   6 = bits 55-48
   7 = bits 47-40
   8 = bits 39-32
   1 = bits 31-24
   2 = bits 23-16
   3 = bits 15- 8
   4 = bits  7- 0 (the least significant byte)

Examples:


   // bytes 5 6 7 8 1 2 3 4
   set x = 11223344aabbccddH

   // copy least significant 4 bytes
   copybytes 1 2 3 4 x y
      // sets y = 00000000aabbccddH

   // byte swap 32-bit number
   set y = 11223344aabbccddH
   copybytes 4 3 2 1 x y
      // sets y = 00000000ddccbbaaH

   // copy 2 bytes
   copybytes 2 1 0 0 x y
      // sets y = 00000000bbaa0000H

   // copy 2 bytes
   copybytes 7 0 8 0 x y
      // sets y = 0000000033004400H

   // byte swap a 64-bit number
   copybytes 4 3 2 1 x temp1
      // sets temp1 = 00000000ddccbbaaH
   copybytes 8 7 6 5 x temp2
      // sets temp2 = 0000000044332211H
   y = ( ( temp1 << 32 ) | temp2 )
      // sets y = ddccbbaa44332211H

(Go To TOC)

[ COPYRFIS ]


COPYRFIS

Copy the AHCI Received FIS data area to the I/O buffer. The Received FIS data area is 256 bytes:

This command will replace the data in the first 256 bytes of the first sector in the I/O buffer.

This data can be fetched from the I/O buffer using the FETCHBUF command, for example the D2H Register FIS can be fetched using these commands:


   fetchbuf dw0 0 64 4 LE   // 1st DWORD
   fetchbuf dw1 0 68 4 LE   // 2nd DWORD
   fetchbuf dw2 0 72 4 LE   // 3rd DWORD
   fetchbuf dw3 0 76 4 LE   // 4th DWORD
   fetchbuf dw4 0 80 4 LE   // 5th DWORD

Note that the first DWORD of each Received FIS data area is set to the value DEADDEADH before every I/O command. This can be used to determine if the FIS data area was used by a command.

Also see:  FETCHBUF

(Go To TOC)

[ DAR ]


DAR command feature sectorCount lba
DAR command feature sectorCount cyl head sect

[AUTO] [DIO] [REP]

Execute an ATA DMA In command in CHS or LBA mode.

Data compare is limited when a DAR command uses a sectorCount greater that the size of the AHCDEMO I/O buffer - see the COMPx and TAG commands.

Also see:  CHSIncr DAW DR DW LBAIncr REPeat

(Go To TOC)

[ DAW ]


DAW command feature sectorCount lba
DAW command feature sectorCount cyl head sect

[AUTO] [DIO] [FULL] [REP]

Execute an ATA DMA Out command in CHS or LBA mode.

Data generation is limited when a DAW command uses a sectorCount greater that the size of the AHCDEMO I/O buffer - see the FILLx and TAG commands.

Also see:  CHSIncr DAR DR DW LBAIncr REPeat

(Go To TOC)

[ DCO ]


DCO
DCO IDentify [NOSHOW]
DCO REStore
DCO SET

A DCO command with no parameters displays help information for the Device Configuration Overlay commands.

The IDentify parameter sxecutes a Device Configuration Overlay Identify command command and display the DCO Identify data. The DCO IDentify command is equivalent to


   LBA28
   PDI 0xb1 0xc2 1 0

If the DCO IDentify command is repeated the DCO Idenitfy data is displayed only on the first repeat of the command. NOSHOW suppresses the display of the DCO data.

The REStore parameter sxecutes a Device Configuration Overlay Restore command command. The DCO REStore command is equivalent to


   LBA28
   ND 0xb1 0xc0 0 0

The SET parameter sxecutes a Device Configuration Overlay Set command command. The DCO SET command is equivalent to


   LBA28
   PDO 0xb1 0xc3 1 0

An example using DCO to disable SMART:


   dco IDentify         // execute a DCO ID command
   store 0 14 0xf8      // DCO disable SMART
   expecterror          // expect error
   chksum               // check/compute check sum
   store 0 511 chk_sum  // update check sum in buffer
   chksum               // verify check sum is now 00H
   dco set              // execute a DCO SET command

Also see:  CHKSUM RNME SHOWDCo

(Go To TOC)

[ DECR ]


DECR varName [n]

[FULL]

If not specified, n defaults to 1.

If varName exists then this command is equivalent to


   SET varName = ( varName - n )

If varName does not exist then this commands is equivalent to


   SET varName = ( 0 - n )

Also see:  LOCAL SET

(Go To TOC)

[ DELAY ]


DELAY

Display the last delay times used.


DELAY n

Set the big delay time to n seconds and perform that delay. n is in seconds and may be a value from 0 to 600 (10 minutes).

Note: Use 'DELAY *' to use the previously set big delay time.

Warning: See "Variables that look like keywords" above.


DELAY MS n

Set the small delay time to n milliseconds and perform that delay. n is in milliseconds and may be a value from 0 to 10000 (10 seconds).

Note: Use 'DELAY MS *' to use the previously set small delay time.

Warning: See "Variables that look like keywords" above.


DELAY US n

Set the tiny delay time to n microseconds and perform that delay. n is in microseconds and may be a value from 0 to 10000 (10 milliseconds).

Note: Use 'DELAY US *' to use the previously set small delay time.

Warning: See "Variables that look like keywords" above.

(Go To TOC)

[ DEVice ]


DEVice

Display the type (none, unknown, ATA or ATAPI ) of the device in use.


DEVice ATA
DEVice ATAPI

Change the type of the device in use to either ATA or ATAPI. The following changes are allowed:

Use this command when AHCIDRVR and AHCDEMO have been able to find a device but were not able to determine the device type or incorrectly determined the device type. This command should be followed by an ID or RCAp command.

Warning: See "Variables that look like keywords" above.


DEVice n

Change the type of the device in use to either ATA (n=2) or ATAPI (n=3). The following changes are allowed:

Use this command when AHCIDRVR and AHCDEMO have been able to find a device but were not able to determine the device type or incorrectly determined the device type. This command should be followed by an ID or RCAp command.

(Go To TOC)

[ DEVINIT ]


DEVINIT

Set AHCDEMO defaults for the current device - includes device type and sector (block) size.

(Go To TOC)

[ DEVRESet ]


DEVRESet

[AUTO] [DIO] [REP]

Execute a Device Reset command (command code 08H). This is an ATA Non-Data command. It is normally only supported by ATAPI devices.

This command is equivalent to the command


   ND 08H 0 0 0      ; lba
   ND 08H 0 0 0 0 0  ; chs

(Go To TOC)

[ DLMCx ]

Execute a DownLoad MicroCode command in DMA or PIO mode.

See DLMCDMA and DLMCPIO below.

(Go To TOC)

[ DLMCDMA ]


DLMCDMA feature blockCount bufferOffset

feature is the Feature register value - 0 to 255.

blockCount is the number of 512-byte blocks to transfer - 0 to 65535.

bufferOffsect is the byte microcode buffer offset - 0 to 65535.

Also see:  DLMCPIO

(Go To TOC)

[ DLMCPIO ]


DLMCPIO feature blockCount bufferOffset

feature is the Feature register value - 0 to 255.

blockCount is the number of 512-byte blocks to transfer - 0 to 65535.

bufferOffsect is the byte microcode buffer offset - 0 to 65535.

Also see:  DLMCDMA

(Go To TOC)

[ DMA ]


DMA
DMA OFf
DMA ON
DMA (n)

This command changes the way the R, RCD, R10, R12, W, W10 and W12 commands operate.

If DMA is ON, the R and W commands execute an ATA Read DMA or ATA Write DMA command and the RCD, R10, R12, W10 and W12 commands execute an ATAPI read/write data transfer in DMA mode.

If DMA is OFf, the R and W commands execute an ATA Read Sectors, Read Multiple, Write Sectors or Write Multiple command and the RCD, R10, R12, W10 and W12 commands execute an ATAPI read/write data transfer in PIO mode.

For DMA (n), a zero value is the same as OFf and a non zero value is the same as ON.

Warning: See "Variables that look like keywords" above.

The DMA command without a parameter displays the current DMA setting.

Also see:  DMA R RCD R10 R12 W W10 W12

(Go To TOC)

[ DOS ]


DOS COPy frFileSpec toFileSpec
DOS DELete fileSpec
DOS DIR [fileSpec]
DOS REName fileSpec newFileSpec

[FULL]

Execute DOS file copy, delete, directory listing or file rename operations.

Note: Wildcard file specifications valid only with 'DOS DIR'.

For 'DOS DIR' if fileSpec is not specified the default is '*.*'.

(Go To TOC)

[ DPR ]


DPR dmabc cdb0 cdb1 ... cdbn [etl]

[AUTO] [DIO] [REP]

Execute an ATAPI Packet command that reads data from the device. The data transfer will be done in DMA mode (the Features register is set to 01H before the Packet command is started).

dmabc is the amount of data that the device should transfer up to 33Mbytes (65536*512 bytes). The DMA channel is programmed to transfer this amount of data. Data compare is bypassed when dmabc is larger than the AHCDEMO I/O buffer - see the COMPx commands.

etl is the expect data transfer length. If etl is omitted there is no check of the data transfer length.

cdb0, cdb1, ... cdbn is the command packet.

This command forces LBA32 sector/block addressing mode.

If this command is repeated and cdb0 is 28H (Read 10), A8H (Read 12) or BEH (Read CD) the LBA will be updated by the LBAIncr command. The LBA is also updated for a 08H (Read) command (but the LBA does not appear in the CDB for this command). See the 'LBA SET n' command for more information.

Also see:  ATAPIRegs LBA LBAIncr REPeat

(Go To TOC)

[ DPW ]


DPW dmabc cdb0 cdb1 ... cdbn [etl]

[AUTO] [DIO] [FULL] [REP]

Execute an ATAPI Packet command that writes data to the device. The data transfer will be done in DMA mode (the Features register is set to 01H before the Packet command is started).

dmabc is the amount of data that the device should transfer up to 33Mbytes (65536*512 bytes). The DMA channel is programmed to transfer this amount of data. Data generation is limited when dmabc is larger than the AHCDEMO I/O buffer - see the FILLx commands.

etl is the expect data transfer length. If etl is omitted there is no check of the data transfer length.

cdb0, cdb1, ... cdbn is the command packet.

This command forces LBA32 sector/block addressing mode.

If this command is repeated and cdb0 is 2AH (Write 10) or AAH (Write 12) the LBA will be updated by the LBAIncr command. The LBA is also updated for a 0AH (Write) command (but the LBA does not appear in the CDB for this command). See the 'LBA SET n' command for more information.

Also see:  ATAPIRegs LBA LBAIncr REPeat

(Go To TOC)

[ DR ]


DR feature sectorCount lba
DR feature sectorCount cyl head sect

[AUTO] [DIO] [REP]

Execute an ATA Read DMA command (command code C8H) in CHS or LBA mode.

Data compare is limited when a DR command uses a sectorCount greater that the size of the AHCDEMO I/O buffer - see the COMPx and TAG commands.

DR is equivalnt to one of these commands:


      DAR C8H x x x       // lba28
      DAR 25H x x x       // lba48
      DAR C8H x x x x x   // chs

Also see:  CHSIncr DAR DAW DW LBAIncr REPeat

(Go To TOC)

[ DTO ]


DTO
DTO n

Display or change the current low level driver time out. The time out can be set to 2 to 60000 seconds. The default is 20 seconds.

The current time out value can be read from the dev_dto variable.

Also see:  dev_*

(Go To TOC)

[ DUMPx ]

See Dump, DUMPAv, DUMPCt, DUMPId, DUMPSub and DUMPTag below.

(Go To TOC)

[ Dump ]


Dump DEC
Dump HEX
Dump sectorOffset [ byteOffset [ numBytes ] ]
Dump

Dump data from the I/O buffer.

DEC and HEX select the format of the sector and byte offsets in the Dump and SHOW output, either decimal or hexadecimal. The default is HEX.

sectorOffset is 0 to one less than the maximum number of sectors/blocks that fit into the I/O buffer. The default is 0, or following a data compare error the default is the first incorrect sector/block.

byteOffset is 0 to one less than the size of a sector/blocks. The default is 0.

numBytes is the number of bytes to dump. The default is the currect block size for the selected device, or following some I/O commands (such as RCAP, RS, RTOC, etc) it is the number of bytes transferred by the I/O command.

The dump command increments the byteOffset and the sectorOffset as needed. A Dump (or Next) command with no parameters will continue to dump the next data in the I/O buffer.

Also see:  BLOCKSIZE Dump ID Next RCAp

(Go To TOC)

[ DUMPAv ]


DUMPAv arrayName index number

Dump information and data values for 'arrayName' starting at 'index' for a maximum of 'number' values.

(Go To TOC)

[ DUMPCt ]


DUMPCt

Dump the ATACT/ATAMDT sector tag data for sectors in the buffer. The ATACT/ATAMDT LBA and last write command tag information is dumped. See the ATACT and/or ATAMDT User Guide.

Note: ATACT, AHCDEMO and ATAMDT place the LBA part of the sector tag data at the same offset in a sector. This command (used with AFTERNOerror) can be used with read data commands to scan a disk that was written by AHCDEMO, ATACT or ATAMDT to look for sectors with incorrect tag data.

Also see:  DUMPTag, TAG.

(Go To TOC)

[ DUMPId ]


DUMPId

Dumps the first 512 bytes of the buffer as 256 words. Each word is display as a 16-bit value (bits 15-0). Words that contain 32-bit values are also displayed together as 32-bit values (bits 31-0).

This command does not check that the buffer contains data read by an Identify command so it may be useful to display other data that is organized as words.

Also see:  DUMPx ID SHOWx

(Go To TOC)

[ DUMPSub ]


DUMPSub

[FULL]

Displays the currently defined subroutine names and the type of each.

Also see:  BEGINSub ENDSub CAll

(Go To TOC)

[ DUMPTag ]


DUMPTag

Dumps only the tag data for each sector/block in the buffer.

Note: ATACT, AHCDEMO and ATAMDT place the LBA part of the sector tag data at the same offset in a sector. This command (used with AFTERNOerror) can be used with read data commands to scan a disk that was written by AHCDEMO, ATACT or ATAMDT to look for sectors with incorrect tag data.

Also see:  DUMPCt, TAG

(Go To TOC)

[ DUMPVar ]


DUMPVar [varName ...]

[FULL]

Display builtin and user defined variable names and the current values.

If varName is the single character * all user defined global variables are displayed, including any that may be currently hidden by a local variable with the same name, and the currently active user defined local variables are displayed.

Examples:


   dumpv             ; display all built-in and all user
   dumpv pci_bus *   ; display one built-in and all user
   dumpv *           ; display all user

Also see:  SET SAYx

(Go To TOC)

[ DW ]


DW feature sectorCount lba
DW feature sectorCount cyl head sect

[AUTO] [DIO] [FULL] [REP]

Execute an ATA Write DMA command (command code CAH) in CHS or LBA mode.

Data generation is limited when a DW command uses a sectorCount greater that the size of the AHCDEMO I/O buffer - see the FILLx and TAG commands.

DW is equivalnt to one of these commands:


      DAW CAH x x x       // lba28
      DAW 35H x x x       // lba48
      DAW CAH x x x x x   // chs

Also see:  CHSIncr DAR DAW DR LBAIncr REPeat

(Go To TOC)

[ DWFUA ]


DWFUA feature sectorCount lba

[AUTO] [DIO] [FULL] [REP]

Execute an ATA WRITE DMA FUA EXT command (command code 3DH).

Data generation is limited when a DW command uses a sectorCount greater that the size of the AHCDEMO I/O buffer - see the FILLx and TAG commands.

Also see:  LBAIncr REPeat

(Go To TOC)

[ ECHO ]


ECHO
ECHO OFf
ECHO ON
ECHO (n)

Turn logging of the prompt messages and command lines during script file execution on and off. These messages begin with a '?' or '#' character.

For ECHO (n), a zero value is the same as OFf and a non zero value is the same as ON.

ECHO ON is equivalent to using these two commands:


   LOG SML K *

ECHO OFF is equivalent to using these two commands:


   LOG SML -K *

Warning: See "Variables that look like keywords" above.

Also see:  LOG

(Go To TOC)

[ EDITx ]

These commands invode the AHCDEMO editor. See the EDIT, EDITKB, and EDITSF commands below.

The AHCDEMO editor is also available as a stand alone program named AEDIT. See the AEDIT User Guide (AEDIT.HTM).

Also see:  Editor EDIT EDITKB EDITSF

(Go To TOC)

[ EDIT ]


EDIT
EDIT [fileName]

Same as the EDITSF command below.

Also see:  Editor EDITSF

(Go To TOC)

[ EDITKB ]


EDITKB
EDITKB [fileName]

Start the editor and read the Keyboard Buffer data into the editor's buffer. If fileName is not specified the file name defaults to 'KBbuffer.DSF'.

Also see:  Editor

(Go To TOC)

[ EDITSF ]


EDITSF
EDITSF [fileName]

Start the editor to edit a file. If fileName is not specified the file name defaults to 'default.DSF'. The file is read into the editor's buffer.

Also see:  Editor EDIT

(Go To TOC)

[ EE ]


EE n

[FULL]

Evaluate expression n and display the result in decimal and hex. This command is an easy way to display the value of a variable or expression.


   x = 31
   ee x     // displays '31 (1FH)'
   ee (x+1) // displays '32 (20H)'

(Go To TOC)

[ ELSE ]


ELSE

[FULL] [SCRIPT]

Defines the beginning of the else part of an IF/ELSE/ENDIF command sequence. The ELSE part of this command sequence is optional.

(Go To TOC)

[ ENDIF ]


ENDIF

[FULL] [SCRIPT]

Defines the end of a IF/ELSE/ENDIF command sequence. The ELSE part of this command sequence is optional.

Also see:  IF ELSE

Also see:  IF ENDIF

(Go To TOC)

[ ENDSub ]


ENDSub [subName]

[FULL] [SCRIPT]

Defines the end of a script file subroutine. If the execution of a script reaches an ENDSUB command the ENDSUB command is equivalent to a "RETURN 0" command.

Also see:  RETurn

(Go To TOC)

[ ENDWHile ]


ENDWHile

[FULL] [SCRIPT]

Defines the end of a WHILE loop.

(Go To TOC)

[ EXit ]


EXit [n]

This command terminates AHCDEMO.

The optional parameter n sets the DOS ERRORLEVEL when AHCDEMO exits. The allowed values are 0 to 199 (200 to 255 are reserved for use by AHCDEMO). The default for n is zero.

Also see:  QUit

(Go To TOC)

[ EXPEcterror ]


EXPEcterror
EXPEcterror ABRT
EXPEcterror IDNF
EXPEcterror UNC

The next ATA or ATAPI command is expected to end with an I/O error. When repeating an I/O command each repeated command is expected to end with an error.

EXPEcterror is reset at the end a single command or at the end of the repeat loop for repeated commands.

If ABRT, IDNF or UNC is specified then only that error type is expected. Any other error type is reported as an error.

EXPEcterror does not apply to

See ONERRor for more information about the interaction of EXPEcterror and ONERRor commands.

FPQGO and FPQGOT do not use EXPEcterror.

Also see:  AFTERx exp_err io_* ONERRor REPeat

(Go To TOC)

[ FETCHx ]

See FETCHBUF and FETCHCDB below.

(Go To TOC)

[ FETCHBUF ]


FETCHBUF varName sectorOffset byteOffset size
FETCHBUF varName sectorOffset byteOffset size BE
FETCHBUF varName sectorOffset byteOffset size LE

[FULL]

See the description of "user defined variables" above.

A value is fetched from the buffer. The value may be 1 to 8 bytes in size. The first byte is fetched from the sector and byte offset defined by the sectorOffset and byteOffset parameters. The value is assigned to the user define variable varName.

Use BE if the buffer data is in Big Endian format. Use LE if the buffer data is in Little Endian format. BE is the default.


   // assume the buffer contains (in hex)
   // 11 22 33 44 55 66 77 88
   fetchbuf a 0 0 4
   // a is now 0x11223344
   fetchbuf a 0 1 2
   // a is now 0x2233
   fetchbuf a 0 0 4 LE
   // a is now 0x44332211
   fetchbuf a 0 1 2 LE
   // a is now 0x3322
   fetchbuf a 0 0 8
   // a is now 0x1122334455667788
   fetchbuf a 0 0 8 LE
   // a is now 0x8877665544332211

Also see:  ALTER BLOCKSIZE ID RCAp SET STORE STOREBUF

(Go To TOC)

[ FETCHCDB ]


FETCHCDB varName offset size

[FULL]

See the description of "user defined variables" above.

The value is fetched from the ATAPI CDB buffer. The value may be 1, 2, 3 or 4 bytes in size. The first byte is fetched from the CDB buffer at 'offset'. The value is assigned to the user defined variable varName.

LBA, Transfer Length and other multi-byte data fields in a SCSI CDB is in Big Endian format.


   // assume bytes 4-7 of a CDB contain 0x11223344
   FETCHCDB x 4 4
   // will set x to 0x1122334 (not 0x44332211)

Also see:  SET STORECDB

(Go To TOC)

[ FILLx ]

General information for the FILLx commands.

The FILLx commands fill the I/O buffer with data. All data generated is based on the current BLOCKSIZE for the device.

When TAG is OFF the entire sector is filled with the specified data pattern. When TAG is ON the entire sector is filled with the specified data pattern and the sector tag data is placed into the middle of each sector's data.

The command FILLTag updates only the sector tag data leaving all other bytes of the sector's data unchanged.

Normally these commands are used with the BEFORE command and only the sectors that are about to be written are filled with data.

When the FILLx commands are not used with the BEFORE command, use the FILLNUM command to limit the number of sectors in the buffer that are filled with data.

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG

Example 1: On an ATA device the following command sequence will generate a data compare error because the data pattern (3 bytes) does not fit a whole number of times into a 512 byte sector:


   int
   dma on
   lba48
   tag off
   fillpat 11h 22h 33h
   before fillpat
   afternoerror comppat
   w 5000 0       // large DMA xfer
   r 5000 0       // read w/o data compare
   lbai tl
   rep 500 r 10 0 // read with data compare

Example 2: On an ATA device the following command sequence will generate a data compare error because TAG is ON for some write commands and TAG is OFf for other write commands:


   int
   dma on
   lba48
   tag on
   before fillzero
   afternoerror compzero
   w 10 0      // small DMA xfer - full data generation
   w 5000 10   // large DMA xfer - sectors not tagged
   r 10 0      // full data compare (no error)
   r 5000 10   // no compare is done
   r 10 10     // data compare error (no tag data)

Also see:  FILLIncr FILLOne FILLPat FILLRand FILLStart FILLTag FILLWord FILLZero

(Go To TOC)

[ FILLIncr ]


FILLIncr [sbv]

Fill each sector/block of the buffer with the incrementing byte data pattern.

If sbv is specified (0 to 255) the first byte of each sector will have this value. If sbv is not specified the first byte of each sector will have a random value.

The most recent sbv value will be used by BEFORE FILLIncr.

If TAG is ON the sector tag data will also be added.

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG

(Go To TOC)

[ FILLNUM ]


FILLNUM n

Specify the number of sectors to fill when a FILLx command is not used with the BEFORE command.

The default is to fill all the sectors in the buffer even if a following write command will not write those sectors.

For example:


   // no FILLNUM command has been previous used...
   FILLR    // fills all sectors in the buffer
   W 1 0    // but this command writes only the first sector
   // to fill and write only the one sector...
   FILLNUM 1
   FILLR
   W 1 0

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG

(Go To TOC)

[ FILLOne ]


FILLOne

Fill each sector/block of the buffer with FFH bytes.

If TAG is ON the sector tag data will also be added.

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG

(Go To TOC)

[ FILLPat ]


FILLPat

Fill each sector/block of the buffer with the current data pattern.

If TAG is ON the sector tag data will also be added.

NOTE: PUSH and POP DO NOT SAVE/RESTORE the FILLPat data pattern.

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG


FILLPat n ...
FILLPat + n ...

Fill each sector/block of the buffer with a data pattern.

Specify each byte of the data pattern byte (in decimal or hex) separated by one or more spaces. If the first two characters are the plus sign followed by a space, the pattern is appended to the current pattern. By using the plus sign a pattern of up to current sector/block size of the device may be created.

If TAG is ON the sector tag data will also be added.

NOTE: PUSH and POP DO NOT SAVE/RESTORE the FILLPat data pattern.

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG

(Go To TOC)

[ FILLRand ]


FILLRand

Fill each sector/block of the buffer with a randomly generated 4 byte data pattern. The 4 byte pattern looks like this:


   1st byte = random data
   2nd byte = random data
   3rd byte = 1's complement of the 1st byte
   4th byte = 1's complement of the 2nd byte

If TAG is ON the sector tag data will also be added.

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG

(Go To TOC)

[ FILLStart ]


FILLStart

Fill each sector/block of the buffer with the program Run ID (a 4 byte data pattern).

If TAG is ON the sector tag data will also be added.

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG

(Go To TOC)

[ FILLTag ]


FILLTag

Fill each sector/block of the buffer with the sector tag data. Only the sector tag data is updated.

Example:


   lbaincr tl
   tag on            // use tags
   fillzero          // fill all with 00h plus tags
   w 1 0             // write lba 0
   before filltag    // fill (update) only tags
   repeat 9 w 1 0    // write lba 1 to 9
   afternoerror comptag
   repeat 10 r 1 0   // read lba 0-9 checking only the tags

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG

(Go To TOC)

[ FILLWord ]


FILLWord [swv]

Fill each sector/block of the buffer with the incrementing word data pattern.

If sbw is specified (0 to 65535) the first word of each sector will have this value. If sbv is not specified the first word of each sector will have a random value.

The most recent sbw value will be used by BEFORE FILLWord.

If TAG is ON the sector tag data will also be added.

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG

(Go To TOC)

[ FILLZero ]


FILLZero

Fill each sector/block of the buffer with 00H data.

If TAG is ON the sector tag data will also be added.

Also see:  AFTERx BEFORE BLOCKSIZE COMPx FILLx POP PUSH TAG

(Go To TOC)

[ FPQx ]


FPQx

The FPQx commands (FPQCLEAR, FPQGO, FPQGOT, FPQR, FPQR and SHOWFPq) enable the creatiion of a queue of NCQ/FPDMA commands (command codes 60h and 61h) and control how those commands are issued to the drive.

Note: Use the FPR and FPW commands to issue a single NCQ/FPDMA command in the same manner as the R, W, DR, DW, DAR or DAW commands.

To create a queue follow these steps:

1) Clear the current queue using the FPQCLEAR command.

2) Add commands to the queue using the FPQR and/or FPQW commands.

3) Use the FPQGO or FPQGOT command to initiate execution of the commands in the queue. FPQGO and FPQGOT do not stop running until the FPQGO and FPQGOT command options are completed or there is an error. Note that if there is a device error a READ LOG command is not issued to clear the NCQ/FPDMA error in the device.

See example script files NCQWR.DSF and NCQSEQ.DSF.

Also see:  FPQCLEAR FPQGO FPQGOT FPQR FPQW FPR FPW SHOWFPq fpq_*

(Go To TOC)

[ FPQCLEAR ]


FPQCLEAR

See FPQx above.

Clear the NCQ/FPDMA Queue.

Also see:  FPQGO FPQR FPQW SHOWFPq

(Go To TOC)

[ FPQGO ]


FPQGO repeat lbaIncr [DC]
FPQGO repeat Random [DC]
FPQGO repeat TL [DC]
FPQGO repeat -TL [DC]

See FPQx above.

repeat is the repeat count of each tag/command in the queue (assuming no errors the total number of commands executed will be (repeat*fpq_numcmd) No more than repeat number of commands will be executed for each tag/command in the queue.

The sector count used with the current command will be random between minSC and maxSC.

lbaIncr is a numeric LBA increment value from -65536 to 65536. When lbaIncr is negative the first LBA used is the (maxLBA-current_sector_count) for the command. When lbaIncr is 0 or positive the first LBA used is the minLBA for the command. Execution of commands will stop when either the repeat count is reached or the entire LBA range for the command has been read or written.

Random uses random LBA values between minLBA and maxLBA. Execution of commands will stop when the repeat count is reached.

TL increments the LBA by the sector count of the previous command. Execution of commands will stop when either the repeat count is reached or the entire LBA range (lowest to highest) for the tag has been read or written.

-TL decrements the LBA by the sector count of the current command. Execution of commands will stop when either the repeat count is reached or the entire LBA range (highest to lowest) for the tag has been read or written.

DC enable data compare. For write commands the buffer if filled with an incremening word pattern equivalent to using both FILLWord and TAG ON. For read commands the tag information and the first and last data words are checked.

Also see:  FPQCLEAR FPQGOT FPQR FPQW SHOWFPq TAG fpq_*

(Go To TOC)

[ FPQGOT ]


FPQGOT runTime lbaIncr [DC]
FPQGOT runTime Random [DC]
FPQGOT runTime TL [DC]
FPQGOT runTime -TL [DC]

See FPQx above.

FPQGOT is the same as FPQGO except runTime is the number of seconds to execute the queue of commands.

Also see:  FPQCLEAR FPQGO FPQR FPQW SHOWFPq TAG fpq_*

(Go To TOC)

[ FPQR ]


FPQR minSC maxSC minLBA maxLBA [icc [tag [FUA] [PRIO] ]

[DIO]

See FPQx above.

Add one NCQ/FPDMA read command (command code 60H) to the FP Queue.

minSC is minimum sector count, 1 to 65536, 0 is the same as 65536.

maxSC is maximum sector count, 1 to 65536, 0 is the same as 65536.

minLBA is the minimum starting LBA.

maxLBA is the maximum starting LBA.

Note: (maxLBA-minLBA+1) must be greater than (10*maxSC).

icc is 0 to 255. The default is 0.

tag is 0 to 31. The default is the next unused tag number.

FUA sets the FUA bit to 1.

PRIO sets the PRIO bit to 1.

Also see:  FPQCLEAR FPQGO FPQGOT FPQW SHOWFPq

(Go To TOC)

[ FPQW ]


FPQW minSC maxSC minLBA maxLBA [icc [tag [FUA] [PRIO] ]

[DIO] [FULL]

See FPQx above.

Add one NCQ/FPDMA write command (command code 60H) to the FP Queue.

minSC is minimum sector count, 1 to 65536, 0 is the same as 65536.

maxSC is maximum sector count, 1 to 65536, 0 is the same as 65536.

minLBA is the minimum starting LBA.

maxLBA is the maximum starting LBA.

Note: (maxLBA-minLBA+1) must be greater than (10*maxSC).

icc is 0 to 255. The default is 0.

tag is 0 to 31. The default is the next unused tag number.

FUA sets the FUA bit to 1.

PRIO sets the PRIO bit to 1.

Also see:  FPQCLEAR FPQGO FPQGOT FPQR SHOWFPq

(Go To TOC)

[ FPR ]


FPR sectorCount lba [icc [tag [FUA] [PRIO] ]

[AUTO] [DIO] [REP]

Execute one NCQ/FPDMA read command (command code 60H). This command forces LBA48.

sectorCount is 0 to 65536, 0 is the same as 65536.

lba is the starting LBA.

icc is 0 to 255. The default is 0.

tag is 0 to 31. The default is 0.

FUA sets the FUA bit to 1.

PRIO sets the PRIO bit to 1.

Also see:  FPQx FPW R DAR DR

(Go To TOC)

[ FPW ]


FPW sectorCount lba [icc [tag [FUA] [PRIO] ]

[AUTO] [DIO] [FULL] [REP]

Execute one NCQ/FPDMA write command (command code 61H). This command forces LBA48.

sectorCount is 0 to 65536, 0 is the same as 65536.

lba is the starting LBA.

icc is 0 to 255. The default is 0.

tag is 0 to 31. The default is 0.

FUA sets the FUA bit to 1.

PRIO sets the PRIO bit to 1.

Also see:  FPQx FPR W DAW DW

(Go To TOC)

[ GEN ]


GEN [n]

Limit the SATA interface speed to be used after the next COMRESET.

n is the SATA Generation number, 0, 1, 2, 3, etc. If n is 0 then no limit is specified and the highest supported speed may be used.

Note: The SATA interface speed is not changed by the hardware until a COMRESET or COMINIT is executed.

Note: After a COMRESET the actual speed used by the hardware may be lower than the requested speed.

Also see:  GEN=n COMReset RESet

(Go To TOC)

[ GPL ]


GPL RLOG logAddr pageNum numPages [feature]
GPL WLOG logAddr pageNum numPages [feature]

[AUTO] [DIO] [REP]

Execute an ATA READ LOG EXT or WRITE LOG EXT command.

The GPL command forces LBA48.

logAddr is the log address (0-255).

pageNum is the log page number (0-65535).

numPages is the number of log pages (1-65535).

feature is the 8-bit value to place into the Features register. The default is 0.

Also see:  SMART ND REPeat

(Go To TOC)

[ Help ]


Help *
Help x

Display AHCDEMO help summary.

'*' displays the summary information for all AHCDEMO commands.

The first character of 'x' is used to limit the help output to the commands that start with that character. Both the command summary and the command syntax are shown.

Also see:  HELPKb (QuestionMark)

 


HELPC *
HELPC x

Displays ATA command code help.

'*' displays on the summary information for ATA commands.

The first character of 'x' is used to limit the help output to the commands that start with that character. Both the command summary and the command syntax are shown.

(Go To TOC)

[ HELPKb ]


HELPKb
HELPKb ON
HELPKb OFf
HELPKb (n)

Enables or disables keyboard command prompting.

For HELPKb (n), a zero value is the same as OFf and a non zero value is the same as ON.

Warning: See "Variables that look like keywords" above.

Also see:  Help (QuestionMark)

 


HELPP *
HELPP x

Displays ATAPI CD-ROM packet command code help.

'*' displays on the summary information for ATAPI commands.

The first character of 'x' is used to limit the help output to the commands that start with that character. Both the command summary and the command syntax are shown.

(Go To TOC)

[ ID ]


ID [NOSHOW] [NOCHECK] [NOSET]

[AUTO] [DIO] [REP]

Execute an ATA or ATAPI Identify Device command and 1) display (show) the data, 2) check the data against ACS-4 definition, and 3) update the built-in variables.

The NOSHOW parameter can be used to bypass the data display.

The NOCHECK parameter can be used to bypass the definitions check. Data definition errors are classified as data copare errors.

The NOSET parameter can be used to bypass the built-in variable update.

NOSHOW, NOCHECK and NOSET can appear in any order.

For ATA devices the ID command will set: 1) the maximum cylinder, head and sector values used by the CHSIncr command, 2) the maximum LBA value used by the LBAIncr command and 3) set the sector/block size to 512 or to the sector size found in IDENTIFY data words 106 and 117-118.

For ATAPI devices the ID command will set the ATAPI command packet size to 12 or 16. Use the RCAp command to set the sector/block size.

The data check, data display and setting of the built-in variables is performed only during the first execution of a repeated ID command.

The ID command executes one of the following commands:


   pdi ech 0 0 0        ; ata in lba
   pdi ech 0 0 0 0 0    ; ata in chs
   pdi a1h 0 0 0        ; atapi in lba
   pdi a1h 0 0 0 0 0    ; atapi in chs

Also see:  BLOCKSIZE DUMPId PS RCAp REPeat SHOWx SHOWID

(Go To TOC)

[ IF ]


IF n

[FULL] [SCRIPT]

Defines the beginning of an IF/ELSE/ENDIF command sequence. The ELSE part of this command sequence is optional.

If n is not zero then the IF part of the command is executed. If n is zero then the IF part of the command sequence is no executed and the optional ELSE part is executed.

Example without ELSE part:


   if ( lba & 1 )
      set nsect = 4
   endif

Example with ELSE part:


   if ( lba > 10000 )
      set nsect = ( lba & 0xf )
   else
      if ( lba > 100000 )
         set nsect = 32
      else
         set nsect = 4
      endif
   endif

Also see:  ELSE ENDIF

(Go To TOC)

[ INCR ]


INCR varName [n]

[FULL]

If not specified, n defaults to 1.

If varName exists then this command is equivalent to


   SET varName = ( varName + n )

If varName does not exist then this commands is equivalent to


   SET varName = ( 0 + n )

Also see:  LOCAL SET

(Go To TOC)

[ INPORTx ]      


INPORTByte
INPORTWord
INPORTDword
INPORTByte ioAddr [varName]
INPORTWord ioAddr [varName]
INPORTDword ioAddr [varName]

[FULL]

Note: This command can not be used to access any AHCI host controller data.

See the description of "user defined variables" above.

Read an 8-bit value or a 16-bit value from a x86 I/O port. ioAddr is the I/O port address (0000H to FFFFH). The value read is placed into the user defined variable varName.

If varName is not specified the value read is displayed. If varName is specified the value is assigned to the user defined variable varName.

Warning: Be careful when using these commands. Reading some I/O ports incorrectly can cause system failures.

Also see:  OUTPORTx

(Go To TOC)

[ INQ ]


INQ

[AUTO] [DIO] [REP]

Execute an ATAPI Inquiry command and display the Inquiry data received. Inquiry (ATAPI packet command code 12H) is a "packet read" (PR) command.

The data display is performed only during the first execution of a repeated INQ command.

This command forces LBA32 sector/block addressing mode.

Also see:  LBA SHOWx

(Go To TOC)

[ LBA ]


LBA

Switch to LBA sector addressing. When switching from CHS to LBA mode this command will restore the previously active LBA mode.

Also see:  CHS LBA28 LBA32 LBA48


LBA (n)

Set the LBA mode to LBA28 or LBA48. The expression n must have the value 28 or 48.


LBA SET n

Switch to LBA sector addressing and set the LBA for the next command. When switching from CHS to LBA mode this command will restore the previously active LBA mode. This command is normally not needed except before an ATAPI Packet command that does not have the LBA in the CDB, for example, the Read (08H) and Write (0AH) commands used by ATAPI tape drives. This command provides the LBA so that commands like COMPx, FILLx, LBAIncr, TAG, etc, work correctly.

Example:


   BLOCKSIZE 128   ; set block size
   TAG ON          ; tagging on
   BEFORE FILLRAND ; data pattern
   LBA SET 1000    ; set starting LBA = 1000
   LBAINCR 1 2000  ; incr LBA by 1, go to LBA 2000
   REP 100 PW 512 0AH 0 0 0 1 0   ; TL=1, LBA=1000,1001, ...

Also see:  CHS

     


LBA28
LBA32
LBA48

Switch to LBA sector addressing using 28, 32 or 48 bit LBA.

Also see:  CHS


LBA28 SET n
LBA32 SET n
LBA48 SET n n

Switch to LBA sector addressing and set the LBA for the next command. This command is normally not needed except before an ATAPI Packet command that does not have the LBA in the CDB, for example, the Read (08H) and Write (0AH) commands used by ATAPI tape drives. This command provides the LBA so that commands like COMPx, FILLx, LBAIncr, TAG, etc, work correctly.

Example:


   BLOCKSIZE 128   ; set block size
   TAG ON          ; tagging on
   BEFORE FILLRAND ; data pattern
   LBA32 SET 1000  ; set starting LBA = 1000
   LBAINCR 1 2000  ; incr LBA by 1, go to LBA 2000
   REP 100 PW 512 0AH 0 0 0 1 0   ; TL=1, LBA=1000,1001, ...

Also see:  CHS

(Go To TOC)

[ LBAIncr ]


LBAIncr

[FULL]

Display the current LBAIncr settings.

The LBAIncr command uses the following terms. Some of these values can be read using built-in variables.

curLBA is the LBA used in the current command, see the io_lbalo and io_lbahi built-in variables.

baseLBA is the LBA specified by the AHCDEMO command being repeated.

numLBA is the number of sectors in the current LBA geometry, see the max_lba and num_lba built-in variables.

incrLBA is the LBA increment or decrement.

sectCnt is the number of sectors that the current command will attempt to transfer.

The ATA ID command will set the num_lba variable to the contents of ATA Identify to the maximum of data words 60-61, 100-103 or 230-233.

The ATAPI RCAp command will set numLBA to the capacity of an ATAPI device.

The max_lba is set to ( num_lba - 1 ).

The LBAIncr command can be used to override the value set by ID or RCAp.

In LBA addressing mode the LBAIncr command and the REPeat command use the following rules:

Examples: See "Using CHSIncr, LBAIncr and REPeat Commands" below.

Warning: See "Variables that look like keywords" above.

Also see:  CHSIncr ID RCAp REPeat


LBAIncr TL [numLba]
LBAIncr n [numLba]

[FULL]

See the terms defined in the LBAIncr command above.

For 'LBAIncr TL' the incrLBA will be the sector count of the previous command.

For 'LBAIncr n' the incrLBA may be a value from 0 to 65536.

When an ATA command in LBA sector addressing is repeated, or when an ATAPI Read, Read CD, Read 10, Read 12, Seek 10, Write, Write 10 or Write 12 command is repeated, curLBA of the first command is baseLBA. Starting with the second command, curLBA is incremented by incrLBA before each command. A REPeat loop in LBA mode will terminate when (curLBA + incrLBA) reaches numLBA. When incrLBA is greater than 0, the curLBA of the last command repeated may be adjusted to (numLBA - sectCnt).

The default is


   LBAIncr 0 1032192

so that LBA addresses are not incremented by the REPeat command until either an ID, LBAIncr or RCAp command is executed.

Examples: See "Using CHSIncr, LBAIncr and REPeat Commands" below.

Warning: See "Variables that look like keywords" above.

Also see:  CHSIncr ID RCAp REPeat


LBAIncr -TL [numLba]
LBAIncr -n [numLba]

[FULL]

See the terms defined in the LBAIncr command above.

For 'LBAIncr -TL' the incrLBA will be the sector count of the first or previous command.

For 'LBAIncr -n' the incrLBA may be a value from -1 to -65536.

When an ATA command in LBA sector addressing is repeated, or when an ATAPI Read, Read CD, Read 10, Read 12, Seek 10, Write, Write 10 or Write 12 command is repeated, curLBA of the first command is baseLBA. Starting with the second command, curLBA is decremented by incrLBA before each command. A REPeat loop in LBA mode will terminate when curLBA reaches 0. The curLBA of the last command repeated may be adjusted to LBA 0.

The default is


   LBAIncr 0 1032192

so that LBA addresses are not incremented by the REPeat command until either an ID, LBAIncr or RCAp command is executed.

Examples: See "Using CHSIncr, LBAIncr and REPeat Commands" below.

Warning: See "Variables that look like keywords" above.

Also see:  CHSIncr ID RCAp REPeat


LBAIncr Random [numLba]

[FULL]

See the terms defined in the LBAIncr command above.

When an ATA command in LBA sector addressing is repeated, or when an ATAPI Read, Read 10, Read 12, Seek 10, Write, Write 10 or Write 12 command is repeated, curLBA of the first command is baseLBA. Starting with the second command, curLBA is randomly generated within the range baseLBA to (numLBA - sectCnt).

The default is


   LBAIncr 0 1032192

so that LBA addresses are not incremented by the REPeat command until either an ID, LBAIncr or RCAp command is executed.

Examples: See "Using CHSIncr, LBAIncr and REPeat Commands" below.

Warning: See "Variables that look like keywords" above.

Also see:  CHSIncr ID RCAp REPeat

(Go To TOC)

[ LOCAL ]


LOCAL varName [=] n

[FULL] [SCRIPT]

See the description of "user defined variables" above.

Creates a user defined variable local to the current subroutine and assigns the value n to it. LOCAL commands in the main part of a script are converted to SET commands.

Variable names must begin with an alphabetic character and must contain only alphabetic and numeric characters.

The equal sign is optional.

Examples:


   set a 1
   set b = 4
   LOCAL x ( a + 3 * b - 2 )
   Say X is now {x}

      Will display "X is now 11".

   set x = 3
   say X is now {x}
   local x = 4
   say X is now {x}

      Will display "X is now 3" followed by "X is now 4".

Also see:  ASK ASKYN FETCHx SET

(Go To TOC)

[ LOG ]


LOG

Display the current state of the log file (open or closed) and the current setting of logging message levels.


LOG DELete

Delete the current log file. If the file is currently closed, it will remain closed. If the file is open, it will be closed, deleted and re-opend.


LOG KML normal repeat
LOG SML normal repeat
LOG SMLRestore n

Set the logging message levels for keyboard (KML) and script file (SML) operations. See "Message Logging" above.

The normal and repeat parameters are a string of characters that control the message level(s) to be turned on or off. The characters in the string are processed one at a time from left to right. The valid characters are:


   * - do not change the setting. If * is used it must be the
       only character in the string.
   + - Turn on the message level indicated by the next
       character.
   - - Turn off the message level indicated by the next
       character.
   A - All messages. Note that '-A' is equivalent to 'N'.
   C - Data compare command messages.
   D - Dump command messages.
   E - I/O and data compare error messages.
   I - I/O start/done messages.
   K - Command prompt messages.
   M - Command informational messages.
   N - No messages. Note that '-N' is equivalent to 'A'.
   S - Show command messages.
   T - Command timing messages.

Note: Some AHCDEMO error and some status messages can not be turned off.

The SCRipt command enables all script file logging (LOG SML A A).

The first script in a SLIST starts with all logging enabled (LOG SML A A).

The LOG SMRRestore can be used to restore the LOG SML setting from a previously saved value. The current LOG SML settings are encoded in the built-in variable log_sml. See example below.

Examples:


   LOG KML * N

   Do not change the current keyboard normal level but turn
   off all keyboard repeat message levels.

   LOG SML -I-KT -I-KT

   For scipt file operations, Turn off I/O start/done and command
   echo messages and turn on command timing messages.

   LOG KML NCDEIST NCDES

   is equivalent to LOG MINimun for keyboard operations.

   LOG SML A A

   is equivalent to LOG MAXimun for script file operations.

   LOG SML -K *

   is equivalent to ECHO OFF for script file operations.

   LOG SML A A                // current log level
   // ...                     // use the log level
   set saveloglvl = log_sml   // save current log level
   LOG SML N N                // change the log level
   // ...                     // use changed log level
   LOG SMLRestore saveloglvl  // restore previous log level

   allows parts of a script (such as a subroutine) to use a different
   log level.

Also see:  ECHO LOG log_sml


LOG MAXimum
LOG MINimum

Turn on full (MAXimum) message logging or turn on reduced (MINimum) message logging.

LOG MAXimum is equivalent to using these two commands:


   LOG KML A A
   LOG SML A A

LOG MINimum is equivalent to using these two commands:


   LOG KML NCDEIST NCDES
   LOG SML NCDEIST NCDES

Also see:  ECHO


LOG NEW fileName

Close the current log file, if one is open, and open a new log file with the name fileName. See the LOG=filename command line option.

See the section FILE NAMES above for the description of how file names can be specified.

LOG NEW also forces LOG MAXimum.

Examples:


   LOG NEW NEWLOG.TXT   ; file name is 'NEWLOG.TXT'

   SET X = 583
   LOG NEW (x+3)  ; file name is '586.LOG'

   SET Y = 8943
   SET Z = 26
   LOG NEW D{Y}.{*Z}H ; file name is 'D8943.1AH'

   LOG NEW *2   ; file name could be '2C181452.LOG'


LOG OFf
LOG ON
LOG (n)

Turn message logging to the current log file on and off.

LOG ON also forces LOG MAXimum.

For LOG (n), a zero value is the same as OFf and a non zero value is the same as ON.

Warning: See "Variables that look like keywords" above.

Also see:  WL

(Go To TOC)

[ ND ]


ND command feature sectorCount lba
ND command feature sectorCount cyl head sect

[AUTO] [DIO] [REP]

Execute an ATA Non-Data command in CHS or LBA mode.

Also see:  CHSIncr DR DW LBAIncr PDI PDO REPeat SF SM

(Go To TOC)

[ NDX ]


NDX fr sc sn cl ch dh cmd

[AUTO] [DIO] [FULL]

Execute an ATA Non-data command using specified values for each ATA Command Block register. This command can not be used with the REPeat command. This command will forces CHS mode.

fr is the Features Register value (0-255).

sc is the Sector Count value (0-255).

sn is the Sector Number value (0-255).

cl is the Cylinder Low value (0-255).

ch is the Cylinder High value (0-255).

dh is the Device (Drive/Head) value (0-15). The dh value is the value for bits 3-0 of the register. Bits 7-4 of the register are set to zero.

cmd is the Command register value (0-255).

Also see:  PDI PDIX PDO PDOX

(Go To TOC)

[ Next ]


Next

This command is equivalent to the following command:


   Dump

Also see:  Dump

(Go To TOC)

[ ONERRor ]


ONERRor

[FULL] [SCRIPT]

This command is valid in both keyboard mode and in script files.

Display the current setting of ONERRor.

The ONERRor default is QUit. ONERRor is reset to QUIT when a script ends execution and keyboard mode is entered. Also see the other ONESCkey options.

Also see:  AFTERx BEFORE BEGINSub CAll ENDSub EXPEcterror ONESCkey REPeat


ONERRor CAll subName [n1]

[FULL] [SCRIPT]

This command is valid only within script files.

ONERRor CAll is similar to placing IF, CAll and ENDIF commands after each device I/O or data compare command that calls the subroutine subName if there is an error. The optional value n1 is evaluted and saved at the time the ONERRor CAll command is executed. The value is then passed to the subroutine in the sub_param1 variable. The sub_param2, ..., sub_parm9 variables are set to 0 when the subroutine is called. If n1 is omitted, n1 is assumed to be 0.

The subroutine can return or exit with these results:

The ONERRor default is QUit. ONERRor is reset to QUIT when a script ends execution and keyboard mode is entered. Also see the other ONERRor options.

The best use of ONERRor CALL is to perform some cleanup or reporting function for the script and then continue script execution or end the script or SLIST execution with an EXit or QUit command.

Example:


      ONERRor CALL escsub 1
      // ...
      WHILE 1
         // ... Some I/O testing you would
         // ... like to stop using the ESC key.
      ENDWHILE
      // ...
      BEGINSUB escsub
         SAY ! I/O ERROR DETECTED, sub_param1={sub_param1} !
         // ... some cleanup here
         QUit
      ENDSUB

Also see:  AFTERx BEFORE BEGINSub CAll ENDSub EXPEcterror ONESCkey REPeat


ONERRor COntinue

This command is valid in both keyboard mode and in script files.

ONERRor COntinue actions during script file execution:

ONERRor COntinue actions when in keyboard mode:

The ONERRor default is QUit. ONERRor is reset to QUIT when a script ends execution and keyboard mode is entered. Also see the other ONERRor options.

Also see:  AFTERx BEFORE BEGINSub CAll ENDSub EXPEcterror ONESCkey REPeat


ONERRor NExt

[FULL] [SCRIPT]

This command is valid in both keyboard mode and in script files.

ONERRor Next actions during script file execution:

ONERRor NExt actions when in keyboard mode:

The ONERRor default is QUit. ONERRor is reset to QUIT when a script ends execution and keyboard mode is entered. Also see the other ONERRor options.

Also see:  AFTERx BEFORE BEGINSub CAll ENDSub EXPEcterror ONESCkey REPeat


ONERRor EXit

[FULL] [SCRIPT]

This command is valid in both keyboard mode and in script files.

ONERRor EXit actions during script file execution

ONERRor EXit actions in keyboard mode:

The ONERRor default is QUit. ONERRor is reset to QUIT when a script ends execution and keyboard mode is entered. Also see the other ONERRor options.

Also see:  AFTERx BEFORE BEGINSub CAll ENDSub EXPEcterror ONESCkey REPeat


ONERRor QUit

[FULL] [SCRIPT]

This command is valid in both keyboard mode and in script files.

ONERRor QUit actions during script file execution

ONERRor QUit actions in keyboard mode:

The ONERRor default is QUit. ONERRor is reset to QUIT when a script ends execution and keyboard mode is entered. Also see the other ONERRor options.

Also see:  AFTERx BEFORE BEGINSub CAll ENDSub EXPEcterror ONESCkey REPeat


ONERRor Summary

The following tables show all the ONERRor actions.

Table 1: EXPEcterror Actions

ATA/ATAPI command EXPEcterror active Action
ends with no error no No ONERRor action is taken, execution continues.
ends with no error yes This is an 'error', see Table 2.
ends with an error no This is an 'error', see Table 2.
ends with an error yes - for any error type No ONERRor action is taken, execution continues.
ends with an error yes - error matches expected error type No ONERRor action is taken, execution continues.
ends with an error yes - error does not match expected error type This is an 'error', see Table 2.

Table 2: ONERRor Actions

ONERRor setting Script Action Keyboard Action
CAll The subroutine is called. If the subroutine ends with a RETurn, execution of the script file continues with the next command in the script file. Not valid
CONTinue Execution of the current script continues at the next command. Get next command from keyboard.
EXit AHCDEMO terminates. AHCDEMO terminates.
NExt If REPeat'ing, execution of the REPeat continues. If not REPeat'ing, script continues at the next command. If REPeat'ing, execution of the REPeat continues. If not REPeat'ing, get next command from keyboard.
QUit Current script stops and either keyboard mode is entered or the next script in an SLIST is executed. Get next command from keyboard.

Also see:  AFTERx BEFORE BEGINSub CAll ENDSub EXPEcterror ONESCkey REPeat

(Go To TOC)

[ ONESCkey ]


ONESCkey

[FULL] [SCRIPT]

This command is valid in both keyboard mode and in script files.

Display the current setting of ONESCkey.

The ONESCkey default is QUit. ONESCkey is reset to QUIT when a script ends execution and keyboard mode is entered. Also see the other ONESCkey options.

Also see:  BEGINSub CAll ENDSub ONERRor REPeat POP PUSH


ONESCkey CAll subName [n1]

[FULL] [SCRIPT]

This command is valid only within script files.

ONESCkey CAll is similar to placing IF, CAll and ENDIF commands after each device I/O command that calls the subroutine subName if the ESC key has been pressed. The optional value n1 is evaluted and saved at the time the ONESCkey CAll command is executed. The value is then passed to the subroutine in the sub_param1 variable. The sub_param2, through sub_parm9 variables are set to 0 when the subroutine is called. If n1 is omitted, n1 is assumed to be 0.

The subroutine can return or exit with these results:

The ONERRor default is QUit. ONERRor is reset to QUIT when a script ends execution and keyboard mode is entered. Also see the other ONERRor options.

The best use of ONESCkey CALL is to perform some cleanup or reporting function for the script and then continue script execution or end the script or SLIST execution with an EXit or QUit command.

Example:


      ONESCkey CALL escsub 1
      // ...
      WHILE 1
         // ... Some I/O testing you would
         // ... like to stop using the ESC key.
      ENDWHILE
      // ...
      BEGINSUB escsub
         SAY ! ESC KEY DETECTED, sub_param1={sub_param1} !
         // ... some cleanup here
         QUit
      ENDSUB

The ONESCkey default is QUit. ONESCkey is reset to QUIT when a script ends execution and keyboard mode is entered. Also see the other ONESCkey options.

Also see:  BEGINSub CAll ENDSub ONERRor REPeat POP PUSH


ONESCkey COntinue

[FULL] [SCRIPT]

This command is valid in both keyboard mode and in script files.

ONESCkey COntinue actions during script file execution:

ONESCkey COntinue actions when in keyboard mode:

The ONESCkey default is QUit. ONESCkey is reset to QUIT when a script ends execution and keyboard mode is entered. Also see the other ONESCkey options.

Also see:  BEGINSub CAll ENDSub ONERRor REPeat POP PUSH


ONESCkey NExt

[FULL] [SCRIPT]

This command is valid in both keyboard mode and in script files.

ONESCkey Next actions during script file execution:

ONESCkey NExt actions when in keyboard mode:

The ONESCkey default is QUit. ONESCkey is reset to QUIT when a script ends execution and keyboard mode is entered. Also see the other ONESCkey options.

Also see:  BEGINSub CAll ENDSub ONERRor REPeat POP PUSH


ONESCkey EXit

[FULL] [SCRIPT]

ONESCkey EXit actions during script file execution

ONESCkey EXit actions in keyboard mode:

Also see:  BEGINSub CAll ENDSub ONERRor REPeat POP PUSH


ONESCkey QUit

[FULL] [SCRIPT]

ONESCkey QUit actions during script file execution

ONESCkey QUit actions in keyboard mode:

The ONESCkey default is QUit. ONESCkey is reset to QUIT when a script ends execution and keyboard mode is entered. Also see the other ONESCkey options.

Also see:  BEGINSub CAll ENDSub ONERRor REPeat POP PUSH


ONESCkey Summary

The following table shows all the ONESCkey actions.

ONESCkey setting Script Action Keyboard Action
CAll The subroutine is called. If the subroutine ends with a RETurn, execution of the script file continues with the next command in the script file. Not valid
CONTinue Execution of the current script continues at the next command. Get next command from keyboard.
EXit AHCDEMO terminates. AHCDEMO terminates.
NExt If REPeat'ing, execution of the REPeat continues. If not REPeat'ing, script continues at the next command. If REPeat'ing, execution of the REPeat continues. If not REPeat'ing, get next command from keyboard.
QUit Current script stops and either keyboard mode is entered or the next script in an SLIST is executed. Get next command from keyboard.

Also see:  BEGINSub CAll ENDSub ONERRor REPeat POP PUSH

(Go To TOC)

[ OPTNUMset ]


OPTNUMset OPT_Nn n

[FULL]

Change the value of a OPT_Nn built-in variable. Normally the value of these varaibles are set using the Nn=n command line options.

Also see:  Nn=n opt_n*

(Go To TOC)

[ OUTPORTx ]      


OUTPORTByte
OUTPORTWord
OUTPORTDword
OUTPORTByte ioAddr n
OUTPORTWord ioAddr n
OUTPORTDword ioAddr n

[FULL]

Note: This command can not be used to access any AHCI host controller data.

Write an 8-bit, 16-bit or 32-bit value to a x86 I/O port. ioAddr is the I/O port address (0000H to FFFFH). The least significant 8, 16 or 32 bits of the value n are written to the I/O port.

Warning: Be careful when using these commands. Writing I/O ports incorrectly can cause system failures.

Also see:  INPORTx

(Go To TOC)

[ PARTIAL ]


PARTIAL

[DIO] [FULL]

Place the SATA interface into Partial mode.

Note: Moving directly between Partial and Slumber modes is not legal. Partial can only be entered from Active mode.

Also see:  ACTIVE SLUMBER

(Go To TOC)

[ PDI ]


PDI command feature sectorCount lba [multiCount]
PDI command feature sectorCount cyl head sect [multiCount]

[AUTO] [DIO] [REP]

Execute an ATA PIO Data In command in CHS or LBA mode.

multiCount is required for Read/Write Multiple commands (command codes C4H and C5H).

Data compare is limited when a PDI command uses a sectorCount greater that the size of the AHCDEMO I/O buffer - see the COMPx and TAG commands.

Also see:  CHSIncr DR DW LBAIncr PN PDO REPeat

(Go To TOC)

[ PDIX ]


PDIX fr sc sn cl ch dh cmd numSect [multiCnt]

[AUTO] [DIO] [FULL]

Execute an ATA PIO Data In command using specified values for each ATA Command Block register. This command can not be used with the REPeat command. This command forces CHS mode.

fr is the Features Register value (0-255).

sc is the Sector Count value (0-255).

sn is the Sector Number value (0-255).

cl is the Cylinder Low value (0-255).

ch is the Cylinder High value (0-255).

dh is the Device (Drive/Head) value (0-15). The dh value is the value for bits 3-0 of the register. Bits 7-4 of the register are set to zero.

cmd is the Command register value (0-255).

numSect is the number of sector to transfer.

multiCnt is the current multiple value.

Also see:  ND NDX PDO PDOX

(Go To TOC)

[ PDO ]


PDO command feature sectorCount lba [multiCount]
PDO command feature sectorCount cyl head sect [multiCount]

[AUTO] [DIO] [FULL] [REP]

Execute an ATA PIO Data Out command in CHS or LBA mode.

multiCount is required for Read/Write Multiple commands (command codes C4H and C5H).

Data generation is limited when a PDO command uses a sectorCount greater that the size of the AHCDEMO I/O buffer - see the FILLx and TAG commands.

Also see:  CHSIncr DR DW LBAIncr PN PDI REPeat

(Go To TOC)

[ PDOX ]


PDOX fr sc sn cl ch dh cmd numSect [multiCnt]

[AUTO] [DIO] [FULL]

Execute an ATA PIO Data Out command using specified values for each ATA Command Block register. This command can not be used with the REPeat command. This command forces CHS mode.

fr is the Features Register value (0-255).

sc is the Sector Count value (0-255).

sn is the Sector Number value (0-255).

cl is the Cylinder Low value (0-255).

ch is the Cylinder High value (0-255).

dh is the Device (Drive/Head) value (0-15). The dh value is the value for bits 3-0 of the register. Bits 7-4 of the register are set to zero.

cmd is the Command register value (0-255).

numSect is the number of sector to transfer.

multiCnt is the current multiple value.

Also see:  ND NDX PDO PDOX

(Go To TOC)

[ PN ]


PN bcl cdb0 cdb1 ... cdbn [etl]

[AUTO] [DIO] [REP]

Execute an ATAPI Packet command that does not transfer data.

bcl is the Byte Count Limit (maximum data packet size). This value is placed into the Byte Count registers before the Packet command is started.

cdb0, cdb1, ... cdbn is the command packet.

etl is the expect data transfer length. The PN command assumes that the only valid etl value is zero. If etl is omitted there is no check of the data transfer length.

This command forces LBA32 sector/block addressing mode.

If this command is repeated and cdb0 is 2BH (Seek 10) the LBA will be updated by the LBAIncr command.

Also see:  ATAPIRegs DPR DPW LBAIncr PR PS PW REPeat

(Go To TOC)

[ POP ]


POP

[FULL] [SCRIPT]

Restore (pop) the ONERRor, ONESCkey, AFTERx. BEFORE, COMPx, FILLx and TAG settings saved by the most recent PUSH command. Up to 8 PUSH commands can be in effect at one time. See the PUSH command.

NOTE: PUSH and POP DO NOT SAVE/RESTORE the FILLPat data pattern.

Also see:  PUSH

(Go To TOC)

[ POWer ]


POWer
POWer CHeck
POWer IDle
POWer IDle n
POWer SLeep
POWer STandby
POWer STandby n
POWer UNload

Execute an ATA Power Management command.

POWer with no parameters displays help for the POWer commands.

CHeck executes a CHECK POWER MODE command (E5H).

IDle (without n) executes an IDLE IMMEDIATE command (E1H).

IDLE n executes an IDLE command (E3H). n is the Standby timer value.

SLeep execute a SLEEP command (E6H).

STandby (without n) executes a STANDBY IMMEDIATE command (E0H).

STandby n executes a STANDBY command (E2H). n is the Standby timer value.

UNload executes an IDLE IMMEDIATE UNLOAD command (E1H).

(Go To TOC)

[ PR ]


PR bcl cdb0 cdb1 ... cdbn [etl]

[AUTO] [DIO] [REP]

Execute an ATAPI Packet command that reads data from the device in PIO mode (the Features register is set to 00H before the Packet command is started).

bcl is the Byte Count Limit (maximum data packet size). This value is placed into the Byte Count registers before the Packet command is started.

cdb0, cdb1, ... cdbn is the command packet.

etl is the expect data transfer length. If etl is omitted there is no check of the data transfer length.

This command forces LBA32 sector/block addressing mode.

If this command is repeated and cdb0 is 28H (Read 10), A8H (Read 12) or BEH (Read CD) the LBA will be updated by the LBAIncr command. The LBA is also updated for a 08H (Read) command (but the LBA does not appear in the CDB for this command). See the 'LBA SET n' command for more information.

For Read 10/12 commands the data transfer may be greater than the AHCDEMO I/O buffer size. Data compare is bypassed for transfers that are greater than the AHCDEMO I/O buffer size. See the COMPx and TAG commands.

Also see:  ATAPIRegs DPR DPW LBA LBAIncr PR PS PW REPeat

(Go To TOC)

[ PS ]


PS

Display the ATAPI command packet size for the currently selected device.


PS 12
PS 16
PS n

Set the ATAPI command packet size for the currently selected device to 12 or 16 bytes.

Also see:  ID

(Go To TOC)

[ PUSH ]


PUSH

[FULL] [SCRIPT]

Save (push) the current ONERRor, ONESCkey, AFTERx, BEFORE, COMPx, FILLx and TAG settings. Up to 8 PUSH commands can be in effect at one time. See the POP command.

NOTE: PUSH and POP DO NOT SAVE/RESTORE the FILLPat data pattern.

Also see:  POP

(Go To TOC)

[ PW ]


PW bcl cdb0 cdb1 ... cdbn [etl]

[AUTO] [DIO] [FULL] [REP]

Execute an ATAPI Packet command that writes data to the device in PIO mode (the Features register is set to 00H before the Packet command is started).

bcl is the Byte Count Limit (maximum data packet size). This value is placed into the Byte Count registers before the Packet command is started.

cdb0, cdb1, ... cdbn is the command packet.

etl is the expect data transfer length. If etl is omitted there is no check of the data transfer length.

This command forces LBA32 sector/block addressing mode.

If this command is repeated and cdb0 is 2AH (Write 10) or AAH (Write 12) the LBA will be updated by the LBAIncr command. The LBA is also updated for a 0AH (Write) command (but the LBA does not appear in the CDB for this command). See the 'LBA SET n' command for more information.

For Write 10 and Write 12 commands the data transfer may be greater than the AHCDEMO I/O buffer size. Data generation is limited for transfers that are greater than the AHCDEMO I/O buffer size. See the FILLx and TAG commands.

Also see:  ATAPIRegs DPR DPW LBA LBAIncr PR PS PW REPeat

(Go To TOC)

[ PWRCTRL ]


PWRCTRL PORT n
PWRCTRL AON AOFf PON POFf TON TOFf 5ON 5OFf 12ON 12OFf

See the Power Control Board User Guide (POWER.HTM).

Also see the DOS environment variable ATAPWRCTRL.

'PORT n' sets or changes the Parallel Port I/O address. See the ATAPWRCTRL DOS environment variable. The I/O address should be 1H to FFFFH. The equivalent of 'PWRCTRL POFf TOFf PON' will be sent to the Parallel Port I/O adress (turning on both 5 and 12 volts to the drive).

The xON and xOFf parameters can appear in any order but are processed left to right. These parameters are applied to the current power control setting (see pwr_ctrlc). The end result of merging the current setting with these parameters become the new current setting that is sent to the Power Control Board.

Note that after turning drive power on usually a COMReset is required to establish normal operation.

For example:


   PWRCTRL AOFf PON      // all off then 5 and 12 volt on
   PWRCTRL POFf 5ON      // 5 volt only on (trigger unchanged)
   PWRCTRL PON 5OFf TON  // 12 volt and trigger on
   PWRCTRL AOFf 12ON TON // 12 volt and trigger on

Also see:  pwr_ctrlc pwr_ctrlp

(Go To TOC)

[ QUit ]


QUit [SLIST]

When used in keyboard mode (with or without SLIST) this command terminates AHCDEMO (it is equivalent to the command "EXit 0").

When used in a script file that is not part of an SLIST this command terminates execution of the script file and AHCDEMO returns to keyboard mode.

When used in a script file that is part of a script list:

Also see:  EXit

(Go To TOC)

[ R ]


R sectorCount lba [multiCount]
R sectorCount cyl head sect [multiCount]

[AUTO] [DIO] [REP]

Execute an ATA Read Sectors, Read Multiple or Read DMA command.

If DMA is OFf and multiCount is not specified the R command is equivalent to


   PDI 20h 0 sectorCount lba
   PDI 20h 0 sectorCount cyl head sect
   PDI 24h 0 sectorCount lba

If DMA is OFf and multiCount is specified the R command is equivalent to


   PDI C4h 0 sectorCount lba multiCount
   PDI C4h 0 sectorCount cyl head sect multiCount
   PDI 29h 0 sectorCount lba

If DMA is ON, multiCount is ignored and the R command is equivalent to


   DR 0 sectorCount lba
   DR 0 sectorCount cyl head sect

Note that sector tagging is done only in LBA mode.

Also see:  CHSIncr DMA DR DW LBAIncr PDI PDO REPeat W

(Go To TOC)

[ RANDSEED ]


RANDSEED n

Seed the random number generator. n is 0 to 32767.

Set n to 1 to reinitialize (this is the default when AHCDEMO starts).

Use RANDSEED at the beginning of a script file so that the script generates the same sequence of events and/or data.

Also see:  rand_num

(Go To TOC)

[ RBUF ]


RBUF [feature sectorCount lba]

[DIO] [REP]

Execute an ATA READ BUFFER (DMA OFf) or READ BUFFER DMA (DMA ON) command. If no parameters are specified Feature is set to zero, Sector Count is set to one, and LBA is set to zero.

The RBUF and WBUF commands force LBA48 so that 16-bit values can be placed into the Feature and Sector Counter fileds and 48-bit values can be placed into the LBA field.

Also see:  DMA WBUF

(Go To TOC)

[ RCAp ]


RCAp

[AUTO] [DIO] [REP]

Execute an ATAPI Read Capacity command and display the capacity data received. Inquiry (ATAPI packet command code 25H) is a "packet read" (PR) command.

The RCAp command sets the LBA increment and the total number of sectors/blocks used by the REPeat command.

The RCAp command sets the sector/block size for the selected ATAPI device.

The data display and setting of the sector/block size is performed only during the first execution of a repeated RCAp command.

This command forces LBA32 sector/block addressing mode.

Also see:  BLOCKSIZE LBAIncr REPeat

(Go To TOC)

[ RCD ]


RCD tl lba [etl]

[AUTO] [DIO] [REP]

Execute an ATAPI Read CD command. Read CD (ATAPI packet command code BEH) is a "packet read" (PR) command. If DMA is ON, the data transfer will be done in DMA mode. If DMA is OFf, the data transfer will be done in PIO mode.

The current BLOCKSIZE (dev_bs) should be set to 2048 (CD-ROM data) or to 2352 (CD-DA data) before using this command.

tl is the transfer length (number of blocks to read).

This command is equivalent to these PR and DPR commands:


     PR dev_bs beH 00h lba3 lba2 lba1 lba0 0 tl1 tl0 10H 0 0
   or
     SET dmabc = ( dev_bs * tl )
     DPR dmabc beH 00h lba3 lba2 lba1 lba0 0 tl1 tl0 10H 0 0

The data transfer of a RCD command may be up to 33Mbytes (65536*512 bytes). Data compare is bypassed for a data transfer that is larger than the AHCDEMO I/O buffer size - see the COMPx and TAG commands.

lba is the starting block address.

etl is the expected transfer length. If not specified, etl will be set to (tl * dev_bs). If DMA is ON, etl is ignored.

This command forces LBA32 sector/block addressing mode.

Also see:  BLOCKSIZE DMA LBAIncr R10 R12 RCAp REPeat W10 W12

(Go To TOC)

[ READFile ]

(Go To TOC)

[ READ ]


READFile numBytes fileName [ offset [Check] ]
READ numBytes fileName [ offset [CHECK] ]

With or without the Check parameter data is read from file fileName into the buffer. No more than numBytes are read from the file. If offset is specified, reading begins at that byte offset in the file.

Without the Check parameter the built-in variable num_bytes to the actual number of bytes read from the file.

With the Check parameter the built-in variable num_bytes is set to an result code:

See the section FILE NAMES above for the description of how file names can be specified.

Also see:  WRITEFile

Examples:


   READFile 10 NEWLOG.TXT

      Read 10 bytes into the buffer from file NEWLOG.TXT.

   SET X = 583
   READFile (x) (x+3)

      Read 583 bytes into the buffer from file 586.BIN.

   SET Y = 8943
   SET Z = 26
   READFile 24 D{Y}.{*Z}H

      Read 24 bytes into the buffer from file D8943.1AH.

(Go To TOC)

[ READOnly ]


READOnly
READOnly OFf
READOnly ON
READOnly (n)

Display the current setting of readonly mode or turn readonly mode on or off.

READOnly ON places AHCDEMO into read only mode. In this mode the DPW, DW, PDO, PW, W, W10 and W12 commands are not allowed.

For READOnly (n), a zero value is the same as OFf and a non zero value is the same as ON.

Note: The READOnly command does not effect the READONLY option (the READOnly ON command as no effect if the READONLY option was used on the AHCDEMO command line).

Warning: While the READOnly option and READONLY command can be used to disable write commands, be careful, some Non-Data (ND) commands do write to the device media!

Warning: See "Variables that look like keywords" above.

Also see:  READONLY

(Go To TOC)

[ REPeat ]


REPeat count command

[FULL]

Repeat a device I/O command 'count' times. The commands marked with the symbol [DIO] may be used with the REPeat command.

The command will be repeated count times unless the CHSIncr or LBAIncr commands stop the repeating.

The first command of a REPeat is used as-is. The first command could be an invalid command or a command that stops the repeating.

Also see:  CHS CHSIncr EXPEcterror ID LBA LBAIncr ONERRor RCAp

(Go To TOC)

[ RESet ]


RESet
RESet COMReset
RESet INVAlidsrst
RESet PORT
RESet SRST
RESet PHYOff

[AUTO] [DIO] [REP]

Execute a COMRESET, port reset, Soft Reset or turn off the SATA PHY.

'RESet PHYOff' requires 'RESet COMReset' (or 'COMRESET') to turn the SATA PHY on.

RESet with no parameter is equivalent to 'RESet SRST'.

RESet INVAlidsrst issues an invalid SRST. This is two SATA CFIS both with C=0 and SRST=0. These should be ignored by a device.

Also see:  COMReset SRST

(Go To TOC)

[ RETurn ]


RETurn [n]

[FULL] [SCRIPT]

Return from a subroutine.

The built-in variable sub_return is set to either 0 or to the value n.

Note: The command "return sub_return" is equivalent to the command "return 0".

Also see:  ENDSub

(Go To TOC)

[ RNME ]


RNME

Execute an ATA READ NATIVE MAX EXT command.

Also see:  DCO

(Go To TOC)

[ RS ]


RS

[AUTO] [DIO] [REP]

Execute an ATAPI Request Sense command and display the request sense data received. Request Sense (ATAPI packet command code 03H) is a "packet read" (PR) command.

The data display is performed only during the first execution of a repeated RS command.

This command forces LBA32 sector/block addressing mode.

Also see:  SHOWx

(Go To TOC)

[ RSVW ]


RSVW sequence lba minSC maxSC [multiCount]
RSVW sequence cyl head sect minSC maxSC [multiCount]

[AUTO] [DIO] [FULL] [REP]

This command allows a sequence of write, read, seek and/or verify commands to be executed on an ATA device. The sequence of commands is specified using W, R, S and V characters in any order.

When used without the REPeat command, each command in the first and only sequence will use minSC and the specified LBA or CHS.

When used with the REPeat command, the first or only sequence of commands will use the specified LBA or CHS and minSC. The second and additional sequences will use a random sector count between minSC and maxSC. The LBA or CHS will be determined by the current CHSIncr/LBAIncr setting.

lba is the starting sector/block address.

minSC and maxSC are the minimum sector counts to use. In LBA28 these are values between 1 and 256. In LBA48 these are values between 1 and 65536.

If DMA is OFf and multiCount is not specified a W or R command uses Read or Write Sectors commands. In LBA48 mode the Read or Write Sectors Extended commands are used.

If DMA is OFf and multiCount is specified a W or R command use Read or Write Multiple commands. In LBA48 mode the Read or Write Multiple Extended commands are used.

If DMA is ON, multiCount is ignored and a W or R command uses Read or Write DMA commands. In LBA48 mode the Read or Write DMA Extended commands are used.

Also see:  CHSIncr DMA DR DW LBAIncr ND PDI PDO R REPeat W

Examples:


   RSVW SWRSR 90 4 4

      Execute a sequence of seek write read seek read commands,
      each command starting at LBA 90 with a sector count of 4.

   tag on
   before fillzero
   afternoerror compzero
   onerror continue
   lbai 10 7999
   rep 9999 rsvw wrr 5000 10 10 4

      Execute a sequence of write read read commands using binary
      zero data with sector tags.  Read/Write Multiple will be used
      with 4 sectors per block.  Each set of commands will use a
      sector count of 10.  The read commands will include
      data compare.  The first set of write, read, read commands
      will be done at LBA 5000, the second set at LBA 5010, the
      third set at LBA 5020, ... up to LBA 7990.

   tag on
   before fillone
   afternoerror compone
   onerror continue
   lbai random
   dma on
   rep 1000 rsvw wrr 0 1 20

      Execute a sequence of write read read commands using binary
      one data with sector tags.  Read/Write DMA commands will be
      used.  Each set of commands will use a random sector count
      between 1 and 20.  The read commands will include data
      compare.  The first set of write, read, read commands will be
      done at LBA 0, the second set and remaining sets will be at
      randomly selected LBA locations.

(Go To TOC)

[ RTOc ]


RTOc
RTOc format

[AUTO] [DIO] [REP]

Execute an ATAPI Read TOC command and display the TOC data received. Read TOC (ATAPI packet command code 43H) is a "packet read" (PR) command.

format specifies the format of the TOC returned by the device. format is 0, 1 or 2. The default is 2. This value is placed into bits 7 and 6 of CDB byte 9.

The data display is performed only during the first execution of a repeated RTOc command.

This command forces LBA32 sector/block addressing mode.

Also see:  SHOWx

(Go To TOC)

[ RUNID ]


RUNID [n]

Display or change the current Run ID value (a 4 byte value). The default Run ID is the program start time (see start_time). The current Run ID is in the varable run_id.

Also see:  COMPx FILLx start_time run_id

(Go To TOC)

[ R10 ]


R10 tl lba [etl]

See R12 command description below.

(Go To TOC)

[ R12 ]


R12 tl lba [etl]

[AUTO] [DIO] [REP]

Execute an ATAPI Read 10 or Read 12 command. Read 10 (ATAPI packet command code 28H) and Read 12 (ATAPI packet command code 2AH) are "packet read" (PR) commands. If DMA is ON, the data transfer will be done in DMA mode. If DMA is OFf, the data transfer will be done in PIO mode.

tl is the transfer length (number of blocks to read).

The data transfer of a R10 or R12 command may be up to 33Mbytes (65536*512 bytes). Data compare is bypassed for a data transfer that is larger than the AHCDEMO I/O buffer size - see the COMPx and TAG commands.

lba is the starting block address.

etl is the expected transfer length. If not specified, etl will be set to (tl * dev_bs). If DMA is ON, etl is ignored.

This command forces LBA32 sector/block addressing mode.

Also see:  BLOCKSIZE DMA LBAIncr RCAp RCD REPeat W10 W12

(Go To TOC)

[ S10 ]


S10 lba

[AUTO] [DIO] [REP]

Execute an ATAPI Seek 10 command.

This command is equivalent to the following command


   pn 4096 2bh 0 lba3 lba2 lba1 lba0 0 0 0 0 0 0

If this command is repeated the LBA will be updated by the LBAIncr command.

This command forces LBA32 sector/block addressing mode.

Also see:  CHSIncr LBAIncr PN REPeat Seek

(Go To TOC)

[ SAYx ]

See SAY, SAYFail and SAYPass below.

(Go To TOC)

[ SAY ]


SAY text

[FULL]

See the section TEXT STRING FORMATING for the rules on how 'text' strings are used with this command.

SAY messages will display even if all message levels are turned off.

Note: The first character of the message text can be used to control the message color. The following characters will change the message color: '*', '>', '?', '#' and '!'.

Also see:  SAYFail SAYPass WL WRITEText

Examples:


   SAY ! Display this message now !

      Will display "! Display this message now !"
      in the error message color.

   SAY max_lba is {max_lba} 0x{*max_lba} {*max_lba}H

      Will display "max_lba is 4098 0x1002 1002H"
      (assuming max_lba is 4098).

   


SAYFail
SAYPass

[FULL]

Displays a large block message with the word FAIL or PASS. These messages will display even if all message levels are turned off.

(Go To TOC)

[ SCRipt ]


SCRipt fileName

[FULL]

Load and execute a script file.

The script file is read, compiled and executed. The new script replaces the current script.

See the section FILE NAMES above for the description of how file names can be specified.

Execution of the script begins with the first command of the script, also known as the first line in the main part of the script file.

A script file contains a main part followed by zero, one or more subroutine definitions. The main part can have zero, one or more commands. The main part ends at the first BEGINSub command or at the end of the script file.

After the script file is loaded execution begins with the first line of the main part. If the main part exection ends with a BEGINSub or QUit command AHCDEMO returns to keyboard mode and the PUBlic subroutines defined by the script file can be executed by using the CAll command from the keyboard.

Warning: A script file can define PUBlic subroutines that have the same name as any AHCDEMO command. For commands enter at the keyboard this has the effect of replacing the AHCDEMO command.

Loading a new script does not alter any of the command settings, such as the current CHS, ECHO, LBA or TAG, etc, setting. Loading a script does not alter any built-in or user defined variables, except the script_flag built-in variable.

The built-in variable script_flag counts the number of times any part of the script is executed using the SCRipt or CAll commands. The SCRipt command sets script_flag so that script_flag is zero only when the main part of a script is executing.

See the #NEXT directive and the Script File User Guide (SCRIPTS.HTM).

Also see:  BEGINSub CAll ENDSub SLIST #NEXT

Examples:


   SCRIPT NEWLOG.TXT   ; script file name is 'NEWLOG.TXT'

   SET X = 583
   SCRIPT (x+3)  ; script file name is '586.DSF'

   SET Y = 8943
   SET Z = 26
   SCRIPT D{Y}.{*Z}H ; script name is 'D8943.1AH

(Go To TOC)

[ Seek ]


Seek lba
Seek cyl head sect

[AUTO] [DIO] [REP]

Execute an ATA Seek command.

Note: The ATA Seek command is obsolete. There is no LBA48 Seek command (no SEEK EXT command).

This command is equivalent to one of the following commands


   nd 70h 0 1 lba
   nd 70h 0 1 cyl head sect

Also see:  CHSIncr LBAIncr ND PN REPeat S10

(Go To TOC)

[ SET ]


SET varName [=] n
varName = n

[FULL]

See the description of "user defined variables" above.

Creates a global variable and assigns the value n to it. In a subroutine if varName is a local user defined variable the SET command is converted to a LOCAL command.

Variable names must begin with an alphabetic character and must contain only alphabetic and numeric characters.

In the first format (using SET) the equal sign is optional.

In the second format varName must not be the name of an AHCDEMO command and the equal sign (=) is required.

Example:


   set a 1
   set b = 4
   SET x ( a + 3 * b - 2 )
   Say X is now {x}

      Will display "X is now 11"

This example is equivalent to the example above:


   a = 1
   b = 4
   x = ( a + 3 * b - 2 )
   Say X is now {x}

      Will display "X is now 11"

Also see:  ASK ASKYN FETCHx LOCAL

(Go To TOC)

[ SF ]


SF
SF PIo n
SF SW n
SF MW n
SF ULtra n
SF DRC
SF ERC
SF DWC
SF EWC

[AUTO] [DIO] [REP]

Execute an ATA Set Features command to set the PIO, Single Word DMA, MultiWord DMA, UltraDMA mode, or, to disable read cache (DRC), enable read cache (ERC), disable write cache (DWC) or enable write cache (EWC).

SF with no parameters displays help for the SF commands.

This command is equivalent to one of the following commands


   nd efh 03h x lba           ; set pio, sw, mw, u-dma
   nd efh 03h x cyl head sect ; set pio, sw, mw, u-dma
   nd efh y 0 0               ; read/write cache on/off
   nd efh y 0 0 0 0           ; read/write cache on/off

Where x is the value for the PIO, SW, MW or U-DMA setting and y is the value to turn read or write cache on/off.

Also see:  ND REPeat

(Go To TOC)

[ SHOW ]


SHOW
SHOW DEC
SHOW HEX

Displays help for the SHOWx commands.

DEC and HEX select the format of the sector and byte offsets in the Dump and SHOW output, either decimal or hexadecimal. The default is HEX.

Also see:  Dump

(Go To TOC)

[ SHOWx ]


SHOWx

See SHOWCB, SHOWCH, SHOWCI, SHOWDCo, SHOWDI, SHOWFPq, SHOWID, SHOWINq, SHOWLL, SHOWPC, SHOWRS and SHOWTOc below.

(Go To TOC)

[ SHOWCB ]


SHOWCB

Read and display the ATA Command Block.

(Go To TOC)

[ SHOWCH ]


SHOWCH

Display the command history buffer.

Also see:  Clear SHOWx

(Go To TOC)

[ SHOWCI ]


SHOWCI

DIsplay the command information - includes the AHCI port registers and sent/received FIS data buffers.

(Go To TOC)

[ SHOWDCo ]


SHOWDCo

Assume the sector buffer contains DCO ID or SET data and display the data.

(Go To TOC)

[ SHOWDI ]


SHOWDI

Display the device information data - includes the current device state (interface speed, signature values, etc).

(Go To TOC)

[ SHOWFPq ]


SHOWFPq

Display the current FP Queue.

Also see:  FPQx

(Go To TOC)

[ SHOWID ]


SHOWID

Assume the sector buffer contains ATA or ATAPI Identify data and display the data.

Also see:  DUMPId ID

(Go To TOC)

[ SHOWINq ]


SHOWINq

Assume the sector buffer contains ATAPI Inquiry data and display the data.

Also see:  INQ

(Go To TOC)

[ SHOWLL ]


SHOWLL

Display the low level trace buffer.

Also see:  Clear SHOWx

(Go To TOC)

[ SHOWPC ]


SHOWPC

Show results of last ATA or ATAPI command.

(Go To TOC)

[ SHOWRS ]


SHOWRS

Assume the sector buffer contains ATAPI Request Sense data and display the data.

Also see:  RS

(Go To TOC)

[ SHOWTOc ]


SHOWTOc

Assume the sector buffer contains ATAPI CD-ROM TOC data and display the dat.

Also see:  RTOc

(Go To TOC)

[ SLIST ]


SLIST fileName

[FULL]

Run the specified script list. See the SCRIPT LISTS above.

Also see:  SCRipt SLOPTION

(Go To TOC)

[ SLOPTION ]


SLOPTION [LOOP n] [TIME n]

[FULL]

Use this command before an SLIST commands to set the Script List repeat options.

SLOPTION with no parameters displays the current settings.

SLOPTION LOOP sets the maximum loop count. A value of zero means the loop count is not checked.

SLOPTION TIME sets the maximum run time in minutes. A value of zero means the max time is not checked.

Also see:  SCRipt SLIST slist_*

(Go To TOC)

[ SLUMBER ]


SLUMBER

[DIO] [FULL]

Place the SATA interface into Slumber mode.

Note: Moving directly between Partial and Slumber modes is not legal. Slumber can only be entered from Active mode.

Also see:  ACTIVE PARTIAL

(Go To TOC)

[ SM ]


SM multiCount

[AUTO] [DIO] [REP]

Execute an ATA Set Multiple command.

This command is equivalent to one of the following commands


   nd c6h 0 multiCount lba
   nd efh 0 multiCount cyl head sect

Where multiCount is the Set Multiple block count value.

Also see:  ND REPeat

(Go To TOC)

[ SMART ]


SMART DIsable
SMART ENable
SMART RData
SMART RLog logAddr numPages
SMART STatus
SMART WLog logAddr numPages

[AUTO] [DIO] [REP]

Execute an ATA SMART command.

The SMART command forces LBA28.

This command is equivalent to one of the following commands


   nd  b0h d9h 0 c24f00h    ; disable
   nd  b0h d8h 0 c24f00h    ; enable
   pdi b0h d0h 1 c24f00h    ; read data
   pdi b0h d5h n c24fxxh    ; read log
   nd  b0h dah 0 c24f00h    ; return status
   pdo b0h d6h n c24fxxh    ; write log

where n is numPages and xx (as a hex value) is the log address.

SMART STatus displays the status returned by the device (OK or threshold exceeded).

Also see:  GPL ND REPeat

(Go To TOC)

[ SRST ]


SRST

Execute Soft Reset (SRST). Same as RESet SRST.

Also see:  RESet

(Go To TOC)

[ SSS ]


SSS option

[FULL]

This command controls the single step script function. Use this command to debug script files. When this command is active and AHCDEMO is executing a script file, AHCDEMO will pause before executing the selected script command.

SSS with no parameter displays the current setting.

option is any combination of the following characters:


   A - pause before all commands.
   B - pause before IF commands.
   C - pause before CAll commands.
   I - pause before I/O commands.
   N - turn off SSS pause.
   R - pause before REPeat commands.
   W - pause before WHILE commands.

When AHCDEMO pauses before a command:

Examples:


   SSS NA      // equivalent to SSS A
   SSS BCIRW   // equivalent to SSS A
   SSS AIWNB   // equivalent to SSS B
   SSS IN      // equivalent to SSS N

(Go To TOC)

[ SSU ]


SSU [option]

[AUTO] [DIO] [REP]

Execute an ATAPI Start/Stop Unit command. Start/Stop Unit (ATAPI packet command code 1BH) is a "packet no data" (PN) command.

option specifies the value of the Load Eject and Start bits. option is 0, 1, 2 or 3. The default is 0. This value is placed into bits 1 and 0 of CDB byte 4.

This command forces LBA32 sector/block addressing mode.

(Go To TOC)

[ STOREx ]

See STORE, STOREBUF and STORECDB below.

(Go To TOC)

[ STORE ]


STORE sectorOffset byteOffset n ...

Store bytes of data into the buffer.

sectorOffset is 0 to one less than the maximum number of sectors that fit into the buffer.

byteOffset is 0 to one less than the size of a sector.

n is the value of each byte to be stored into the buffer.

Also see:  ALTER BLOCKSIZE FETCHBUF FILLx ID RCAp STOREBUF

(Go To TOC)

[ STOREBUF ]


STOREBUF sectorOffset byteOffset size value
STOREBUF sectorOffset byteOffset size value BE
STOREBUF sectorOffset byteOffset size value LE

[FULL]

Store a 1 to 8 byte value into the buffer. sectorOffset is 0 to one less than the maximum number of sectors that fit into the buffer. byteOffset is 0 to one less than the size of a sector.

size is the number of bytes to place into the buffer. size is 1 t0 8.

value is the value to store.

Use BE if the buffer data is in Big Endian format. Use LE if the buffer data is in Little Endian format. BE is the default.


   big = 0x1f2e.3d4c.5b6a.7988
   storebuf 0 0 2 big
   // buffer now contains 79 88 (in hex)
   storebuf 0 0 4 big
   // buffer now contains 5b 6a 79 88 (in hex)
   storebuf 0 0 8 big
   // buffer now contains 1f 2e 3d 4c 5b 6a 79 88 (in hex)
   storebuf 0 0 2 big LE
   // buffer now contains 88 79 (in hex)
   storebuf 0 0 4 big LE
   // buffer now contains 88 79 6a 5b (in hex)
   storebuf 0 0 8 big LE
   // buffer now contains 88 79 6a 5b 4c 3d 2e 1f (in hex)

Also see:  ALTER BLOCKSIZE FETCHBUF FILLx ID RCAp STORE

(Go To TOC)

[ STORECDB ]


STORECDB offset size value

[FULL]

Store data into the CDB buffer used to issue Packet commands.

offset is the offset into the CDB buffer. size is either 0 to 11 or 0 to 15.

size is the number of bytes to place into the CDB buffer. size is 1, 2, 3 or 4.

value is the value to store. value is a 32-bit signed value.

The rightmost 'size' bytes of value are stored into the CDB buffer starting at 'offset'.

LBA, Transfer Length and other multi-byte data fields in a SCSI CDB is in Big Endian format.


   x = 0x1122334
   STORECDB x 4 4
   // CDB bytes 4 to 7 will contain 0x11223344 (not 0x44332211)

Another example, execute a Read 10 command:


   SET CMDCODE 28H            ; command code to use
   SET SLBA 1036              ; starting lba
   STORECDB 0 1 CMDCODE       ; store the command code
   STORECDB 2 4 SLBA          ; store the lba
   STORECDB 7 2 4             ; store the transfer length of 4
   ; now zero the other bytes of the CDB when
   ; the command is issued...
   PR * 0 * * * * 0 * * 0 0 0 ; execute the command !

Also see:  FETCHCDB

(Go To TOC)

[ STRx ]

See the STRAVC, STRAVF, STRAVS, STRCMP, STRCOMV, STRFBUF, STRFIND, STRLEN, STRLWR, STRPARSE, STRSBUF, STRSET, STRSTRIP, STRSUB and STRUPR commands below.

These commands perform variable operations on the built-in str_s* string variables or on the string array variables.

The STRx comands set the built-in variable str_result with the result of the command execution.

String array example:


   // store string str_s0 into string[12]
   strset str_s0 the quick brown fox
   stravs 12 str_s0
   // copy string[12] to string[22]
   stravc 12 22
   // fetch string[22] into str_s1
   stravf str_s1 22

(Go To TOC)

[ STRAVC ]


STRAVC fromAvNdx toAvNdx

Copy string array variable fromAvNdx to string array variable toAvNdx.

str_result is set to the length of the string.

Also see:  STRAVF STRAVS str_result

(Go To TOC)

[ STRAVF ]


STRAVF strVar avNdx

Fetch the string in string array variable avNdx into the string variable strVar. See example above.

str_result is set to the length of the string.

Also see:  STRAVC STRAVS str_result

(Go To TOC)

[ STRAVS ]


STRAVS avNdx strVar

Store the string in string variable strVar into the string array variable avNdx. See example above.

str_result is set to the length of the string.

Also see:  STRAVC STRAVS str_result

(Go To TOC)

[ STRCMP ]


STRCMP strVar1 strVar2

Compare two strings.

str_result is set to -1, 0 or 1.

Also see:  str_result

Examples:


   strset str_s5 model123
   strset str_s7 m123
   strcmp str_s5 str_s7
      // sets str_result=1
   strcmp str_s7 str_s5
      // sets str_result=-1
   strcmp str_s7 str_s7
      // sets str_result=0

(Go To TOC)

[ STRCONV ]


STRCONV varName strVar

See the description of "user defined variables" above.

The numeric character string is converted to a binary value and stored in the user defined variable. The numeric string follows the same rules as numeric parameters to AHCDEMO commands.

varName will be defined if it does not exists.

str_result is set to 0 if the conversion was sucessful. str_resultis set to 1 if the conversion failed. varName is not defined or changed if the conversion fails.

Also see:  str_result

Examples:


   strset str_s6 123
   strset str_s7 -456
   strset str_s8 0x23
   strset str_s9 1M2N
   strconv x str_s6
      // sets str_result=0, sets x=123
   strconv x str_s7
      // sets str_result=0, sets x=-456
   strconv x str_s8
      // sets str_result=0, sets x=35
   strconv x str_s9
      // sets str_result=1, x is not changed

(Go To TOC)

[ STRFBUF ]


STRFBUF strVar sectorOffset byteOffset

Fetch a string from the buffer. Bytes are fetched from the buffer until a NULL character (0x00) is fetched or 96 characters have been fetched.

Also see:  str_result STRSBUF

(Go To TOC)

[ STRFIND ]


STRFIND strVar1 strVar2

str_result is set to the offset of string2 within string1. If string2 is not found str_result is set to -1.

Also see:  str_result

Examples:


   strset str_s3 this is a string
   strset str_s5 this
   strfind str_s3 str_s5
      // set str_result=0
   strset str_s5 a
   strfind str_s3 str_s5
      // set str_result=8
   strset str_s5 xyz
   strfind str_s3 str_s5
      // set str_result=-1

(Go To TOC)

[ STRLEN ]


STRLEN strVar

str_result is set to the length of the string.

Also see:  str_result

Examples:


   strset str_s3 this is a string
   strlen str_s3
      // sets str_result=16

(Go To TOC)

[ STRLWR ]


STRLWR strVar

Converts the string to lower case.

Examples:


   strset str_s3 AaBc12Xx
   strupr str_s3
      // sets str_result=8,
      // str_s3 is now "aabc12xx"

Also see:  str_result STRUPR

(Go To TOC)

[ STRPARSE ]


STRPARSE strVar1 strVar2 strVar3

Using the first character in string3 as a delimiter, copy characters from string2 to string1 up to but not including the delimiter character.

str_result is set to the length of string1.

Also see:  str_result

Examples:


   strset str_s4 1.02/A7-Q1
   strset str_s5 .
   strset str_s6 -
   strfind str_0 str_s5 str_s5
      // sets str_s0 to "1", str_result=1
   strfind str_0 str_s5 str_s6
      // sets str_s0 to "1.02/A7", str_result=7

Also see:  str_result STRSUB

(Go To TOC)

[ STRSBUF ]


STRSBUF sectorOffset byteOffset strVar

Store a string into the buffer.

Also see:  str_result STRFBUF

(Go To TOC)

[ STRSET ]


STRSET strVar [text]

Set the string to a new value.

See the section TEXT STRING FORMATING for the rules on how 'text' strings are used with this command.

str_result is set to the length of the string.

Also see:  str_result ASKSTR Sn=string

Examples:


   set count = 3
   strset str_s5 too low
   strset str_s0 value{count1} is {str_s5}.
      // str_s0 is set to "value3 is too low.",
      // str_result=18
   strset str_s0 str_s5
      // str_s0 is set to "str_s5",
      // str_result=6
   strset str_s0 {str_s5}
      // str_s0 is set to "too low",
      // str_result=7

(Go To TOC)

[ STRSTRIP ]


STRSTRIP strVar

Remove all leading and trailing spaces (0x20 characters) from a string value.

str_result is set to the length of the result. The resulting string could have zero length.

Also see:  str_result STRPARSE

(Go To TOC)

[ STRSUB ]


STRSUB strVar1 strVar2 offset length

Sets string1 to the substring from string2.

offset is the starting offset of the substring (0 to 96), length is the length of the substring (0 to 96).

str_result is set to the length of string1 (may be less than length).

Also see:  str_result STRPARSE

Examples:


   strset str_s0 1234567890abcdefgh
   strsub str_s1 str_s0 0 3
      // sets str_s1 to "123", sets str_result=3
   strsub str_s1 str_s0 3 5
      // sets str_s1 to "45678", sets str_result=5
   strsub str_s1 str_s0 9 15
      // sets str_s1 to "0abcdefgh", sets str_result=9
   strsub str_s1 str_s0 9 0
      // sets str_s1 to "", sets str_result=0

(Go To TOC)

[ STRUPR ]


STRUPR strVar

Converts the string to upper case.

Also see:  str_result STRLWR

Examples:


   strset str_s3 AaBc12Xx
   strupr str_s3
      // sets str_result=8,
      // str_s3 is now "AABC12XX"

(Go To TOC)

[ TAG ]


TAG

Display the current setting of sector tagging or turn sector tagging on and off for the currently selected device.


TAG OFf
TAG ON
TAG (n)

The sector tag is the Run ID and the LBA of the sector. This data is at offsets:


   244-247 - one's complement of the Run ID.
   248-251 - Run ID.
   252-255 - LBA bits 31:0
   256-259 - LBA bits 63:32 (bits 63:48 are zero).

Sector tagging is allowed only if the BLOCKSIZE value for the device is greater than 512 bytes.

When sector tagging is off the FILLx commands do not insert the Run ID or LBA of the sector into the buffer. When sector tagging is on the FILLx commands will insert the Run ID and LBA of the sector into the buffer.

When sector tagging is off the COMPx commands do not expect a sector tag in a sector's data. When sector tagging is on the COMPx commands will verify that the sector's tag data is correct.

For TAG (n), a zero value is the same as OFf and a non zero value is the same as ON.

Warning: See "Variables that look like keywords" above.

Also see:  COMPx DUMPCt DUMPTag FILLx RUNID start_time run_id

(Go To TOC)

[ TUR ]


TUR

[AUTO] [DIO] [REP]

Execute an ATAPI Test Unit Ready command. Test Unit Ready (ATAPI packet command code 00H) is a "packet non-data" (PN) command.

This command forces LBA32 sector/block addressing mode.

Also see:  LBA

(Go To TOC)

[ UDVAR ]


UDVAR CLEANUP
UDVAR DELETEALL
UDVAR SAVE

[FULL]

The UDVAR command can be used to cleanup the list of current user defined variables. This is most useful in script files, especially in script files executed via the SLIST command. See the EDVT test scripts CONFIG0.DSF and BEFORE0.DSF as an example of UDVAR usage.

DELETEALL deletes ALL user defined variables. Use with care! The internal user defined variable index is set to 0.

CLEANUP deletes all user defined variables defined since either: a) the program started, or b) the most recent 'UDVAR SAVE' command. The internal user defined variable index is set back to most recent saved value.

SAVE saves the current user defined variable index. This index is internal to the program. It is incremented each time a user defined variable is defined.

The DUMPVar command will show the current UDVAR saved location in the list of user defined variables.

Also see:  DUMPVar

(Go To TOC)

[ V ]


V sectorCount lba
V sectorCount cyl head sect

[AUTO] [DIO] [REP]

Execute an ATA Read Verify command.

This command is equivalent to one of the following commands


   ND 40h 0 sectorCount lba
   ND 40h 0 sectorCount cyl head sect
   ND 42h 0 sectorCount lba

Also see:  CHSIncr LBAIncr REPeat

(Go To TOC)

[ W ]


W sectorCount lba [multiCount]
W sectorCount cyl head sect [multiCount]

[AUTO] [DIO] [FULL] [REP]

Execute an ATA Write Sectors, Write Multiple or Write DMA command.

If DMA is OFf and multiCount is not specified the W command is equivalent to


   PDO 30h 0 sectorCount lba
   PDO 30h 0 sectorCount cyl head sect
   PDO 34H 0 sectorCount lba

If DMA is OFf and multiCount is specified the W command is equivalent to


   PDO C5h 0 sectorCount lba multiCount
   PDO C5h 0 sectorCount cyl head sect multiCount
   PDO 39h 0 sectorCount lba

If DMA is ON, multiCount is ignored and the W command is equivalent to


   DW 0 sectorCount lba
   DW 0 sectorCount cyl head sect

Note that sector tagging is done only in LBA mode.

Also see:  CHSIncr DMA DR DW LBAIncr PDI PDO R REPeat

(Go To TOC)

[ WBUF ]


WBUF [feature sectorCount lba]

Execute an ATA WRITE BUFFER (DMA OFf) or WRITE BUFFER DMA (DMA ON) command. If no parameters are specified Feature is set to zero, Sector Count is set to one, and LBA is set to zero.

The RBUF and WBUF commands force LBA48 so that 16-bit values can be placed into the Feature and Sector Counter fileds and 48-bit values can be placed into the LBA field.

Also see:  DMA RBUF

(Go To TOC)

[ WHILE ]


WHILE n

[FULL] [SCRIPT]

Define the beginning of a WHILE loop. Commands within the WHILE loop are executed while the value of n is not zero.

Example:


   set x = 0
   while ( x < 100 )
      if ( x % 4 == 0 )
         say x is a multiple of 4
      endif
      if ( x == y )
         break;
      endif
      if ( x == z )
         continue
      endif
      say x is {x}
      set x = x + 1
   endwhile

Also see:  BReak COntinue ENDWHile

(Go To TOC)

[ WINdow ]


WINdow ASK varName

[FULL] [SCRIPT]

See the description of "user defined variables" above.

Asks the user to select a item (row) in the window area.

varName is the name of a user defined variable that will be set to a value between 0 and 9 indicating the item (row) that was selected by the user.

The user is allowed to highlight rows on the screen that have a '[' character as the left most character. To make the selection the enter key must be pressed. The value assigned to varName is base on the single character to the right of the '[' character:


   [n or [N sets varName to 0.
   [y or [Y sets varName to 1.
   [0       sets varName to 0.
   [1       sets varName to 1.
   [2 to [9 sets varName to 2 to 9.

Also see:  ASK ASKYN ASKSTR SAYx SET WINdow


WINdow CLEAR

[FULL] [SCRIPT]

Clears the window area of the screen and sets the row number to 1. The next SAY command will place data at this window location.

Also see:  SAY SAYFail SAYx WINdow


WINdow CLOSE

[FULL] [SCRIPT]

This command closes window mode. The normal output screen is restored when closed.

Also see:  SAY SAYFail SAYx WINdow


WINdow COLOR fb

[FULL] [SCRIPT]

Set the foreground and background colors for the window area of the screen. These colors are used until the next COLOR command.

fb is two characters. The first character sets the foreground color. The second character sets the background color. These characters are:


   k or K - black
   b or B - blue
   g or G - green
   c or C - cyan
   r or R - red
   m or M - magenta
   y or Y - yellow
   w or W - white

The lower case character results in a low intensity color and a upper case character results in a high intensity color.

The next SAY, SAYFail or SAYPass command will use these colors.

Also see:  SAY SAYFail SAYx WINdow


WINdow GOTO n

[FULL] [SCRIPT]

Sets the row number to row n of the window. The next SAY, SAYFail or SAYPass command will place data at this window location.

Also see:  SAY SAYFail SAYx WINdow


WINdow OPEN

[FULL] [SCRIPT]

This command opens the window area of the screen. The window area is all the lines on the screen except the bottom two lines (the status and input lines). The window area will remain open until the end of the current script file execution or until a WINdow CLOSE command.

While in window mode only the ASK, ASKYN, SAY, SAYFail and SAYPass commands send messages to the window area of the screen. The ASK and ASKYN commands use the bottom two lines of of the screen.

The windows area is cleared when opened and the row number is set to 1.

The normal output screen is restored when closed.

Also see:  SAY SAYFail SAYx WINdow

(Go To TOC)

[ WL ]


WL text

[FULL]

This command writes a message into the log file.

See the section TEXT STRING FORMATING for the rules on how 'text' strings are used with this command.

Also see:  SAYx WRITEText

Examples:


   WL Display this message now!

      Will log the message "Display this message now!".

   WL max_lba is {max_lba} 0x{*max_lba} {*max_lba}H

      Will log the message "max_lba is 4098 0x1002 1002H"
      (assuming max_lba is 4098).

(Go To TOC)

[ WRITEFile ]

(Go To TOC)

[ WRITE ]


WRITEFile numBytes fileName [Append]
WRITE numBytes fileName [Append]

The first numBytes of the buffer are written or appended to the file fileName.

The WRITEFile command sets the built-in variable num_bytes to the actual number of bytes written to the file.

See the section FILE NAMES above for the description of how file names can be specified.

Also see:  READFile

Examples:


   WRITEFile 10 NEWLOG.TXT

      Write 10 bytes from the buffer into file NEWLOG.TXT.

   SET X = 583
   WRITEFile (x) (x+3)

      Write 583 bytes from the buffer into file 586.BIN.

   SET Y = 8943
   SET Z = 26
   WRITEFile 24 D{Y}.{*Z}H

      Write 24 bytes from the buffer into file D8943.1AH.

(Go To TOC)

[ WRITEText ]


WRITEText fileName text

[FULL]

The text is written to specified file.

See the section FILE NAMES above for the description of how file names can be specified.

See the section TEXT STRING FORMATING for the rules on how 'text' strings are used with this command.

Also see:  SAYx WL

Examples:


   WRITEText NEWLOG.TXT Display this message now!

      Will write the message "Display this message now!"
      to the file NEWLOG.TXT.

   SET X = 583
   WRITEText (x+3) max_lba is {max_lba} 0x{*max_lba} {*max_lba}H

      Will write the message
      "max_lba is 4098 0x1002 1002H"
      (assuming max_lba is 4098) to file 586.TXT.

   SET Y = 8943
   SET Z = 26
   WRITEText D{Y}.{*Z}H We have an error here.

      Will write the message "We have an error here."
      to file D8943.1AH.

(Go To TOC)

[ W10 ]


W10 tl lba [etl]

See W12 command description below.

(Go To TOC)

[ W12 ]


W12 tl lba [etl]

[AUTO] [DIO] [FULL] [REP]

Execute an ATAPI Write 10 or Write 12 command. Write 10 (ATAPI packet command code 2AH) and Write 12 (ATAPI packet command code AAH) are "packet write" (PW) commands. If DMA is ON, the data transfer will be done in DMA mode. If DMA is OFf, the data transfer will be done in PIO mode.

tl is the transfer length (number of blocks to write).

The data transfer of a W10 or W12 command may be up to 33Mbytes (65536*512 bytes). Data generation is limited for a data transfer that is larger than the AHCDEMO I/O buffer size - see the FILLx and TAG commands.

lba is the starting block address.

etl is the expected transfer length. If not specified, etl will be set to (tl * dev_bs). If DMA is ON, etl is ignored.

This command forces LBA32 sector/block addressing mode.

Also see:  BLOCKSIZE DMA LBA LBAIncr RCAp RCD REPeat R10 R12

(Go To TOC)

[ (EqSign) ]


(EqSign)

This command is a single equal sign character (=) entered at the keyboard.

Repeat the last AHCDEMO command. This command is not allowed in a script file.

Also see:  (EqSignEqSign)

(Go To TOC)

[ (EqSignEqSign) ]


(EqSignEqSign)

This command is two equal sign characters (==) entered at the keyboard.

Clear the trace buffers and repeat the last AHCDEMO command. This command is not allowed in a script file.

(Go To TOC)

[ (Slash) ]


(Slash)

This command is a single slash character (/) entered at the keyboard.

Repeat the last device I/O command. See the commands marked with the symbol [DIO]. This command is not allowed in a script file.

Also see:  (SlashSlash)

(Go To TOC)

[ (SlashSlash) ]


(SlashSlash)

This command is two slash characters (==) entered at the keyboard.

Clear trace buffers and repea the last device I/O command. See the commands marked with the symbol [DIO]. This command is not allowed in a script file.

(Go To TOC)

[ #NEXT ]


#NEXT fileName

This directive tells the script file compiler to stop processing the current script file and begin processing the script file fileName. This is similar to but not the same as #INCLUDE found in some programming languages in that the compiler never returns to reading the file that contains the #NEXT directive.

fileName is used as-is.

Use this to include a script file of common subroutines that are used by other script files.

Any files appended to the root script file are considered to be part of the root script file for line numbering and error messages.

See the SCRipt command and the Script File User Guide (SCRIPTS.HTM).

Also see:  SCRipt

(Go To TOC)

USING FPQx COMMANDS

The FPQx commands (FPQCLEAR, FPQGO, FPQR and FPQW) can be used to perform a sequential write or read of an LBA range. But remember that the actual execution order of the commands inside the drive is most likely to be very random.

The following example shows how to sequentially write an LBA range using 32 sector NCQ/FPDMA writes using 4 tag numbers:


   fillz   // data pattern to write
   fpqw 32 32 1000000 3000000 0 0   // tag 0
   fpqw 32 32 1000032 3000000 0 1   // tag 1
   fpqw 32 32 1000064 3000000 0 2   // tag 2
   fpqw 32 32 1000096 3000000 0 3   // tag 3
   fpgo 99999999 128

The resulting writes are:

Beyond the first write at LBA 1000000 by tag 0, the order these commands are sent to the drive is unknown and may appear to be random, and, the order the drive completes the commands in may also appear to be random.

(Go To TOC)

USING CHSIncr, LBAIncr and REPeat COMMANDS

The CHSIncr, LBAIncr and REPeat commands are the most powerful commands in AHCDEMO. These commands can be used to execute commands over the entire media or on only part of the media. Below are some examples of using the LBAIncr command. These examples would operate the same in CHS mode and with commands other than a "read" command. Assume that an ID or RCAp command was successful before any of these examples are executed.

1) Read every sector reading 10 sectors at a time.


   lbaincr 10
   repeat 999999999 r 10 0

2) Read 10 sectors at random locations. Execute 15000 reads.


   lbaincr random
   repeat 15000 r 10 0

3) Read every sector from LBA 11000 to 19999 8 sectors at a time.


   lbaincr 8 20000
   repeat 99000 r 8 11000

4) Read 8 sectors at random locations within LBA 11000 to 19999. Execute 15000 reads.


   lbaincr random 20000
   repeat 15000 r 8 11000

5) Read 100 sectors, skip the next 50 sectors and repeat.


   lbaincr 150
   repeat 999999 r 100 0

6) Read all the sectors in decending LBA order.


   lbaincr -1
   repeat 99999999 r 1 max_lba

7) Do overlapping reads in decending LBA order.


   lbaincr -10
   repeat 99999999 r 20 max_lba

8) Using TL can make a script file smaller.


   lbaincr tl
   repeat 5000 r 1 0
   repeat 5000 r 2 0
   repeat 5000 r 3 0

   is equivalent to

   lbaincr 1
   repeat 5000 r 1 0
   lbaincr 2
   repeat 5000 r 2 0
   lbaincr 3
   repeat 5000 r 3 0

9) Execute an ATA Identify command with random data in the SN, CL, CH and DH (bits 3-0) registers.


   lbaincr random
   repeat 100 pdi ech 0 0 0

10) Also see the examples in the RSVW command description.

(Go To TOC)

Editor

Also see:  EDITx EDIT EDITKB EDITSF

The AHCDEMO editor is also available as a stand alone program named AEDIT. See the AEDIT User Guide (AEDIT.HTM).

The AHCDEMO editor may be used to edit any plain text file.

The editor inforces the basic file formatting rules required in AHCDEMO script files. Those rules are:

Editor Screen Format

The top line of the screen shows the following information:

The bottom line of the screen shows the following information and/or error messages:

Editor Keys and Functions

AEDIT is a full screen editor. Characters typed are normally placed into the current line at the current cursor position. Only the keys 20H (space) to 7EH (~) are allowed.

The following keys invoke editor functions:

ALT-A

A a line following the current cursor position.

ALT-C

Copy the marked lines after the current cursor position. Use ALT-L to mark lines.

ALT-D

Delete the line at the current cursor position.

ALT-E

Move the cursor to the end of the file.

ALT-F

Enter a search string and find the next occurance of the string.

ALT-G

Find the next occurance of the search string.

ALT-H

Display ALT key help.

ALT-K

Delete the marked block of lines. Use ALT-L to mark lines.

ALT-L

Mark lines. Move the cursor to the first line to be marked and press ALT-L. If marking more than one line, move the cursor up or down to the last line to be marked and press ALT-L again. Then use the ALT-C, ALT-K or ALT=M keys to copy, delete or move the marked block of line(s). Also see ALT-U.

ALT-M

Move the marked block of lines after the current cursor position.

ALT-T

Move the cursor to the top of the file.

ALT-U

Unmark any marked lines.

ALT-X

Exit/quit the editor. Causes the ALT-X menu to be displayed. See below.

CTRL-L

Shift marked line(s) left.

CTRL-R

Shift marked line(s) right.

BS

Move the cursor left and delete a character.

CTRL-END

Delete all characters to the right of the cursor position.

DEL

Delete the character at the cursor position.

DOWN

Move the cursor down one line.

END

Move the cursor to the end of the current line.

ENTER

Move the cursor to the left side of the next line.

ESC

Undo any changes to the current line since the cursor arrived on the line.

HOME

Move the cursor to the left side of the current line.

INS

Toggle replace/inser mode.

LEFT

Move the cursor left.

PGDN

Move the cursor down 1/2 of the screen size.

PGUP

Move the cursor up 1/2 of the screen size.

RIGHT

Move the cursor right.

UP

Move the cursor up one line.

Editor ALT-X Menu

The ALT-X key (or running out of free memory) will cause the ALT-X menu to be displayed. Use this menu to:

(Go To TOC)

HOW MUCH DATA WILL A DEVICE TRANSFER?

Some ATA/ATAPI commands transfer a fixed number of bytes. Generally these are commands that do not access the device media, such as IDENTIFY or RCAp.

On an ATA device for commands that access data on the media the amount of data transferred depends upon the type of command: non-data (ND), PIO Data In (PDI), PIO Data Out (PDO) or DMA In/Out. Non-data commands transfer no data. PIO Data In/Out and DMA In/Out commands transfer (N * sector_size) bytes where N is 0 to 256 (LBA28) or 0 to 65536 (LBA48). Note that N is 0 only when there is an error and the device rejects the command immediately.

For ATAPI devices, the answer is much more complex. First there is really only one ATAPI command protocol and the device can choose to make the command a command that transfers no data or a command that sends data to the host or a command that receives data from the host.

When the AHCDEMO PN command is used, AHCDEMO will signal an error if the device attempts to transfer data. No data will actually be transferred. When the PR or PW commands are used, AHCDEMO will transfer data up to 33Mbytes (65536*512 bytes).

The problem with ATAPI devices is that there are a wide range of implementations, may of which are not compliant with the ATA/ATAPI-x specification. An ATAPI device should obey the maximum data packet size that the host specifies when the A0H command is written into the ATA Command register. Many devices ignore this value. Many devices use this value incorrectly when commands like Request Sense are executed. This is the reason the PR and PW commands have an optional expected data transfer length parameter (etl). Use this command parameter to confirm that an ATAPI device is transfering the proper amount of data.

(Go To TOC)

ATAPI CD-ROM DRIVES

While ATAPI CD-ROM drives are really ATA devices and should execute ATA commands properly, many do not. One example (and this is just one of many examples) of incorrect ATAPI device design is not maintaining the proper ATA status during the execution of an ATAPI Identify command (command code A1H) and during the execution of the ATAPI Packet command (command code A0H).

Many of these ATAPI devices can operate with AHCDEMO but only if a special delay of approximately 110ms is used prior to checking the device status at critical times during command execution. This delay can be enabled and disabled using the ATAPIDelay ON and ATAPIDelay OFf commands. The ATAPIDELAY ON command may be required before any commands can be issued to an ATAPI device.

You will need a copy of the SCSI MMC-x document if you want to try any of the ATAPI CD-ROM packet commands. Packet commands are SCSI like commands that are sent to an ATAPI device using the ATA command code A0H. This command is known as the ATAPI Packet command. In AHCDEMO the PN, PR, PS and PW commands are used to setup and execute the ATAPI Packet command.

(Go To TOC)

HINTS

a) Whenever AHCDEMO asks you for an ATA command code, you may enter a ? character to see a list of ATA hard disk commands. (just as if you had used the HELPC command). Whenever AHCDEMO asks you for the command byte (byte 0) of an ATAPI Packet CDB you may enter a ? character to see a list of the ATAPI CD-ROM packet commands (just as if you had used the HELPP command).

b) Don't switch to LBA sector addressing usless your hard disk supports LBA addressing.

(Go To TOC)

THINGS TO TRY

Here are some things to try the first time you use AHCDEMO...

(Go To TOC)

HISTORY

Versions not shown were test or skipped versions.

Version 3A5d

Version 3A5c

Version 3A5b

Version 3A5a

Version 3A5

(Go To TOC)

QUESTIONS OR PROBLEMS?

Technical support can be found at:


   http://www.ata-atapi.com/techsupp.html

-end-