;*************************** AMUS Program Label ******************************
; Filename: GETRID.M68                                      Date: 9/9/91
; Category: UTIL         Hash Code: 301-440-447-601      Version: 1.0(104)
; Initials: GR/AM        Name: James A. Jarboe IV
; Company: Educational Video Network, Inc.         Telephone #: 4092955767
; Related Files:
; Min. Op. Sys.: 1.3                           Expertise Level: BEG
; Special: Must LNKLIT after assembly
; Description: Allows user to only erase files in their ROOT account. Accepts
; Wildcard input. Will not erase BADBLK.SYS or A.A files. Will only erase
; START.CMD with switch option. No file erasure allowed out of ROOT account.
;*****************************************************************************
;*; Updated on 09-Sep-91 at 12:19 PM by James A. Jarboe I V; edit time: 5:50:28
;****************************************************************************
;*                                                                         *
;*                              GETRID.M68                                 *
;*                                                                         *
;*                     Written By: James A. Jarboe IV                      *
;*                            1401 19th Street                             *
;*                          Huntsville, TX 77340                           *
;*                              409-295-5767                               *
;*                                                                         *
;*                               17-Nov-89                                 *
;*                                 GR/AM                                   *
;****************************************************************************
;
; Description:  Allows a user to only erase files in the user's
;               ROOT device, drive, and PPN.
;
; Options:
;          HELP  - Displays help.
;          QUERY - Allows user to Query files to delete.
;          START - Allow user to erase START.CMD
;
;
; Notes:   Wildcard specifications are allowed, but not acted
;          upon if they include device, drive or PPN specifications
;          other than those in the users ROOT specification.
;          If ROOT specification is not set user will be aborted
;          from program. If user trys to delete files from any
;          device specification other than the ROOT specification
;          stored in JOBRTD, JOBRTU, or JOBRTP, user will be aborted
;          from the program. CPU specifications or output file
;          specifications are not allowed. User must be in Root account
;          to erase files in root account.
;
; Note:  Will not erase BADBLK.SYS or A.A files
;        Will not erase START.CMD in account unless the START switch is used.
;
; Must assemble under M68 or d/ASM.
;
       ALPHA   =       1               ; Using Alpha Micro's M68 assembler.
       DSOFT   =       2               ; Using d/SOFT's MACRO assembler.

; To assemble using Alpha Micro's M68, assign the value ALPHA to ASSEMBLY.
; To assemble using d/SOFT's MACRO, assign the value DSOFT to ASSEMBLY.
;
       ASSEMBLY = ALPHA                ; Assemble using M68.
;;;     ASSEMBLY = DSOFT                ; Assemble using MACRO.

IF      EQ, ASSEMBLY-ALPHA

       ASMMSG  /==================================================/
       ASMMSG  /                                                  /
       ASMMSG  /Assembling using Alpha Microsystems M68 Assembler./
       ASMMSG  /                                                  /
       ASMMSG  / *** Be Sure to LNKLIT GETRID after assembly ***  /
       ASMMSG  /                                                  /
       ASMMSG  /==================================================/
       SEARCH SYS                      ; Use Alpha release defs.
       SEARCH SYSSYM                   ;  "    "      "      "
IFF

       ASMMSG  \========================================\
       ASMMSG  \Assembling using d/SOFT Macro Assembler.\
       ASMMSG  \========================================\
       SEARCH  DSYS                    ; Get AMOS symbols, d/ASM style.
       SEARCH  DYSSYM                  ; Get more AMOS symbols, d/ASM style.
       ; DSYS and DYSSYM Alpha compatible d/ASM style universals.
ENDC

; Get CMDLIN.SYS values.
;
       COPY    CMDSYM.M68

       PAGE
