; Process control character CTRLCH: call GETCHC ; Get next character from file and 01Fh ; Convert to control character call PUTCH ; Store the character jp NXTCHAR ; Process parameter PARAM: call GETCHC ; Get next character from file ld bc,NXTCHAR ; Establish return address push bc ; ... on stack ld c,a ; Save parameter character in C ; Check for digit parameter call DCHK09 ; Is it a digit? jr z,PLOOKUP ; ..if not, go to table lookup ; ..else fall through to process as digit ;----------------------------------------------------------------------------- ; digit parameter 0 .. 9 DIGIT: call SKIPPARAM ; Skip to parameter number in A ; Copy parameter into new command line ld a,(TABFLAG) ; Value will be 9 if tabs are allowed ld b,a ; ..as a token separator DIGIT1: ld a,(hl) ; Get char or a ret z ; Null is always a delimiter cp ' ' ret z ; Space is always a delimiter cp b ret z ; Tab might be a delimiter call PUTCH ; Store the character inc hl jr DIGIT1 ;----------------------------------------------------------------------------- ; Look up parameter in table PLOOKUP: ld a,c ; Get original character back call ACASE1 db PCOUNT ; Number of entries in table dw BADFORM ; Error routine PARAMTBL: db '#' ; Insert number of parameters in tail dw NPARAMS db '$' ; Insert dollar sign dw PUTCH db '^' ; Insert caret dw PUTCH db '!' ; Entire command line dw PUTCMD db '*' ; Entire tail dw PARAML db '-' ; Partial tail dw PARAMLP IF PDATE db 'D' ; Date parameters dw DATE ENDIF ;PDATE db 'H' ; Home directory dw PHOME db 'T' ; Token parameter dw TOKEN db 'S' ; System file parameter dw SYSFILE db 'Z' ; Set recursive mode dw RECURS IF PINPUT db '"' ; User input request dw USERPROMPT db '''' ; Insertion of user input into command line dw PROMPTPARAM db 'I' ; Allow ZEX input redirection dw ZEXIN ENDIF ;pinput IF PMEM db 'M' ; Memory contents dw MEMORY ENDIF IF PREG db 'R' ; Register value dw REGISTER ENDIF IF PENV db 'A' ; Address of system module dw ENVDATA db '+' ; Offset system address data dw ENVOFFSET db '@' ; Indirect versions of above two params dw INDIRECT ENDIF PCOUNT equ ( $ - PARAMTBL ) / 3 ;----------------------------------------------------------------------------- ; This parameter inserts the number of parameters in the command tail as ; a floating decimal number. NPARAMS: ld c,0 NPARAMS1: inc c ; Try next parameter ld a,c ; Get value into A for SKIPPARAMS push bc ; Protect value in C call SKIPPARAM ; Skip to that parameter pop bc ; Restore value in C or a ; Set flag for last char found jr nz,NPARAMS1 ; If not null, continue search dec c ; Back to last parameter found ld a,c ; Test for value > 9 cp 10 jr c,NPARAMS3 ; Skip if less than 10 ld b,-1 ; Divide by 10 by subtracting NPARAMS2: inc b ; Increment tens count sub 10 ; Subtract 10 jr nc,NPARAMS2 ; Loop until carry add a,10 ; Make positive again ld c,a ; Save ones place value in C ld a,b ; Get tens digit add a,'0' ; Convert to ASCII call PUTCH ; Add character to command line NPARAMS3: ld a,c ; Get ones digit add a,'0' ; Convert to ASCII jp PUTCH ; Add character and return ;----------------------------------------------------------------------------- ; Date parameters: format $Dt, where 't' is the type of date item. The values ; are Y (year), M (month), D (day), H (hour in 00-23 format), C (hour in ; civil format 01-12), N (miNute), S (seconds), and A (AM/PM flag). IF PDATE DATE: call GETCHC ld (PARAMTYPE),a ; Save character DSEG DATEBUF: DS 6 CSEG call TIMINI ; Make sure clock is supported ret z ; If not, return null parameter ld hl,DATEBUF ; Read the clock push hl push de call RCLOCK pop de pop hl ;. . ld a,(PARAMTYPE) cp 'Y' jr z,PUTHEX INC HL cp 'M' jr z,PUTHEX INC HL cp 'D' jr z,PUTHEX INC HL cp 'H' jr z,PUTHEX cp 'C' jr z,CIVHOUR cp 'A' jr z,AMPM inc hl cp 'N' jr z,PUTHEX INC HL cp 'S' jp nz,BADFORM PUTHEX: ld a,(hl) ; HL points to year, month, etc. rra rra rra rra call PRINTHEX1 ld a,(hl) PRINTHEX1: and 0Fh add a,'0' ; Convert to ascii jp PUTCH ; Store the character and return ;-------------------- AMPM: ld a,(hl) ; HL points to hours cp 12h ld a,'A' ; Ready for AM jr c,AMPM1 ld a,'P' AMPM1: call PUTCH ; Store the character ld a,'M' jp PUTCH ; Store the character and return ;-------------------- CIVHOUR: ld a,(hl) ; HL poins to hour or a ; See if 00h jr nz,CIVHOUR1 ld a,24h ; Convert 00 to 24 CIVHOUR1: cp 13h jr c,PUTHEX sub 12h daa ld (hl),a ; Store at (hl) jr PUTHEX ENDIF ;PDATE ;----------------------------------------------------------------------------- ; This parameter, of the form $Pp#, where # is the number of the prompted input ; string to substitute. This number cannot be larger than the maximum number ; of prompted inputs allowed (NPROMPTS) or the actual number of prompted ; inputs supplied by the earlier script contents. The 'p' option specifies ; the part of the prompt to be used. IF PINPUT PROMPTCHK: ld hl,TOKENFLAG ld (hl),0 ; Show nonparsed token type cp 'L' ; Entire user line ret z cp ';' ; One command max (not past semicolon) ret z cp 'E' ; Exactly one token (as is) ret z inc (hl) ; Show parsed token type ld hl,OPTTBL ; Point to table of valid options ld bc,OPTBLEN ; Length of table cpir ; Check for a valid option ret z jp BADFORM ; Display message if invalid option opttbl: ; Table of valid parsing options db 'F' ; File name and type db 'N' ; File name db 'T' ; File type db 'Z' ; Crunched file type db 'Q' ; Squeezed file type db 'D' ; Drive db 'U' ; User db 'C' ; Token with DIR: converted to DU: db 'P' ; Prefix db 'S' ; Prefix without colon optblen equ $-opttbl PROMPTPARAM: call GETCHC ld (PARAMTYPE),a ; Save the character call PROMPTCHK ; Make sure it is a valid option call GETCH ; Get user string number sub '1' ; Convert to decremented numeric value ld hl,PROMPTCNT ; Point to number of strings entered cp (hl) jp nc,BADFORM ; Can't ask for one that has not been defined inc a ; Shift buffer number to range 1.. call GETPBUFPTR ; Get pointer to the requested input string ld a,(TOKENFLAG) ; See if parsing is required or a jp nz,TOKEN1 ; If so, branch to token parsing code ld a,(PARAMTYPE) ; If we want just a token, skip leading spaces cp 'E' call z,SKSP ld b,a ; Get parameter type requested into B ld a,(TABFLAG) ; Possible tab character ld c,a ; ...in c PROMPTP1: ld a,(hl) ; Get source character or a ; Check for terminating null ret z ; If so, return without storing character ld a,b ; Get parameter type cp 'L' ; If requesting entire line, continue ld a,(hl) ; Get character back jr z,PROMPTP2 cp ';' ; If semicolon, end of token or command ret z ; ..so return without storing character ld a,b ; See if request limited to a exact token cp 'E' ld a,(hl) ; Get character back again jr nz,PROMPTP2 ; If parameter type not 'E,' go on cp ' ' ; If space, end of token ret z cp c ; If tab, end of token ret z PROMPTP2: call PUTCH ; Store the character inc hl ; Advance pointer jr PROMPTP1 ENDIF ;PINPUT ; IF PINPUT OR PREG DSEG PARAMTYPE: ds 1 CSEG ; ENDIF ;PINPUT OR PREG ;----------------------------------------------------------------------------- ; Return value of a datum from the ENV, or for entry point INDIRECT the ; contents of the computed memory address. IF PENV DSEG INDFLAG: ds 1 CSEG INDIRECT: ld a,0FFh ; Set flag for memory indirection ld (INDFLAG),a call GETCONVTYPE ; Get format for data conversion call GETCHC ; Get 'A' or '+' cp 'A' jr z,INDENVDATA cp '+' jr z,INDENVOFF jp BADFORM ; If neither, we have a parameter error ENVOFFSET: xor a ; Set flag for no memory indirection ld (INDFLAG),a INDENVOFF: call GETADDR push de ; Save pointer to command line push hl ; Save address value call GETNUMBER ; Get next four characters as number in DE pop hl ; Get address value back into HL add hl,de pop de ; Restore pointer to command line jr PUTVAL ; Put value into command line ENVDATA: xor a ; Set flag for no memory indirection ld (INDFLAG),a INDENVDATA: call GETADDR ; Fall through to PUTVAL PUTVAL: ; PUTVALUE with possible indirection ld a,(INDFLAG) or a jr z,PUTVALUE ; Put in value in HL if no indirection ld a,(hl) ; Otherwise use value of contents of (HL) jp MEMORY2 ;-------------------- ; Put value in HL into the command line PUTVALUE: push de ; Save pointer to command being built ld de,TBUFF ; Place to put the ASCII string push de ; Save tbuff pointer call MHL4HC ; Convert to ASCII hex representation pop hl ; HL points to TBUFF pop de ; DE points to cmd line ; ld bc,4 ; Characters to copy ; ldir ; Move them ; ret ld b,4 ; Characters to copy JP PUTC ; Move them ;-------------------- GETADDR: call GETCHC ; Get next character from ALIAS.CMD call ACASE1 db ENVCNT ; Number of entries in table dw BADFORM ; Default routine ENVTBL: db 'B' ; BIOS address dw GETBIOS db 'C' ; CCP address dw GETCPR db 'D' ; DOS address dw GETDOS db 'E' ; ENV address dw ENVADDR db 'F' ; FCP address dw FCPADDR db 'I' ; IOP address dw IOPADDR db 'L' ; MCL (LINE) address dw LINADDR db 'M' ; MSG address dw MSGADDR db 'N' ; NDR address dw NDRADDR db 'P' ; PATH address dw PATHADDR db 'R' ; RCP address dw RCPADDR db 'S' ; SHELL address dw SHELLADDR db 'X' ; XFCB address dw XFCBADDR ENVCNT equ ( $ - ENVTBL ) / 3 ;---------------- ENVADDR: ld c,01Bh ; Offset to ENV address in ENV jr PUTENVVAL FCPADDR: ld c,012h jr PUTENVVAL IOPADDR: ld c,00Fh jr PUTENVVAL LINADDR: ld c,018h jr PUTENVVAL MSGADDR: ld c,022h jr PUTENVVAL NDRADDR: ld c,015h jr PUTENVVAL PATHADDR: ld c,009h jr PUTENVVAL RCPADDR: ld c,00Ch jr PUTENVVAL SHELLADDR: ld c,01Eh jr PUTENVVAL XFCBADDR: ld c,024h PUTENVVAL: ld b,0 ; BC has offset ld hl,(Z3EADR) ; ENV address into HL add hl,bc ld a,(hl) inc hl ld h,(hl) ld l,a ; Package/module address in HL ret ;---------------- GETCPR: ld bc,3FH-8 ; Additional offset to CCP address in ENV call GETENVTYP ret c ; Value in HL is what we want if C set ld hl,(1) ; Otherwise work from BIOS warmboot ld bc,-0E00H-800H-3 add hl,bc ret GETDOS: ld bc,3FH-8+3 ; Additional offset to DOS address in ENV call GETENVTYP ret c ; Value in HL is what we want if C set ld hl,(1) ; Otherwise work from BIOS warmboot ld bc,-0E00H-3 add hl,bc ret GETBIOS: ld bc,3FH-8+6 ; Additional offset to BIOS address in ENV call GETENVTYP ret c ; Value in HL is what we want if C set ld hl,(1) ; Otherwise work from BIOS warmboot dec hl ; Back up to cold boot address dec hl dec hl ret GETENVTYP: push bc ld hl,(Z3EADR) ld bc,8 ; Offset to ENV type add hl,bc ld a,(hl) ; Get ENV type into A pop bc add hl,bc ; Point to package address ld c,(hl) ; Get the value into HL eventually inc hl ld h,(hl) ld l,c rla ; Set carry if extended ENV type ret ENDIF ;PENV ;----------------------------------------------------------------------------- ; Parameter $R ; ; The value of the designated system register is converted to the form ; designated. The parameter format is $Rt##, where 't' is the type of ; conversion and '##' is an EXACTLY two-digit hex number of the register to ; be used. The allowed conversion types are: ; 'H' hex (HH) ; 'F' floating decimal (D, DD, or DDD depending on the value ; 'D' full decimal with leading zeros (DDD) ; 'T' two decimal digits (DD) ; 'O' one decimal digit (D) ; 'A' ascii (just take the value as is) ; ; The 'T' and 'O' types will give a bad script format error if the value of ; the register is out of range. IF PREG REGISTER: call GETCONVTYPE ; Get type of conversion push de ; Save pointer to command line call GETNUMB2 ; Get register number into DE ld a,e ; Move to A cp 20h ; Allow values from 00 to 1F jp nc,BADFORM pop de ld b,a ; Get value of specified register call GETREG jr MEMORY2 ; Common code for putting value in cmd ENDIF ;PREG ;-------------------- IF PREG OR PMEM OR PENV GETCONVTYPE: call GETCHC ; Get the next character (register ID) ld (PARAMTYPE),a ld hl,CNVTBL ; Point to list of acceptable values ld bc,CNVTBLLEN cpir ret z ; Return if legal option jp BADFORM CNVTBL: db 'A' db 'H' db 'F' db 'D' db 'T' db 'O' cnvtbllen equ $-cnvtbl ENDIF ; PREG OR PMEM OR PENV ;----------------------------------------------------------------------------- ; Parameter $M ; ; Invoked as $Mnnnn, where 'nnnn' is exactly four characters representing a ; hexadecimal address, it returns the ASCII two-character string representing ; the contents of that memory location. IF PMEM MEMORY: call GETCONVTYPE ; Get type of conversion push de call GETNUMBER ld a,(de) ; Get value at designated address pop de ENDIF ;PMEM IF PMEM OR PENV OR PREG MEMORY2: ld c,a ; Save number to convert in C ld a,(PARAMTYPE) ; Find out kind of conversion to perform cp 'A' ; ASCII (use value as is)? jr nz,MEMORY3 ld a,c ; Store the value directly call PUTCH ret MEMORY3: push de ; Save pointer to command line ld de,TBUFF ; Place to put the ASCII string push de ; Save tbuff pointer ld b,a ; Save conversion type letter in B cp 'H' ; Two-digit hex? jr z,HCONVERT cp 'F' ; Floating decimal? jr z,FCONVERT ld a,c ; Get number to convert call MA3DC ; For other cases, start with all three digits xor a ; Mark end with null ld (de),a pop hl ; Point to beginning of converted number ld a,b ; Check for conversion type 'D' cp 'D' jr z,CONVERT1A ; If so, copy the string ld a,(hl) ; Make sure highest digit is '0' cp '0' jp nz,BADFORM inc hl ; Point to second digit ld a,b ; Check for conversion type 'T' cp 'T' jr z,CONVERT1A ; If so, copy string ld a,(hl) ; Make sure second digit is also '0' cp '0' jp nz,BADFORM inc hl jr CONVERT1A FCONVERT: ld a,c ; Get number to convert call MAFDC ; Convert to up-to-three decimal digits jr CONVERT1 HCONVERT: ld a,c ; Get number to convert call MA2HC ; Convert to ASCII hex representation CONVERT1: xor a ; Mark end of converted string with null ld (de),a pop hl ; HL points to tbuff CONVERT1A: pop de ; DE points to cmd line CONVERT2: ld a,(hl) ; Source digit or a ; Check for end of string ret z ; If so, quit call PUTCH ; Store the character inc hl jr CONVERT2 ;-------------------- ; Returns value in DE of number represented by next four characters in the ; script. At entry point GETNUMB2 only (and exactly) two characters are used. GETNUMB2: ld b,2 ; Read two characters jr GETNUMB0 GETNUMBER: ld b,4 ; Read four characters GETNUMB0: ld c,b ; Save character count in C also ld hl,TBUFF ; Place to put characters push hl GETNUMB1: call GETCHC ; Read characters from cmd file ld (hl),a ; Save the character inc hl ; Bump the pointer djnz GETNUMB1 ; Loop through four characters ld (hl),0 ; Mark end of string pop hl ; Point to the string read call EVAL16 ; Evaluate as hex number ld a,l ; Make sure all four (two) characters were ok sub 80h cp c ; Should be number of characters read jp nz,BADFORM ; If E not 4, bad format ret ENDIF ;PMEM OR PENV OR PREG ;----------------------------------------------------------------------------- ; Parameter $" ; ; Display prompt and get input from user ; The text up to the next double quote is sent to the console after a CRLF. ; If a caret is encountered, then the next character is converted to a control ; character before echoing to the screen. If the character is a dollar sign, ; then the next character is sent no matter what it is (e.g., a caret, a double ; quote, or a dollar sign). Then the user is prompted for input which is copied ; to a buffer for later use by the $' parameter. IF PINPUT ZEXIN: ; Set ZEXFL to allow redirection xor a ; Zero for normal ZEX operation ld (ZEXFL),a ret USERPROMPT: call CRLF ; Start new line USERP1: call GETCH ; Get next char from cmd file jp z,BADFORM cp '"' ; See if end of prompt jr z,USERP4 cp '^' ; See if control character lead-in jr nz,USERP2 ; If not, skip control character processing call GETCHC ; Get next character and 1Fh ; Convert to control character jr USERP3 ; ..and output it USERP2: cp '$' ; See if escape character (to allow ^) jr nz,USERP3 ; If not, output the character call GETCHC ; Otherwise get next character USERP3: call COUT ; Send character to console jr USERP1 ; ..and go back for more USERP4: ld hl,TBUFF ; Set up input buffer ld (hl),7Dh call GETZEX ; Get ZEX redirection flag push af ; Save it ld a,(ZEXFL) ; Get ARUNZ redirection setting ($I parameter) call PUTZEX call BLINE ; Get user input (capitalization irrelevant) pop af ; Get original redirection flag back call PUTZEX ; ..and restore it ld a,2 ; Reset default to no ZEX redirection ld (ZEXFL),a ; ..for next prompt push de ; Save pointer to command line push hl ; Save pointer to beginning of user input ld hl,PROMPTCNT ; Point to current count of inputs ld a,(hl) ; Check for legal number of inputs cp NPROMPTS jp nc,BADFORM inc a ; Advance count ld (hl),a call GETPBUFPTR ; Get pointer to correct buffer (numbered 1..) ex de,hl ; Destination into DE pop hl ; Restore pointer to source ld bc,7eh ; Max length of user input ldir pop de ret ;-------------------- ; On entry A contains the prompted input buffer to which a pointer is to be ; returned in HL. The buffers are numbered from 1 (not zero) to conform to ; the user's perspective. No validity checks are performed here. The BC ; register is affected. GETPBUFPTR: ld hl,(PROMPTBUF) ld bc,80h ; Spacing between strings PBUFPTR1: dec a ret z add hl,bc jr PBUFPTR1 ENDIF ; Pinput ;----------------------------------------------------------------------------- ; Token parsing parameters $Tp# (at entry TOKEN). CONVSPEC: call PARSEP ; Parse the token call FCB1CHK ; See if parse error detected jr nz,CONVSPEC0 ; If so, leave token as it was ld a,(TBUFF) ; Was there a directory prefix? or a jr z,FULLSPEC1 ; If not, use FULSPEC cp ':' ; Colon only? jr nz,CONVSPEC1 ; If not, branch CONVSPEC0: ld b,0 ; Include colon (flag used at PREFIX1) call PREFIX1 ; Put prefix into command line (colon only) jr FULLSPEC1 ; ..followed by full filename CONVSPEC1: ; Convert to explicit DU: call DRVSPEC1 ; Put in drive letter call USRSPEC1 ; Put in user number ld a,':' ; Put in colon call PUTCH ; Store the character jr FULLSPEC1 ; Put in full filename ;-------------------- FULLSPEC: call PARSEP FULLSPEC1: call NAMESPEC1 ; Get name first ld hl,FCB+1+8 ; Point to file type ld a,(hl) ; See if any type given cp ' ' ret z ; If not, we are done ld a,'.' ; Put dot into command call PUTCH ; Store the character jp PUTT ; Put file type into command ;-------------------- TOKEN: xor a ; Set flag to select command line token ld (TOKENFLAG),a DSEG TOKENFLAG: ds 1 CSEG call GETCHC ; Get the part of token requested ld (PARAMTYPE),a ; Save parameter type option TOKEN1: ld a,(PARAMTYPE) ; Allow for entry from user input parser cp 'C' ; Full spec with DIR: converted to DU: jr z,CONVSPEC cp 'F' ; Full file name and type jr z,FULLSPEC cp 'U' ; User only jr z,USRSPEC cp 'N' ; File name only jr z,NAMESPEC cp 'T' ; File type only jr z,TYPESPEC cp 'Z' ; Crunched file type jr z,CRNCHSPEC cp 'Q' ; Squeezed file type jr z,SQZSPEC cp 'P' ; Directory prefix (including colon) jr z,PREFIX cp 'S' ; Short directory prefix (not including colon) jr z,SPREFIX cp 'D' ; Drive only jp nz,BADFORM ;-------------------- ; Parameter $td#, #=0..9 ; ; Return drive letter of drive specified in the indicated token. If bad value ; of #, report bad script format. DRVSPEC: call PARSEP ; Get token and parse DRVSPEC1: ld a,(FCB) ; Get drive value dec a ; Shift to range 0..15 (or FF if default) jp p,DRVSPEC2 ; Skip getting default if positive ld a,(DUSAVE+1) ; Get default drive number DRVSPEC2: add a,'A' ; Convert to ascii jp PUTCH ; Store the character and return ;---------------- ; Parameter $tu#, #=0..9 ; ; Return user number specified in the indicated token. If bad value of #, ; report bad script format. USRSPEC: call PARSEP ; Get token and parse USRSPEC1: ld a,(FCB+13) ; Get user number jp PUTNUM ; Put number into command ;---------------- ; Parameter $tn#, #=0..9 ; Returns the file name specified by token #. If # is not a valid value, ; a warning is displayed. NAMESPEC: call PARSEP ; Get token and parse NAMESPEC1: ld hl,FCB+1 ; Copy name of file jp PUTN ;---------------- ; Parameter $tt#, #=0..9 ; Returns the file type specified by token #. If # is not a valid value, ; a warning is displayed. TYPESPEC: call PARSEP ; Get token and parse ld hl,FCB+1+8 ; Copy type of file jp PUTT ;---------------- ; Parameters $tz# and $tq#, #=0..9 ; Returns the file type of the crunched ($tz) or squeezed ($tq) file. If # ; is not a valid value, a warning is displayed. SQZSPEC: ld b,'Q' jr COMPSPEC CRNCHSPEC: ld b,'Z' COMPSPEC: push bc call PARSEP ; Get token and parse pop bc ; This is an entry point from the $sz# and $sq# parameters. B contains ; the special character, and the file type is in the FCB. PUTCOMP: ld hl,FCB+1+9 ; Point to middle letter of type LD A,(HL) ; Save original middle character ld (hl),b dec hl ; Point to first char of file type cp b ; Was original middle char same as special char jr z,PUTCOMP1 ; If so treat like null file type ld a,(hl) ; Check for null file type cp ' ' ; If not a space character jr nz,CSPEC1 ; ..go ahead PUTCOMP1: push hl ; Else save pointer to file type inc hl ; Advance to last byte inc hl ld (hl),b ; Put in special character pop hl ; Same thing for first byte ld (hl),b CSPEC1: jp PUTT ;---------------- ; This parameter returns the directory prefix of the designated token. SPREFIX: call PARSEP ; Get token and parse ld b,':' ; Stop at colon jr PREFIX1 PREFIX: call PARSEP ; Get token and parse ld b,0 ; Stop only at null PREFIX1: ; Entry point for token conversion ld hl,TBUFF ; Point to prefix string PUTSTR: ld a,(hl) or a ret z ; Return if end of string cp b ; See if alternative end (colon) ret z ; Return if so call PUTCH ; Store the character inc hl ; Bump pointers jr PUTSTR ;---------------- ; If entered with TOKENFLAG equal to 0, then this routine gets the requested ; parameter number and finds that parameter. If TOKENFLAG is nonzero, then it ; uses whatever string HL is pointing to. It then parses the string into the ; default FCB using the Z33 parser. In addition, the parameter string is ; scanned for a directory prefix, and the prefix (if any), including the colon, ; is placed into the temporary buffer at 80H. PARSEP: ld a,(TOKENFLAG) or a jr nz,PARSEP0 call GETCHC ; Get next character in file call DCHK09 ; Check for value 0..9 jp z,BADFORM call SKIPPARAM ; Skip to desired parameter PARSEP0: push de ; Save pointer to command line ld de,TBUFF ; Place to keep directory prefix as given push hl ; Save pointer to parameter PARSEP1: ld a,(hl) ; Copy characters to TBUFF ldi cp ':' ; If colon, we found the prefix jr z,PARSEP2 cp ' '+1 ; See if end of token jr nc,PARSEP1 ; If not, continue copying characters ld de,TBUFF ; Otherwise, null out the buffer PARSEP2: xor a ld (de),a ; Put null at end of string pop hl ; Restore pointer to parameter PARSEP3: LD BC,(DUSAVE) call LOGUD ; Return to original directory ld de,FCB ; Parse into default fcb IF Z33ONLY call SCAN ; Use Z33 parser ELSE ;NOT Z33ONLY call Z33CHK ; Z if Z33 present push af ; Save result of Z33CHK call z,SCAN ; Use Z33 parser if possible pop af call nz,ZPRSFN ; Else use Z3LIB routine ENDIF; Z33ONLY ld bc,(CMDDIR) call LOGUD ; Log back into ALIAS.CMD's dir pop de ret ;----------------------------------------------------------------------------- ; Parameter 'H' for home DU. Followed by 'D' for drive, 'U' for user, or ; 'B' for both (i.e., DU). PHOME: call GETCHC ; Get the next character call ACASE1 db HCOUNT ; Number of entries in table dw BADFORM ; Default routine HOMETBL: db 'D' dw PARAMD db 'U' dw PARAMU db 'B' dw PARAMDU HCOUNT equ ( $ - HOMETBL ) / 3 ;---------------- ; Logged DU at time ARUNZ called PARAMDU: call PARAMD ; Get drive and fall through to user ;---------------- ; Logged user number at time ARUNZ invoked PARAMU: ld a,(DUSAVE) ; Get user value of default DU: jp PUTNUM ;---------------- ; Current drive at time ARUNZ invoked PARAMD: ld a,(DUSAVE+1) ; Get drive value of default DU: add a,'A' ; Convert to ASCII call PUTCH ; Store the character and return ;----------------------------------------------------------------------------- DCHK19: ; Check for digit 1 to 9 ld b,'1' jr DIGITCHK DCHK09: ; Check for digit 0 to 9 ld b,'0' DIGITCHK: sub b ; Convert and check for < value in b cp 10 ret c ; Carry set (zero reset) if good DIGITCHK1: xor a ; Set zero flag ret ;----------------------------------------------------------------------------- ; System file name parameters $Sp#. SYSFILE: call GETCHC ; Get part of name specified push af ; Save character call GETFNUM ; Get file number (goes to BADFORM if bad) call PTFN ; Set HL to file name pop af ; Restore part designator cp 'N' ; Name only jp z,PUTN cp 'T' ; Type only jr z,PARAMT cp 'Z' ; Crunched type jr z,PARAMZ cp 'Q' ; Squeezed type jr z,PARAMQ cp 'F' ; Full file name and type jr nz,BADFORM ;-------------------- ; Parameter $s#, #=1..4 ; ; Returns the file name and type stored in the designated system file. PARAMF: call PUTN ; Put file name ld a,'.' ; Dot call PUTCH ; Store the character jp PUTT ; Put file type ;-------------------- ; Parameter $st#, #=1..4 ; ; Returns the file type only stored in the designated system file. PARAMT: ld bc,8 ; Point to file type add hl,bc jp PUTT ; Put file type ;-------------------- ; Parameters $sz# and $sq#, #=1..4 ; ; Returns the crunched or squeezed version of the file type. PARAMQ: ld b,'Q' ; Special character for squeezed file jr COMPPARAM PARAMZ: ld b,'Z' ; Special character for crunched file COMPPARAM: push bc push de ld bc,8 ; Point to file type add hl,bc ld de,FCB+1+8 ; Point to file type of FCB ld c,3 ldir ; Copy system file type to FCB pop de ; Restore registers pop bc jp PUTCOMP ; Return the compressed file type ;-------------------- ; GET SYSTEM FILE NUMBER ; Get File Number (1 to 4) ; If valid number, return with value 0..3 in A ; If not valid, vector to BADFORM GETFNUM: call GETCH ; Get next character from file sub '1' ; Convert cp 4 ; Range? jr nc,BADFORM ; Error if <0 or >4 ret ;-------------------- ; POINT TO SYSTEM FILE ; Point to system file name whose number (0-3) is in A. The value in A is ; not checked. PTFN: call GETFN2 ; SYSLIB routine to set HL to first file inc a ; Shift to range 1..4 ld b,a ; Number in B PTFN1: dec b ; Done? ret z ; Add 11 to HL to increment to next system file name push de ; Save DE ld de,11 ; Size of file name and type add hl,de ; Pt to next pop de ; Restore DE jr PTFN1 ;----------------------------------------------------------------------------- ; Parameter is entire command line PUTCMD: xor a ; Use value of 0 in SKIPPARAM jr PARAML1 ;----------------------------------------------------------------------------- ; Parameter is command line tail or part of tail PARAMLP: ; Partial tail ($-n) call GETCH ; Get next character in file call DCHK09 ; Check for value 0..9 call z,BADFORM ; If bad value, give warning message ret z ; ..and resume inc a ; Add one to token number for alias name call SKIPPARAM ; Skip to desired parameter jr PARAMT1 PARAML: ; Whole tail ($*) ld a,1 ; Skip to first parameter PARAML1: call SKIPPARAM PARAMT1: ld a,(hl) ; Copy tail into line or a ; End of tail? ret z call PUTCH ; Store the character inc hl ; Pt to next jr PARAMT1 ;----------------------------------------------------------------------------- ; Set recursive mode ($Z) RECURS: ld a,0FFh ; Set rflag ld (RFLAG),a ret