; Program: ERRSET ; Author: Jay Sage ; Version: 1.3 ; Date: June 1, 1987 ; * * * IMPORTANT NOTE * * * ; ; This program is copyrighted 1987 by NAOG/ZSIG. It may be copied and ; modified freely for personal use but may not be sold or distributed for a ; fee. Modified versions must be submitted to and approved by NAOG/ZSIG ; before they may be distributed. See the file ZSIGPOL1.DOC on Z-Nodes for ; the ZSIG policy on signing out and modifying programs. version equ 13 ; This program displays, clears, or sets the error handler command line. ; Error messages are given if there is no message buffer (and hence no ; external error handling) or if an attempt is made to load an error command ; line that is too long. For the sake of neatness, ERRSET clears extraneous ; bytes in the the message buffer beyond the terminating null of the new ; command line. The built-in help screen describes the syntax. ; UPDATE HISTORY ; Version 1.3 ; Updated to ZCPR33 compatibility using Z33LIB routines. ; Version 1.2 ; Corrected mistake resulting from misconception that error handler ; command line buffer was only 16 bytes long. It was originally 32 ; bytes long, but ZCPR33 has taken some of that space. ERRSET now ; allows a number set by the CMDLEN equate. A value of 25 is ; recommended. A value of 28 is the largest allowed with ZCPR33. ;============================================================================= ; E Q U A T E S no equ 0 yes equ not no usedseg equ no ; If yes, uses separate data segment and ; ..requires special linking cmdlen equ 25 tbuff equ 80h fcb equ 5ch cr equ 0dh lf equ 0ah tab equ 09h bell equ 07h eot equ 1ah ;============================================================================= ; E X T E R N A L R E F E R E N C E S ext z3init,print,pstr,getmsg,sksp,z33chk,geterc,puterc ;============================================================================= ; Z C P R I N I T I A L I Z A T I O N ; External ZCPR3 Environment Descriptor entry: jp start defb 'Z3ENV' ; This is a ZCPR3 utility defb 3 ; zcpr33 type 3 environment z3eadr: defw 0 ; Filled in by CPR or install program defw entry ; Load address for ZCPR33 type 3 environment ;============================================================================= ; M A I N P R O G R A M C O D E start: ld hl,(z3eadr) ; Pt to ZCPR3 environment call z3init ; Initialize Z3 system ; Check for option or help request call getfirst ; Get first non-space character in tail jp z,display ; Branch if null command line cp '/' ; Branch if not an option request jr nz,start1 inc hl ; Point to next character ld a,(hl) ; ..and get it cp 'C' ; Clear option? jr z,cancel cp 'Z' ; Zero option? jp nz,help ; If not, branch to help message cancel: call getmsg ; Get pointer to message buffer ld (hl),0 ; Reset error-handler-installed flag (ZCPR30) call geterc ; Get pointer to error command line ld b,cmdlen ; Zero out error command line xor a cancel1: ld (hl),a inc hl djnz cancel1 call print defb cr,lf defb ' External error handling turned off' defb 0 jp quit start1: call puterc ; Copy user's command line to error line jr nz,start2 ; If successful, branch to START2 call print ; Otherwise report error defb cr,lf,bell,' Command line too long',0 jr cancel start2: call getmsg ; Get pointer to message buffer ld (hl),0ffh ; Set error-handler-installed flag (ZCPR30) display: call z33chk ; See if ZCPR33 is running (Z set if so) jr z,dsp33 ; If so, skip over ZCPR30-style checking call getmsg ; Get pointer to first byte of message buffer ld a,(hl) ; See if error handler is engaged or a jr z,noerrh ; Case for error handler not engaged dsp33: call geterc ; Get pointer to error command line ld a,(hl) ; Get first byte or a ; Check for null line jr nz,errh ; If not null, branch noerrh: call print defb cr,lf defb ' No error handler loaded' defb 0 jr quit errh: call print defb cr,lf defb ' Error handler command line set to: ' defb 0 call pstr ; Print error handling command line quit: call print defb cr,lf defb 0 ret ;----------------------------------------------------------------------------- ; Get the first non-space character in the command line tail and set the ; zero flag to reflect end-of-line status. getfirst: ld hl,tbuff+1 ; Point to command tail call sksp ; Skip over leading spaces ld a,(hl) ; Get first character or a ret ;----------------------------------------------------------------------------- ; Copy characters from HL to DE up to number allowed in error command line. copy: ld b,cmdlen ; Maximum characters to copy copy1: ld a,(hl) ; Get next character from command tail or a ; End of tail? ret z ld (de),a ; Copy the character inc hl ; Increment pointers inc de djnz copy1 ; Continue copying ret ;----------------------------------------------------------------------------- help: call print defb cr,lf,lf defb tab,tab,'ERRSET Version ' defb version / 10 + '0' defb '.' defb version mod 10 + '0' defb ' [ZSIG]' defb cr,lf,lf defb ' Syntax:' defb cr,lf,lf defb tab,'ERRSET',tab,tab,'display current error command line' defb cr,lf defb tab,'ERRSET CMDLINE',tab,'set new error command line' defb cr,lf defb tab,'ERRSET /C',tab,'clear external error handling' defb cr,lf defb tab,'ERRSET /Z',tab,'zero out external error handling' defb cr,lf,lf defb ' Example: ERRSET A15:VERROR' defb cr,lf,lf defb tab,'An explicit DU: or DIR: prefix can speed error handling.' defb cr,lf defb tab,'NOTE: the command line entered is not checked ' defb 'for validity.' defb cr,lf,lf defb 0 ret ;----------------------------------------------------------------------------- if usedseg dseg endif dummybuf: defs cmdlen end