;**************************************************************************
;                                                                         *
;                 V E R S I O N    A N D   H I S T O R Y                  *
;                                                                         *
;**************************************************************************
;
; Edit History:
;
;[104] 09-Sep-91  Minor cosmetics, off to AMUS          /JAJ
;
;[103] 30-Oct-90  Add code to bypass START.CMD and corresponding switch to
;                 turn this feature off.                /JAJ
;
;[102] 31-May-90  Somehow JOBIDX for first root testing got left out.
;                                                       /JAJ
;
;[101] 12-May-89  Update to skip A.A, BADBLK.SYS[1,2]. Remove "cute" error
;                 messages.                             /JAJ
;
;[100] 17-Nov-89  First release by James A. Jarboe IV.  /JAJ
;
;
       VMAJOR  =       1
       VMINOR  =       0
       VEDIT   =       104.            ; 09-Sep-1991 update [JAJ]

; Externally defined labels.
;
       EXTERN  $BBCHK                  ; Lib routine for BADBLK check.

       PAGE
;**************************************************************************
;                                                                         *
;                              M A C R O S                                *
;                                                                         *
;**************************************************************************
;
;+************************+
;         PRTTAB          *
;+************************+
;
; Macro to simulate basic "print tab" directive.
;
DEFINE  PRTTAB  ROW, COL                ; Print tab (row,col)
       MOVW    #<ROW_8.+COL>, D1       ; Setup D1.
       TCRT                            ; Output TCRT call.
ENDM

;+************************+
;         TBLENT          *
;+************************+
;
; Builds table for program error messages.
; TBLENT  ErrorCodeNumber, <Error Message.>
;
DEFINE  TBLENT  ERRCDE, MSG
       WORD    10$$-.                  ; Offset to next table entry.
       BYTE    ERRCDE                  ; Error code byte.
       ASCIZ   "MSG"                   ; The message.
       EVEN                            ; Force word alignment.
10$$:                                   ; Start of next message.
ENDM

       PAGE
;**************************************************************************
;                                                                         *
;                     P R O G R A M   C O N S T A N T S                   *
;                                                                         *
;**************************************************************************
;
; Misc character representations.
;
       $NULL   =       0               ; The NULL character.
       $CR     =       13.             ; The CR character.
       $SPACE  =       32.             ; The SPACE character.
       $COMMA  =       44.             ; The "," character.
       $SLASH  =       47.             ; The "/" character.
       $QUEST  =       63.             ; The "?" character.

; Buffer sizes.
;
       S..UNM  =       22.             ; Size of user name buffer.

; Program error message values.
;
       NO.ROT  =       1.              ; ROOT specification must be set.
       NO.DEL  =       2.              ; Delete files in root account.
       NO.OUT  =       4.              ; Output file specs not allowed.
       NO.CPU  =       10.             ; CPU selection is not allowed.
       NO.LOG  =       20.             ; Must be logged into ROOT account.

; Switch table on/off flags.
;
       FALSE   =       0               ; Logical False.
       TRUE    =       -1              ; Logical True.

       PAGE
;**************************************************************************
;                                                                         *
;                  P R O G R A M   I M P U R E   A R E A                  *
;                                                                         *
;**************************************************************************
;
; Program storage areas.
;
OFINI   IMP.SZ                          ; Get CMDLIN.SYS work area.
OFDEF   IN.DDB, D.DDB                   ; Input DDB.
OFDEF   GR.RID, 4                       ; Number of blocks freed.
OFDEF   SW.VAL, 0                       ; Start of Switch table.
OFDEF   SW.HLP, 4                       ; Help requested flag.
OFDEF   SW.QRY, 4                       ; Query switch flag.
OFDEF   SW.STR, 4                       ; Start switch flag.
OFSIZ   S..IMP                          ; Size of Impure area.

       PAGE
;**************************************************************************
;                                                                         *
;                     S T A R T   O F   P R O G R A M                     *
;                                                                         *
;**************************************************************************
;
;+************************+
;         GETRID          *
;+************************+
; Start of program.
;  Program characteristics are:
;   Read system memory.
;   Write system memory.
;   Read physical blocks.
;   Write physical blocks.
;   Reusable.
;   Reentrant.
;
GETRID: PHDR    -1, PV$RSM!PV$WSM!PV$RPD!PV$WPD, PH$REE!PH$REU  ;

       GETIMP  S..IMP, A5              ; Setup available memory.

