; B5-DRIV3.ASM for BYE501 and above by George F Peace ; (8/17/85) ; This is a CP/M Plus program ; function: loads or unloads the BYE5 RSX and initializes or resets the ; remote console environment. ; usage: Operates just as CP/M 2.2 BYE5 does. It is called by ; BYE.COM using the CP/M Plus Chain to program function. CR EQU 0DH LF EQU 0AH BDOS EQU 5 WBOOT EQU 0 PSTRING EQU 9 CALLRSX EQU 60 RSX$CK EQU 100 RSX$INIT EQU 101 RSX$TERM EQU 102 ORG 100H CALL RSXCHK ; See if the RSX is already loaded JZ TERMRSX ; We're already loaded, access active copy MVI A,RSX$INIT ; Get initialization function LOADRSX:STA RSXPB ; Store subfunction in parameter block MVI C,CALLRSX ; Get RSX command index LXI D,RSXPB ; Get RSX parameter block address CALL BDOS LDA STAT ; Get the status byte CPI 00 ; Was all ok? JNZ ERROR1 ; Nope - tell the caller EXIT: MVI C,WBOOT ; Terminate the program but not the RSX JMP BDOS TERMRSX:MVI A,RSX$TERM ; Get RSX termination function JMP LOADRSX ; Now go set up the RSX RSXCHK: MVI A,RSX$CK STA RSXPB ; Store subfunction in parameter block MVI C,CALLRSX ; Get RSX command index LXI D,RSXPB ; Get RSX parameter block address CALL BDOS LDA STAT1 ; Get the status byte CPI 0CCH ; Is the RSX loaded? RNZ ; Nope LDA STAT2 ; Get the second status byte CPI 0CCH ; Is the RSX loaded? RET ; Return ERROR0: MVI C,PSTRING ; Get print string function LXI D,ERR0MSG ; Get error message address CALL BDOS ; Display the error message JMP EXIT ; Go away ERROR1: MVI C,PSTRING ; Get print string function LXI D,ERR1MSG ; Get error message address CALL BDOS ; Display the error message JMP EXIT ; Go away ERR0MSG:DB 'Couldn''t find the BYE5 RSX in memory',CR,LF,'$' ERR1MSG:DB 'An unexpected error has occurred. The BYE5 RSX is returning' DB CR,LF DB 'a bad status. Reset the system and try again.' DB CR,LF,'$' RSXPB: DB RSX$INIT ; RSX initialization function DB 2 ; 2 parameter words follows DW RSXNAME ; Parameter 1 address DW ARGS ; Parameter 2 address RSXNAME:DB 'BYE5 ' ; Name of RSX we're calling ARGS: DB 0 STAT: STAT1: DB 0 STAT2: DB 0 DB 0,0,0 END