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
/
Z3-33
/
Z33TRC11.LBR
/
RCPX.ZZ0
/
RCPX.Z80
Wrap
Text File
|
2000-06-30
|
6KB
|
245 lines
; Program: RCPX
; Version: 1.0
; Author: Cameron W. Cotrill
; Date: Sept 17, 1987
; Derivation: NONE
;
; Remove routine for Z33TRCP. This can be extended to cover removal
; of other Plu*Perfect RSX's if desired. Error handler hooks are
; included. If all goes well, no screen output is done.
;
; RCPX has 2 options:
; // will display help as any normal ZCPR utility.
; N will supress error handler if Z33TRCP not present. This
; option will find most use in aliases to invoke memory hungry
; programs.
;
; RCPX is copyright 1987 by Cameron W. Cotrill. All rights reserved.
; End-user distribution and duplication permitted for non-commercial
; purposes only without prior written permission from the author.
; Permission to use routines from RCPX in other programs subject to
; the above mentioned distribution and duplication restrictions is
; automatically granted provided the source of the routines is noted
; in both the source code and documentation and the copyright notice
; is retained.
;
VERMAJ EQU 1 ; Major version number
VERMIN EQU 0 ; Minor version number
OS$BASE EQU 0 ; Base address of system
BDOS EQU OS$BASE+5
FCB1 EQU OS$BASE+5CH
CR EQU 0DH
LF EQU 0AH
CSEG
RCPX:
JP START
DB 'Z3ENV' ; Normal type 3 env header
DB 3
ENVADR:
DW 0
DW RCPX
;
START:
LD (OLDSP),SP
LD SP,STACK ; Set up program stack
LD A,(FCB1+1)
CP '/'
JR Z,HELP ; See if help
CALL CKRSX ; See if we really have a plu*perfect rsx
JR NZ,TSTERR ; No rsx, then error
LD DE,TRCPNAME ; Ok, see if it's the rsx we want
CALL RSXNCP ; Compare rsx id to target
JP NZ,TSTERR ; Not it - error
CALL RSXDEL ; Else try removal
CALL NC,RSXERR ; If won't remove
RCPX1:
LD SP,(OLDSP) ; Restore user stack
RET ; And return
;
TSTERR:
LD A,(FCB1+1)
CP 'N' ; See if not present error supressed
CALL NZ,RSXERR ; If not, trip the error handler
JR RCPX1 ; And exit
;
HELP:
LD DE,HELPM
LD C,9
CALL BDOS ; Give help
JR RCPX1
;
HELPM:
DB 'RCPX V',VERMAJ+'0','.',VERMIN+'0',CR,LF
DB 'Copyright (C) 1987 Cameron W. Cotrill',CR,LF,LF
DB 'Removes Z33TRCP temporary RCP buffer from memory. Syntax:',CR,LF
DB ' RCPX N - N option supresses error report if Z33TRCP not present',CR,LF
DB LF,'$'
;
TRCPNAME:
DB 'Z33TRCP',0
;
DSEG
OLDSP:
DW 0
DS 10H
STACK:
PAGE
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; ROUTINE: CKRSX
; FUNCTION: Check if Plu*Perfect type RSX present
; CALL PARAMS: NONE
; RETURNS: Z flag clear if no RSX, Z flag set if RSX present
; HL = Base address of RSX header
; ALTERS: AF,HL
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;
CSEG
CKRSX:
PUSH BC
PUSH DE
LD HL,(OS$BASE+6) ; Where is bdos pointing?
PUSH HL ; Save alleged rsx pointer
LD A,0C3H ; Jump opcode
LD DE,3
LD B,E
CKRSX1:
CP (HL) ; Is jump?
JR NZ,NOTRSX ; No, then can't be pps rsx
ADD HL,DE
DJNZ CKRSX1 ; Keep checking
;
INC HL
INC HL
LD E,(HL)
INC HL
LD D,(HL) ; Get what should be pointer to rsx
INC HL
EX (SP),HL ; Stash current pointer and get base addr
AND A
SBC HL,DE
JR NZ,NOTRSX ; If protect addr doesn't match rsx base
EX DE,HL ; Match so put in hl
EX (SP),HL ; Pointer in hl, rsx base on stack
INC HL
INC HL
CP (HL) ; This should be a jump also
NOTRSX:
POP HL ; Restore base pointer
POP DE
POP BC
RET
PAGE
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; ROUTINE: RSXNCP
; FUNCTION: Check if RSX matches the one we want
; CALL PARAMS: DE = ID string to match (? matches any char except
; null). Must be 0 terminated.
; HL = Pointer to rsx header
; RETURNS: Z flag clear if match, Z flag set if no match
; ALTERS: AF
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;
CSEG
RSXNCP:
PUSH BC
PUSH DE
PUSH HL
LD BC,13 ; Offset to name pointer
ADD HL,BC
LD A,(HL)
INC HL
LD H,(HL)
LD L,A ; Fetch name pointer
RSXNC1:
LD A,(DE) ; Get compare char
AND A
JR Z,RSXNCX ; All matched
INC (HL)
DEC (HL) ; Test if end of target
JR Z,RSXNC3 ; Yes, then strings don't match
CP '?' ; Do we care what target is?
JR Z,RSXNC2 ; If not
CP (HL) ; Test match
RSXNC2:
INC HL
INC DE ; Bump pointers
JR Z,RSXNC1 ; And loop if matched
RSXNC3:
XOR A ; No match so insure z flag clear
DEC A
RSXNCX:
POP HL
POP DE
POP BC
RET
PAGE
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; ROUTINE: RSXDEL
; FUNCTION: Remove lowest Plu*Perfect type RSX
; CALL PARAMS: NONE
; RETURNS: C flag clear if error, C flag set if remove OK
; ALTERS: AF
; NOTES: Be real sure an RSX is there before calling this.
; otherwise, program leaps to the great beyond.
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;
CSEG
RSXDEL:
PUSH BC
PUSH DE
PUSH HL
LD HL,(OS$BASE+6)
LD DE,6 ; Point to remove entry
ADD HL,DE
LD DE,RSXDE1
PUSH DE ; Return address
JP (HL) ; 'call' remove
RSXDE1:
POP HL
POP DE
POP BC
RET
;
PAGE
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; ROUTINE: RSXERR
; FUNCTION: SET Z33 RSX REMOVAL ERROR
; CALL PARAMS: NONE
; RETURNS: NONE
; ALTERS: NONE
; NOTE: IT DOESN'T HURT TO CALL THIS ROUTINE EVEN IF
; THE RSX IS SMART ENOUGH TO DO THIS ITSELF.
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;
CSEG
RSXERR:
PUSH AF
PUSH BC
PUSH HL
LD HL,(ENVADR)
LD A,H
OR L
JR Z,RSXERX ; Exit if no env
LD BC,22H ; Offset to message buffer pointer
ADD HL,BC
LD A,(HL)
INC HL
LD H,(HL)
LD L,A ; Message pointer in hl
LD (HL),21 ; Set rsx load error
INC HL
INC HL
INC HL ; Point to zcpr33 command status flags
LD A,1110B ; Transient, error, ecp flags set
OR (HL)
LD (HL),A
RSXERX:
POP HL
POP BC
POP AF
RET
;
END