; Display help if no command line is present.
;
       CMPB    @A2, #$CR               ; Any command line?
       JEQ     HELP                    ;  No..report help.

; Check for /? option to request help.
;
       CMPB    @A2, #$SLASH            ; Is this an option flag?
       BNE     10$                     ;  No..continue with program.
       CMPB    1(A2), #$QUEST          ; Is character a "?" ?
       JEQ     HELP                    ;  Yes..give user some help.

; Check that a user ROOT Device and PPN is set. ROOT drive is cleared,
; when unused, and 0 is a valid drive number so checking for a ROOT
; drive is not feasable here. Will compare ROOT drive spec later.
;
10$:    JOBIDX                          ; Index this job [102]
       MOV     #NO.ROT, D6             ; Pre-set error.
       TSTW    JOBRTD(A6)              ; Root device set?
       JEQ     REPERR                  ;  No..report error.
       TSTW    JOBRTP(A6)              ; Root PPN set?
       JEQ     REPERR                  ;  No..report error.

; Make sure that user is logged into ROOT.
;  Abort program if user is not logged into root specification.
;
       MOV     #NO.LOG, D6             ; Pre-set error.
       CMMW    JOBDEV(A6), JOBRTD(A6)  ; Logged into root device?
       JNE     REPERR                  ;  No..report error.
       CMMW    JOBDRV(A6), JOBRTU(A6)  ; Logged into root drive?
       JNE     REPERR                  ;  No..report error.
       CMMW    JOBUSR(A6), JOBRTP(A6)  ; Logged into root PPN?
       JNE     REPERR                  ;  No..report error.

; Locate CMDLIN.SYS.
;
       .CMLOC  IN.DDB(A5)              ; Locate CMDLIN.SYS.
       SUB     A0, A0                  ; Set no default command line.
       CLR     D7                      ; Pre-clear flags.

; Print errors messages, OPR is not a special case.
;
       OR      #<OP$PRT!OP$OPR>, D7    ; Set options.

; Initialize CMDLIN.SYS
;
       .CMINI  SWTDEF, SW.VAL(A5)      ; Initialize CMDLIN.SYS.
       JNE     HELP                    ; Display help on error.
       MOV     #NO.OUT, D6             ; Pre-set error.
       AND     #<IN$OFP>, D7           ; Output file requested?
       JNE     REPERR                  ;  No..process onward.
       TST     SW.HLP(A5)              ; Is help requested?
       JNE     HELP                    ;  Yes..display help.
       CLR     D2                      ; Pre-clear block counter.
       LEA     A4, IN.DDB(A5)          ; Index input DDB.

       PAGE
;+************************+
;         GETNXT          *
;+************************+
; Get next file name from CMDLIN.SYS.
;
; Overview:
;
;       Gets next filename from CMDLIN.SYS and checks for
;       allowed processing.
;
; Arguments:
;
;       A4      := Input file name DDB.
;       A5      := Base of CMDLIN.SYS impure memory.
;
; Returned:
;
;       D2      => Number of blocks freed.
;
; Dependencies:
;
;       NOTE: A5 *MUST* point to the impure area used by CMDLIN.SYS
;
; Side Effects:
;
;       D1, D2, D3, A6, D6, D7 may be destroyed.
;
GETNXT: CTRLC   REPOUT                  ; Exit on ^C.
       .CMNXT  @A4                     ; Get next file match.
       JNE     REPOUT                  ; Report quiting program.
       MOV     CM.NXT(A5), D7          ; Get CMDLIN.SYS error flags.
       AND     #<NX$END>, D7           ; End of matches?
       JNE     REPOUT                  ;  Yes...quit.

