home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
ZCPR33
/
A-R
/
ARNZ09N1.LBR
/
ARUNZ09N.HZS
/
ARUNZ09N.HIS
Wrap
Text File
|
2000-06-30
|
22KB
|
658 lines
This material, which serves as the ARUNZ09N history file, was extracted from
the comments at the beginning of the source code.
; Program: ARUNZ
; Author: Jay Sage
; Version: 0.9N
; Date: June 4, 1988
VERSION$UNIT EQU '0'
VERSION$TENTH EQU '9'
VERSION$LETTER EQU 'N'
; The following value is used by the type-4 version of ARUNZ, since CODEND
; does not return a correct value from a PRL file. Instead, ARUNZ detects
; that it is a type-4 program and uses this value as an offset from the
; starting address of the code. The size of the code can be determined from
; the message put out by the linker when it links the main code with the
; libraries. The value can be patched in following the ascii string SIZE in
; the configuration at the beginning of the program.
; It is also necessary to patch the load address word in the program header
; (not the type-4 header). The linker sets this value to 0100 for a PRL
; file. The value has to be the total amount of memory required to run
; ARUNZ, including its code and all data space it needs. From trial
; and error, this value is 900H larger than the value of CODESIZE.
CODESIZE EQU 1500H
.comment \
VERSION 0.9N
I added a token data type 'S' for 'short prefix' that returns the directory
prefix, if any, without the colon.
I also added the parameter '$@' that returns the contents of the memory
location otherwise specified by the '$A' and '$+' parameters. The format is
$@fat or $@f+t####
where '$@' is the parameter leadin, 'f' is the number conversion format ('H',
'F', 'D', 'T', or 'O' as with '$M' and '$R' parameters), and 'm' is the
memory module to use as the address or base address. With the '+' form, the
four hex digits specify the offset from the base address.
I added a flag (after the ascii string TABFLAG) to determine where space only
of either space or tab will be used to delimit command-line tokens. The
normal setting of this flag is '00' so that only spaces are used as the
delimiter. If this is changed to a value of '09', then tabs will be used also.
;--------------------
VERSION 0.9M
I put back in the code to allow ARUNZ to work without the Z33/Z34 parser call,
but I included the Z33ONLY equate to govern which version would be generated.
If BGii is upgraded to Z34 compatibility, then Z33ONLY can be turned on even if
BGii is going to be used.
Following a suggestion from Rick Charnes, I added a series of parameters to
return the DateStamper date fragments. If DateStamper is not running, then 00
will be returned for all the values (and null for the AM/PM flag). At some
point in the future it might be good to provide a patch point where the user
could provide the address of a routine to be called that returns the date in
ASCII, as DS does, or perhaps some other alternative forms. The date
parameters have the form $Dt, where the 't' type options are:
Y Year (YY)
M Month (MM)
D Day (DD)
H Hour in military form 00-23 (HH)
C hour in Civil form 01-12 (CC)
N miNute
A Am/pm flag (AM or PM)
Added code to check for adequate TPA space for data buffers. Added support
for a type-4 version of ARUNZ.
;--------------------
VERSION 0.9L
Made prompted input responses go into buffers so that user's answers can be
used more than once. Parameters are now requested using only the parameter
$". The user's response can later be invoked using a parameter of the form
$'tn, where 't' is the type of data desired and 'n' is the index to the
prompt (starting with 1). The allowed types can include any of those allowed
for token parameters (see below: 'D', 'U', 'P', 'F', 'N', 'T', 'C') or any of
the following:
'L' the entire line as the user entered it
';' a single command (i.e., terminated by null or semicolon)
'E' an exact token (terminated by a null, a semicolon, a space,
or a tab)
The register ($R) and memory ($M) parameters were extended to allow the
specification of the type of conversion to be performed. After the 'R' or
'M', one of the following letters specifies the format:
'H' two hexadecimal digits
'F' floating decimal (one, two, or three digits)
'D' three decimal digits
'T' two decimal digits
'O' one decimal digit
The 'T' and 'O' conversion options will give script parameter error messages
if the number is two big to represented in the designated number of digits.
Following the conversion type character will be either two (for $R) or four
(for $M) characters that will be taken as the register or memory address.
Register values from 00 to 1F are allowed.
I have finally rationalized the parameter forms for the system files and the
command line tokens. For the system files we have the $S parameter with the
format $Sp#, where 'p' is the part of the file name and '#' is the system
file number (1..4). The part 'p' can be:
N file name
T file type
F name and type together
For the command line tokens, the parameter is, similarly, of the form $Tp#.
The part options are are 'N', 'T', and 'F' plus the following:
D drive (or default)
U user (or default)
P directory prefix (including the colon)
C converted file specification with DIR: form, if present
changed to equivalent DU: (if invalid name, then no
conversion is performed)
The old parameters for the system files and command line tokens have been
eliminated.
To keep the code under 4K, I dropped some obscure error reports.
----------------------------------------
VERSION 0.9K
Added parameter $+ that takes the value otherwise returned by the $a
parameters and adds an offset to it. For example, one might write:
$+e001D
to get the address of the maxuser byte in the ENV. I also made it possible
to echo control characters in prompts by preceeding a with a caret. The
dollar sign is used as an escape; any character entered after a dollar sign
is echoed as is. Thus $$ gives $, $^ gives ^, $" gives ", and $' gives '.
Finally, I put the type-3 safety header into the code.
----------------------------------------
VERSION 0.9J
Extended parameters $: and $. to take digit 0 so that the verb can be parsed
into a file name and type. $D0 and $U0 now return the drive and user
specified in the command token. A new parameter $H gives the home directory
information. $HD gives the drive letter; $HU gives the user number; and $HB
gives both (i.e., full DU). Added special character TYPECHAR (default '>')
to signal comparison with filetype only in the command verb. Added $A
parameter with following option letters B, C, D, E, F, I, L, M, N, P, R, S,
X to return in ASCII form the address of various system modules (BIOS, CCP,
DOS, ENV, FCP, etc.). Added ability to call the Z33 or later token parser.
----------------------------------------
VERSION 0.9I
Added parameter $! to represent the entire command as entered by the user.
----------------------------------------
VERSION 0.9H
Changed to support Z34's ability to pass bad commands with wildcard
characters and file types to ECP. Equates now define the wildcard character
(standard is '_' instead of '?'), the option character (standard is ','
instead of '.'), and the default alias character (standard is ':' as
before). ARUNZ now determines the kind of error if the alias is not found
and returns it to the command processor. Also added code to strip leading
spaces and tabs in the script.
----------------------------------------
VERSION 0.9G
Fixed bug introduced in 0.9f that required alias names to be entered in
upper case. Also fixed a bug that occurred with prompted input when no
closing quote was provided.
----------------------------------------
VERSION 0.9F
Added code to shut off ZEX input during input prompting. The parameter $I
can be used to turn on ZEX input redirection for the next input prompt. I
eliminated the automatic upper-casing of the ALIAS.CMD input so that prompts
will be displayed as they appear in the alias script. Extended the $R
(register input) function to accept not only registers 0..9 but also
registers 'A'..'F'. The register that is used to set the configuration of
ARUNZ can now be in the range 0..1FH. Put data into a DSEG so that
uninitialized data will not be included in the file.
----------------------------------------
VERSION 0.9E
Added configuration option to control whether or not the current directory
will be scanned for ALIAS.CMD (assuming path searching is ON and rootpath is
OFF). Also added option of using a user register to control all the flags.
----------------------------------------
VERSION 0.9D
Fixed a problem with the use of the root path when the user's path was
completely empty. In that case, the fixed DU specification will be used
instead.
----------------------------------------
VERSION 0.9C
Converted to ZCPR33 type-3 environment. Added code to skip leading spaces
and a leading colon in the command tail so that the command line ":VERB
etc." can invoke the alias VERB. Turned of SCANCUR in search for ALIAS.CMD
along the path. Added minimum truncation feature. If an alias name
contains a dot ('.'), then any characters after the dot only have to match
if they are present.
----------------------------------------
VERSION 0.9B
Fixed help test not to invoke help screen when alias name starts with a
control character. In fact, modified routines to allow and process alias
names with control characters other than tab.
----------------------------------------
VERSION 0.9A
Fixed two relative jump range errors. My previous definition of the macro
@GENDD was inadequate with a single-pass assembler (or perhaps any
assembler, really). I rewrote the Zilog code to use the MACLIB Z80 pseudo-
op of the SLRMAC assembler. Those using other assemblers may have to alter
this code.
----------------------------------------
VERSION 0.9
Fixed bug in CMPNAME code that caused subsequent script names to be ignored
if a previous script name matched but was longer than the one specified
(e.g., NAME1=NAME SCRIPT). On user input, modified code to skip leading
spaces.
----------------------------------------
VERSION 0.8
Changed code at ONAME to get the alias name not from the default FCB but
from the command tail. This will allow alias names longer than 8 characters
and also avoid the problem caused by the bug in ZCPR3.ASM that messes up the
FCB. Added parameters $" and $' to allow user input. Added parameter $M to
return the contents of a memory location in hex and $R to return the hex
representation of the value of a register. Added macros for Z80 opcodes and
put them in some of the code (may have missed a few places).
----------------------------------------
VERSION 0.7
Put configuration flag code into a macro to eliminate possibility of making
a code change in the wrong place (I did so several times). Added code to
display a warning message when a bad script format is detected (bad
parameter usage). Added the facility to enter control characters using the
form "^c", where "c" is any character. "$^" is used to enter a caret into
the line. Added code for using root of path option. Added capability to
have multiple names for the same script using the form "NAME1=NAME2=..=NAMEn
SCRIPT". Also implemented wildcard name matching so that a name like "?DIR"
will match a request for "XDIR" or "SDIR", etc.
----------------------------------------
VERSION 0.5
Added patches to make a quiet version, using two flags with the other ones
just before START. These flags use individual bits to control the display
of specific messages. The bit assignments are documented below at the
QUIETF label. The alternate flag QUIETECP is used when ARUNZ is called as
an ECP.
The program also has a default alias feature. An alias name in the file
ALIAS.CMD that begins with a colon will be taken as a match for any alias
name. If used, such an alias script should be placed at the end of the
file.
\
;=============================================================================
; E Q U A T E S
NO EQU 0
YES EQU NOT NO
WILDCHAR EQU '_'
OPTCHAR EQU ','
DEFLTCHAR EQU ':'
TYPECHAR EQU '>'
NPROMPTS EQU 4 ; Number of prompted input parameters
BUFSIZE EQU 8 ; File input buffer in records
Z33ONLY EQU NO ; Yes if relying on Z33 parser
PINPUT EQU YES ; Include user input parameters $", $'
PREG EQU YES ; Include register parameter $R
PMEM EQU YES ; Include memory parameter $M
PENV EQU YES ; Include ENV address parameter $A
PDATE EQU YES ; Include datestamper date parameter
TBUFF EQU 80H
FCB EQU 5CH
CR EQU 0DH
LF EQU 0AH
TAB EQU 09H
BELL EQU 07H
EOT EQU 1AH
; ---------- Error codes
; ZCPR34 uses the error byte at the beginning of the message buffer as a flag
; to show what kind of error occurred. Advanced error handlers will be able
; to help the user further by suggesting the possible cause of the error.
ecbaddir equ 2 ; Bad directory specification -- logging of
; ..user number beyond legal range,
; ..nonexistent named directory
ecbadcmd equ 5 ; Bad command form -- wildcard or file type
; ..present in command verb
ececperr equ 6 ; ECP error -- command could not be executed
; ..by ECP, error handling was forced by a
; ..transient for its own reasons
; (DO NOT CHANGE FROM 6)
;=============================================================================
; U S E R M A C R O S
; This macro places configuration flags in the code.
CONFIG MACRO
DEFB 'SIZE'
CODESIZ:
DEFW CODESIZE
DEFB 'TABFLAG'
TABFLAG:
DEFB 0 ; Set to 09 to allow tabs as token
; ..delimiters
; These two flags, which appear just before the marker string 'REG' determine
; which messages will be displayed by ARUNZ. The QUIETECP flag applies when
; ARUNZ has been invoked as an extended command processor. If invoked by the
; user, QUIETF applies. Contrary to what the symbol name would imply, setting
; bits in the flag turns on the display of that message.
QUIETECP:
DEFB 00000100B ; Quiet flag for ECP invocation
QUIETF: DEFB 00001110B ; Flag to control display of messages
; |||||||| ;set bit to display msg
; |||||||*---- signon message
; ||||||*----- running alias "x" message
; |||||*------ alias.cmd file not found
; ||||*------- alias "x" not found
; |||*-------- ECP error
; ||*--------- shell invocation error
; **---------- bits not assigned
; If the value of REGF is in the range 0..1FH, then that user register will be
; used to set the values for the three path-related flags to follow. Bit 0
; is used to select path searching of some kind. If it is not set, then the
; fixed DU is used. Bit 1 determines whether only the root will be searched.
; If it is not set, then the entire path will be searched. Bit 2 determines
; whether full path searches will include the current directory first.
DEFB 'REG'
REGF: DEFB 0FFH
; PATHF determines whether path searching will be used to locate ALIAS.CMD.
; If the flag is 0, then the fixed DU area below will be used. If it is 0FFH,
; then the other path-related flags will be used to determine how the search
; is performed.
DEFB 'PATH'
PATHF: DEFB YES ; Path search flag (NO = use DU given below)
; ROOTF determines whether only the root of the path will be searched. If it
; is 0FFH, then only the root will be used; if it is 0, then the entire path
; will be searched.
DEFB 'ROOT'
ROOTF: DEFB YES ; NO = use entire path / YES = root only
; If full path searching is selected, then SCANCUR determines whether or not
; to include the current directory first.
DEFB 'SCANCUR'
SCANCUR:
DEFB YES ; YES = search current DU first
; If path searching is disabled, then the explicit directory specified here
; will be searched for ALIAS.CMD.
DEFB 'DU'
CMDDRV: DEFB 0 ; Drive to use if not path (drive A = 0)
CMDUSR: DEFB 0 ; User to use if not path
ENDM
;=============================================================================
; E X T E R N A L R E F E R E N C E S
; DSLIB
EXT FINDCK,RDCLK
; Z33LIB or Z34LIB
EXT Z33CHK,SCAN,FCB1CHK,PRTTYPE,GETCCP
; Z3LIB
EXT Z3INIT,GETEFCB,GETCL1,GETENV,GETFN2,GETPATH,GETREG
EXT ZFNAME
; SYSLIB
EXT CODEND,SKSP,CAPS,PRINT,CRLF,COUT,ACASE1
EXT FXI$OPEN,FX$GET,PFIND,INITFCB
EXT LOGUD,PUTUD,GETUD,RETUD
EXT GETCST,PUTCST,GETMSG
IF PINPUT
EXT BLINE,GETZEX,PUTZEX
ENDIF
IF PMEM OR PREG
EXT MA2HC,MA3DC,MAFDC
ENDIF
IF PREG
EXT GETREG
ENDIF
IF PMEM OR PENV OR PREG
EXT EVAL16
ENDIF
IF PENV
EXT MHL4HC
ENDIF
;=============================================================================
; Z C P R I N I T I A L I Z A T I O N
; TYP3HDR.Z80, Version 1.1, safety header
entry:
jr start00 ; Must use relative jump
defb 0 ; Filler
db 'Z3ENV'
type:
db 3 ; Type-3 environment
z3eadr:
dw 0 ; Filled in by Z33
dw entry ; Intended load address
CONFIG ; Macro with configuration flags
IOCTL: ; I/O control block for alias file
DEFB BUFSIZE ; Buffer size in records
DEFS 1 ; Eof flag (filled in by FXIO)
DEFS 2 ; Byte counter (filled in by FXIO)
DEFS 2 ; Next byte pointer (filled in by FXIO)
BUFADR: DEFW 0 ; Buffer address (filled in by code later)
IOFCB:
DEFS 1 ; Initialized by FXIO
DEFB 'ALIAS ' ; File name
DEFB 'CMD' ; File type
DEFS 24 ; Initialized by FXIO
;=============================================================================
; M A I N P R O G R A M C O D E
start00:
ld hl,0 ; Point to warmboot entry
ld a,(hl) ; Save the byte there
di ; Protect against interrupts
ld (hl),0c9h ; Replace warmboot with a return opcode
rst 0 ; Call address 0, pushing RETADDR onto stack
retaddr:
ld (hl),a ; Restore byte at 0
dec sp ; Get stack pointer to point
dec sp ; ..to the value of RETADDR
pop hl ; Get it into HL and restore stack
ei ; We can allow interrupts again
ld de,retaddr ; This is where we should be
xor a ; Clear carry flag
push hl ; Save address again
sbc hl,de ; Subtract -- we should have 0 now
pop hl ; Restore value of RETADDR
jr z,start ; If addresses matched, begin real code
ld de,notz33msg-retaddr ; Offset to message
add hl,de
ex de,hl ; Switch pointer to message into DE
ld c,9
jp 0005h ; Return via BDOS print string function
notz33msg:
defb 'Bad load address',bell,'$'
START: ; Initialize
LD HL,(Z3EADR) ; Pt to ZCPR3 environment
CALL Z3INIT ; Initialize ZCPR3 environment
IF Z33ONLY
CALL Z33CHK ; Require Z33 or later
JR Z,STARTA
CALL PRINT
DEFB 'Z33 or later required',bell,0
RET
STARTA:
ENDIF ;Z33ONLY
LD (STACK),SP ; Save system stack pointer
LD SP,STACK ; Set up local stack
CALL SAVEUD ; Save user/disk information
LD A,(REGF) ; See if user register is setting configuration
CP 20H ; If not 00..1FH, use hard-coded options
JR NC,START0
LD B,A ; Get value of register
CALL GETREG
LD HL,PATHF ; Set up PATHF from user register
BIT 0,A ; ..based on bit 0
CALL INITFLAG
LD HL,ROOTF ; Set up ROOTF based
BIT 1,A ; ..on bit 1
CALL INITFLAG
LD HL,SCANCUR ; Set up SCANCUR based
BIT 2,A ; ..on bit 2
CALL INITFLAG
START0:
XOR A ; Set rflag for non-recursive script
LD (RFLAG),A
IF PINPUT
LD A,2 ; Set ZEX input redirection flag off
LD (ZEXFL),A
ENDIF ;PINPUT
CALL GETCST ; Get command status flag
LD (CSFLAG),A ; Save for later
AND 100B ; See if ECP invocation
JR Z,START1 ; If not, skip on
LD A,(QUIETECP) ; If so, substitute flag quietecp
LD (QUIETF),A
; Define data buffer areas
START1:
CALL CODEND ; Command line will be here at end
LD A,(TYPE) ; If type 4, we cannot rely on CODEND value
CP 4
JR NZ,START2
LD HL,(CODESIZ) ; Size of code, including lib routines
LD DE,ENTRY
ADD HL,DE ; HL now has address of end of code
START2:
LD (CLBUF),HL
DSEG
CLBUF DS 2
CSEG
LD DE,100H ; Allow 256 bytes for new command line
ADD HL,DE
LD (TAILBUF),HL ; Command tail buffer will be here
LD DE,80H ; Allow 128 bytes
ADD HL,DE
DSEG
TAILBUF:
DS 2
CSEG
IF PINPUT ; Allow space for user responses to prompts
LD (PROMPTBUF),HL
LD DE,NPROMPTS*80H
ADD HL,DE
XOR A ; Initialize prompt count
LD (PROMPTCNT),A
DSEG
PROMPTBUF:
DS 2
PROMPTCNT:
DS 1 ; Number of prompts
CSEG
ENDIF ;PINPUT
LD (BUFADR),HL ; File buffer will be here
LD B,BUFSIZE ; Compute ending memory address
LD DE,80H ; ..by adding file buffer space
FINDEND:
ADD HL,DE
DJNZ FINDEND
EX DE,HL ; Ending address into DE
CALL GETCCP ; Get CCP starting address
XOR A ; Make sure carry is clear
EX DE,HL
SBC HL,DE
JR C,FINDEND1 ; If carry set, we have enough room
CALL PRINT
DEFB 'Insufficient TPA',BELL,0
JP ERRQUIT
FINDEND1:
CALL SAVETAIL ; Save the command tail in tailbuf
CALL HELPCHK ; See if built-in help requested
CALL FINDFILE ; Find the ALIAS.CMD file
CALL FINDALIAS ; Find the named alias script
CALL PRTALIAS ; Display alias-running message
; Process the alias script