; Here we check for a CPU number specification.
; This is not allowed. Abort program if present.
;
       TST     D.CPU(A4)               ; Is a CPU set?
       BEQ     10$                     ;  No..good proceed.
       MOV     #NO.CPU, D6             ; Pre-set error.
       JMP     REPERR                  ; Report error and quit.

; Here we check to see that the current DEVICE, DRIVE, and PPN
; is set in the input DDB.
;
10$:    JOBIDX                          ; Index job.
       TSTW    D.DEV(A4)               ; Is DDB device set?
       BNE     20$                     ;  Yes..try drive.
       MOVW    JOBDEV(A6),D.DEV(A4)    ;  No..preset device.
20$:    TSTW    D.DRV(A4)               ; Is DDB drive set?
       BEQ     30$                     ;  Yes..try PPN.
       MOVW    JOBDRV(A6),D.DRV(A4)    ;  No..preset drive.
30$:    TSTW    D.PPN(A4)               ; Is PPN set?
       BNE     40$                     ;  Yes..all ok.
       MOVW    JOBUSR(A6),D.PPN(A4)    ;  No..preset PPN.

; Here we check to see that the ROOT Device, Drive, and PPN is
; the same as the Device, Drive and PPN as the DDB file to erase.
;
40$:    MOV     #NO.DEL, D6             ; Preset error.
       CMMW    D.DEV(A4), JOBRTD(A6)   ; Same root device ?
       JNE     REPERR                  ;  No..report error.
       CMMW    D.DRV(A4), JOBRTU(A6)   ; Same root drive?
       JNE     REPERR                  ;  No..report error.
       CMMW    D.PPN(A4), JOBRTP(A6)   ; Same root PPn?
       JNE     REPERR                  ;  No..report error.

; Make sure we don't erase A.A
;
       CMP     D.FIL(A4), #<[A  ]_16.>![   ] ; File name "A"?
       BNE     50$                     ; No.
       CMPW    D.EXT(A4), #[A  ]       ; Yes, extension "A"?
       BNE     50$                     ;  No.
       TYPECR  <%Bypassing A.A>        ;  Yes, say we're bypassing.
       JMP     GETNXT                  ;   And go get the next.

; Don't allow erasure of START.CMD unless the /START option specified.
;
50$:    TST     SW.STR(A5)              ; /START enabled?
       BNE     60$                     ;  Yes, skip START.CMD checking.
       CMP     D.FIL(A4), #<[STA]_16.>![RT ] ; File name START?
       BNE     60$                     ;  No.
       CMPW    D.EXT(A4), #[CMD]       ;  Yes, Extension CMD?
       BNE     60$                     ;   Nope.
       TYPECR  <%Bypassing START.CMD>  ;   Yes, bypass it.
       JMP     GETNXT                  ;     and get the next.

; Don't erase BADBLK.SYS[1,2]
;
60$:    CALL    $BBCHK                  ; BADBLK.SYS[1,2]?
       JEQ     GETNXT                  ;  Yes, skip it.

; The file negotiated all of our internal attempts to not erase it.
; Display the file and ask the user if this is really a file to delete.
;
       OFILE   @A4, <OT$OFN!OT$TRM>    ; Print file name.
       .CMQRY                          ; Use query if option was set.
       JEQ     GETNXT                  ;  Query requested and neq answer.

; Here we delete the requested file.
;
       MOV     D.FSZ(A4), D3           ; Save number of blocks.
       DSKDEL  @A4                     ; Delete file, abort on error.
       ADD     #1, GR.RID(A5)          ; Bump delete counter.
       ADD     D3, D2                  ; Number of blocks freed.

       JMP     GETNXT                  ; Do it again.

       PAGE
;+************************+
;         REPOUT          *
;+************************+
;
; Reports program status before exiting program.
;
; Overview:
;
;       Report number of files and number of freed blocks if any files
;       have been erased.
;
; Arguments:
;
;       D2   =>  Contains total number of blocks deleted.
;
; Returned:
;
;       Proceeds to program exit.
;
; Dependencies:
;
;       NOTE: A5 *MUST* point to the impure area used by CMDLIN.SYS
;
; Side Effects:
;
;       D1, D6, D7, A6, A7, may be destroyed.
;
;
REPOUT: TST     GR.RID(A5)              ; Any files selected?
       BNE     10$                     ;  No..exit
       TYPECR  <%No files deleted>     ; Preset error.
       BR      ALLDUN                  ; Report error.
10$:    TYPE    <Total of >             ; Display text.
       MOV     GR.RID(A5), D1          ; Get number of files deleted.
       DCVT    0,OT$TRM                ; Output decimal number.
       TYPE    < file>                 ; Output text.
       CMP     GR.RID(A5), #1          ; Only 1 file deleted?
       BEQ     20$                     ;  Yes..use single case.
       TYPE    <s>                     ;  No..use plural case.
20$:    TYPE    < deleted. Total of >   ; Output text.
       MOV     D2, D1                  ; Get number of blocks deleted.
       DCVT    0, OT$TRM               ; Output decimal number.
       TYPE    < block>                ; Output text.
       CMP     D2, #1                  ; Only 1 block deleted?
       BEQ     30$                     ;  Yes..use single case.
       TYPE    <s>                     ;  No..use plural case.
30$:    TYPECR  < freed.>               ; Output text.
;;;     BR      ALLDUN                  ; Exit program.


       PAGE
;+************************+
;         ALLDUN          *
;+************************+
;
; Exit program.
;
ALLDUN: EXIT                            ; Exit program.

       PAGE
;+************************+
;         REPERR          *
;+************************+
; Reports a program error message.
;
; Overview:
;
;       Display user's first part of user's name and appropriate error
;       message for which a condition has occured.
;
; Arguments:
;
;       D6   =: Contains value of error that occured.
;
; Returned:
;
;       Branches to program exit.
;
; Dependencies:
;
;       NOTE: A5 *MUST* point to the impure area used by CMDLIN.SYS
;
; Side Effects:
;
;       D1, A6, A7, may be destroyed.
;
REPERR: PUSH    D6                      ; Save D6, TTYx will destroy it.
       MOVB    #7, D1                  ; Set up bell.
       TTY                             ; Output bell.
       CRLF                            ; Seperate lines.
       POP     D6                      ; Restore program error value.
       CALL    ERRADR                  ; Set error address.
       TTYL    @A6                     ; Output error text.
       CRLF                            ; Cr linefeed pair.
       CRLF                            ; Seperate error lines.
       JMP     REPOUT                  ; Check for any deletions.

       PAGE
;+************************+
;         HELP            *
;+**********************
**+
; Displays a usage help message.
;
; Overview:
;
;       Display usage message to terminal and calls CMDHLP to display
;       switch options and descriptions from CMDLIN.SYS table.
;
; Arguments:
;
;       None
;
; Returned:
;
;       Exit program.
;
; Dependencies:
;
;       PRTTAB macro.
;       D0  => Switch table number for CMDHLP.
;       A0  -> Switch table option names.
;       A1  -> Switch table descriptions.
;
;       NOTE: A5 *MUST* point to the impure area used by CMDLIN.SYS
;
; Side Effects:
;
;       D0, D1, A0, A1, A6, D6, D7 may be destroyed.
;
; Example:
;
;               TST     SW.HLP(A5)              ; Help requested?
;               JNE     HELP                    ;  Yes..display help, quit.
;       10$:    {process the program...}
;
HELP:   CRLF                            ; Carriage return, linefeed.
       PRTTAB  -1, 11.                 ; Dim.
       TYPE    <%Usage:  >             ; Display text.
       PRTTAB  -1, 12.                 ; Bright.
       TYPE    <GETRID filename.ext>   ; Display text.
       PRTTAB  -1, 11.                 ; Dim.
       TYPE    <{>                     ; Display text.
       MOVB    #$SLASH, D1             ; Set the "/" character.
       TTY                             ; Output character.
       TYPECR  <Option}>               ; Report usage.

; Set up to display option switches and descriptions from
;  CMDLIN.SYS table.
;
       CLR     D0                      ; Pre-clear switch counter.
       MOVW    SWTDEF, D0              ; Get number of options.
       LEA     A0, SWTTXT              ; Index switch text data.
       LEA     A1, SWTDES              ; Index switch desription data.
       CALL    CMDHLP                  ; Display CMDLIN.SYS switches.
       JMP     ALLDUN                  ; Exit program.

       PAGE
;+************************+
;         CMDHLP          *
;+************************+
; Display usage switch options for CMDLIN.SYS.
;  Option names are taken from CMDLIN.SYS table and descriptions are
;  taken from CMDLIN.SYS description table. Description table is not
;  a required CMDLIN.SYS table, but takes on the same format and order
;  to give a description of each switch option.
;
; Overview:
;
;       Displays switch names and descriptions for CMDLIN.SYS options.
;
; Arguments:
;
;       D0   =>  Contains number of options as defined in CMDLIN.SYS table.
;       A0   ->  Address of CMDLIN.SYS Option names.
;       A1   ->  Address of CMDLIN.SYS Option descriptions (not standard).
;
; Returned:
;
;       None
;
; Dependencies:
;
;       Dependant upon PRTTAB Macro.
;
; Side Effects:
;
;       D0, D1, D7, A0, A1, are destroyed.
;
; Example:
;
;       MOVW    SWTDEF, D0              ; Get number of options.
;       LEA     A0, SWTTXT              ; Index switch text data.
;       LEA     A1, SWTDES              ; Index switch desription data.
;       CALL    CMDHLP                  ; Display CMDLIN.SYS switches.
;       JMP     ALLDUN                  ; Exit program.
;               {Rest of program.}
;
CMDHLP: CRLF                            ; Carriage return, linefeed.
       SUB     #1, D0                  ; Subtract 1 for DBF.
10$:    PRTTAB  -1, 11.                 ; Dim.
       TYPE    <      >                ; Offset display.
       MOVB    #$SLASH, D1             ; Set up slash.
       TTY                             ; Output slash.
       PRTTAB  -1, 12.                 ; Bright.
20$:    MOVB    (A0)+, D1               ; Get switch name.
       TTY                             ; Output character.
       TSTB    @A0                     ; End of switch name?
       BNE     20$                     ;  No..get next character.
       ADD     #1, A0                  ;  Yes..bump to next switch.
       PRTTAB  -1, 11.                 ; Dim.
30$:    MOVB    (A1)+, D1               ; Get switch description.
       TTY                             ; Output character.
       TSTB    @A1                     ; End of switch description?
       BNE     30$                     ;  No..get next character.
       ADD     #1, A1                  ;  Yes..bump to next description.
       PRTTAB  -1, 12.                 ; Bright
       CRLF                            ; Output CRLF pair.
       DBF     D0, 10$                 ; Do this for number of switches.
       RTN                             ; Return to caller.

       PAGE
;+************************+
;         ERRADR          *
;+************************+
;
; Gets address of error message.
;
; Overview:
;
;       Returns to caller with address of ASCII representaion of
;       program error that has occured.
;
; Arguments:
;
;       D6   =: Contains the number value of the error that occured.
;
; Returned:
;
;       A6   =: Indexes the ASCII error message.
;
; Dependencies:
;
;       Dependent upon an error message table built with macro:
;
; DEFINE TBLENT ERRCDE, MSG
;        WORD   10$$-.                  ; Offset to next table entry.
;        BYTE   ERRCDE                  ; Error code byte.
;        ASCIZ  "MSG"                   ; The message.
;        EVEN                           ; Force word alignment.
;  10$$:                                ; Start of next message.
;  ENDM
;
; As:
;       LABEL:  TBLENT   errcode, < error message>
;               TBLENT   0,<>       ; End of table.
;
;       NOTE: A5 *MUST* point to the impure area used by CMDLIN.SYS
;
; Side Effects:
;
;       A2, A6, D7 may be destroyed.
;
; Example:
;
;               MOV     #2, D6              ; Set error value.
;               CALL    ERRADR              ; Get ASCII error message.
;               TTYL    @A6                 ; Output error message.
;       10$:    {process the program...}
;
ERRADR: TST     D6                      ; Do we have an error?
       BEQ     99$                     ;  No, skip this stuff.
       LEA     A6, PRGERR              ; Index the error table.
10$:    LEA     A2, 2(A6)               ; Index the error code.
       MOVB    (A2)+, D7               ; Get the error code.
       BEQ     20$                     ; End of table reached...all done.
       CMPB    D6, D7                  ; Is this the error we're hunting?
       BEQ     20$                     ;  Yes, done looking for it.
       ADDW    @A6, A6                 ;  No, bump to next entry in table.
       BR      10$                     ;   Loop for another try at it.

; Error table entry is indexed by A2, perform a TSTB to set the CC register.
; (Remember that the end of table is a null entry.)
;
20$:    TSTB    @A2                     ; Set the condition codes.
       MOV     A2, A6                  ; Return index the proper register.
99$:    RTN                             ; Return to the caller.

;**************************************************************************
;                                                                         *
;                        E R R O R   M E S S A G E S                      *
;                                                                         *
;**************************************************************************
;
       EVEN

PRGERR: TBLENT  NO.ROT, <You must have set a ROOT PPN specification.>
       TBLENT  NO.DEL, <You can only delete the files in your root account.>
       TBLENT  NO.OUT, <Output file specifications are not allowed.>
       TBLENT  NO.CPU, <CPU selection is not allowed.>
       TBLENT  NO.LOG, <You must be logged into your ROOT account.>
       TBLENT  0, <>                   ; Terminate table with null entry.


       EVEN
;**************************************************************************
;                                                                         *
;  C M D L I N . S Y S   S W I T C H   T A B L E   D E F I N I T I O N S  *
;                                                                         *
;**************************************************************************
;
; Switch definition table offsets.
;
SWTDEF: WORD    3                       ; Number of switches.
       WORD    SWTTYP-SWTDEF           ; Type of switch.
       WORD    SWTOFF-SWTDEF           ; Default off value.
       WORD    SWTON-SWTDEF            ; Default on value.
       WORD    SWTTXT-SWTDEF           ; ASCII text value.

; Switch types.
;
SWTTYP: WORD    SW$GLB                  ; Query is always global.
       WORD    SW$LCL                  ; Help is always local.
       WORD    SW$GLB                  ; Start is always global.

; Switch off flag values.
;
SWTOFF: LWORD   FALSE                   ; Query Off is false.
       LWORD   FALSE                   ; Help off is false.
       LWORD   FALSE                   ; Start OFF is false.

; Switch on values.
;
SWTON:  LWORD   TRUE                    ; Query on is true.
       LWORD   TRUE                    ; Help on is true.
       LWORD   TRUE                    ; Start ON is true.

; Switch ASCII values. Evened up with spaces for CMDHLP: call
;  to display switches on help option call.
;
SWTTXT: ASCIZ   /HELP /                 ; Query option.
       ASCIZ   /QUERY/                 ; Help option.
       ASCIZ   /START/

; SWTDES is not required by CMDLIN.SYS although I use it to give an
;  ascii description of each switch and also to use it to display
;  HELP descriptions with the CMDHLP: call.
;
SWTDES: ASCIZ   / - Display Help./
       ASCIZ   / - Request permission to delete file./
       ASCIZ   / - Allow START.CMD deletion./

       EVEN                            ; Even up assembly.

       END                             ; End of program.