.TITLE KERERR - KERFIL error routines .SBTTL S Hecht/D Stevens/R McQueen 14-July-1983 ;++ ; This module contains the error processing routines for PRO/Kermit. ; Some of the error text is also contained in this module. ;-- ; Version number .IDENT /1.0.02/ ; Directives .LIBRARY /KERMLB/ ; Kermit macro library .ENABLE LC ; Enable lower case in ASCIx .NLIST BEX .SBTTL Revision History ;++ ; 1.0.00 By: Authors On: Many days ; Create this module ; ; 1.0.01 By: Robert C. McQueen On: 15-Feb-1984 ; Position the cursor to the correct place to output error ; messages. ; ; 1.0.02 By: Nick Bush On: 15-Feb-1984 ; Fix calls to SND.ERROR to have arguments in the correct ; order. ;-- .SBTTL Get general symbol ;++ ; Include the PRO/Kermit definitions ;-- .MCALL KERDEF KERDEF ; Define all of the various ; symbols .MCALL CHRDEF ; Character definitions CHRDEF ; Get the character definitions .MCALL BLSRTN ; Allow use of BLISS macros .MCALL BLSCAL ; from library .MCALL MSG ; Text expansion macro .MCALL PJMP ; Jump and return macro .SBTTL Error routine data ; Psect for the read only data .PSECT $PLIT$, RO , D ; File specifications of where the message files are MSG MFIL, MSG RFIL, ; The following is the default text for error messages M$PROK: .ASCII \?PRO/Kermit \ PROK$L=.-M$PROK MSG RMSG, MSG MMSG, MSG URMS, MSG UKER, .SBTTL Data storage ;++ ; The following section contains the storage for KERERR. This storage ; is mainly for the calls. ;-- .PSECT $OWN$, D FRAMID: .BLKW 5 ; Up to 9 characters for frame-id FRAMLN: .BLKW ; Length of the frame id FILLEN: .BLKW ; Length of the file name RTNLEN: .BLKW ; Return length MESSAG: .BLKB 96. ; Place for up to 96 charaters ERRMSB: .BLKB 96. ; Error message to give to KERMSG ERRMSL=.-ERRMSB ; Length of message .EVEN ; Back to even addresses ERRLEN: .WORD 96. ; Length of the error buffer ; Argument block for the READ MESSAGE routine call ARGBLK: .BYTE 8.,0 .WORD STATUS ; Pointer to status information ARGFLN: .WORD 0 ; File name .WORD FILLEN ; Length of the file name .WORD FRAMID ; Frame id .WORD FRAMLN ; Length of the frame id .WORD MESSAG ; Place for the error message .WORD ERRLEN ; Error length .WORD RTNLEN ; Returned length .SBTTL RMS-11 Error processing ;++ ; This routine will handle the various possible RMS-11 errors that can occur. ; It will list the error information on the user's screen and then return ; to the caller. ; ; Usage: ; ; Macro: ; MOV #Error,R0 ; JSR PC,RMSERR ; (Return) ; ;-- .PSECT $CODE$, RO .GLOBL RMSERR RMSERR: NEG R0 ; Make this a positive number JSR PC,CVTERR ; Convert the error code to something ; real MOV #M$RFIL,R0 ; Point to the specification MOV #RFIL$L,R1 ; Store the length JSR PC,GETMSG ; Get the message from the file BCS 10$ ; Branch if the error code was set PJMP SNDMSG ; Send the error to the remote ; Here if we have to construct an error message for an unknown error message ; was encountered. 10$: MOV #M$RMSG,R0 ; Get the address of the error message MOV #RMSG$L,R1 ; Get the length MOV #M$URMS,R2 ; Get the other part PJMP MSGERR ; Issue the message error message .SBTTL Bliss Interface -- KRM.ERROR ;++ ; This routine is called from KERMSG to handle error processing for ; a specific error code. ;-- .PSECT $CODE$, RO BLSRTN KRM.ERROR,3, ; Bliss routine MOV ERRCOD(SP),R0 ; Move the error code to the register JSR PC,CVTERR ; Convert the error code to something ; real MOV #M$MFIL,R0 ; Point to the specification MOV #MFIL$L,R1 ; Store the length JSR PC,GETMSG ; Get the message from the file BCS 10$ ; Branch if the error code was set PJMP SNDMSG ; Send the error to the remote ; Here if we have to construct an error message for an unknown error message ; was encountered. 10$: MOV #M$MMSG,R0 ; Get the address of the error message MOV #MMSG$L,R1 ; Get the length MOV #M$UKER,R2 ; . . . ; PJMP MSGERR ; Issue the message error message .SBTTL MSGERR - Here if there was a message file error ;++ ; Here if there was a message file error message. Issue the error message ; and then send it to the remote system. ; ; Usage: ; MOV #Msg.address,R0 ; JSR PC,MSGERR ; (Return) ;-- .PSECT $CODE$, RO MSGERR: BLSCAL BL$MOV,,+ ; Move the first line MOV R0,TEMP ; Save for later JSR PC,ALTBUF ; Set the alternate type out BLSCAL TT.TEXT,,+ ; Type out the text BLSCAL TT.NUMB,,+ ; Output the first status number BLSCAL TT.CHAR,<#.CHCMA>,+ ; Output a comma BLSCAL TT.NUMB,,+ ; And the second part of the status BLSCALL TT.OUTPUT ; Output the text JSR PC,ALTRST ; Restore the old routine ;[02] ;[02] Build message with correct prefix to have KERMSG send ;[02] BLSCAL BL$MOV,<#PROK$L,#M$PROK,#ERRMSB>,+ ;[02] Copy prefix BLSCAL BL$CPY,,+ MOV IOBLEN,R2 ;[02] Get message length ADD #PROK$L,R2 ;[02] Including prefix BLSCAL SND.ER,,+ ;[02] Send the error the the remote BLSCAL BL$MOV,,+ ; Move the text MOV #1.,R2 ; Postion to the error place MOV #18.,R5 ;[01] . . . JSR PC,CURABS ; Position the cursor MOV TEMP,R0 ; Get the first line BLSCAL TT.TEXT,,+ ; Output the text BLSCAL TT.CRLF,,+ ; New line BLSCAL TT.TEXT,<#IOBUFF>,+ ; Output the built line BLSCAL TT.OUTPUT,,- ; Force it out RTS PC ; Return to the caller .SBTTL CVTERR - Convert error code to frame-id ;++ ; This routine will convert an error code to a frame-id. It will return ; with the length of the text and the text stored in the argument block ; to the RDMSG routine. ; ; Usage: ; MOV Msg.number,R0 ; JSR PC,CVTERR ; (Return) ; ;-- .PSECT $CODE$, RO CVTERR: MOV R0,-(SP) ; Save on the stack JSR PC,ALTBUF ; Set up the alternate routine MOV (SP)+,R2 ; Get the number back JSR PC,CHGDEC ; Output the number BLSCAL TT.OUTPUT ; Dump the buffer MOV IOBLEN,FRAMLN ; Store the length BLSCAL BL$MOV, ; Copy the information PJMP ALTRST ; Restore the alternate type out rtn .SBTTL Get an error message ;++ ; This routine will get an error message from the specified message ; file. It will return with the error message in the output buffer ; and the length of the error message. If the error message was not ; found, an error code will be returned. ; ; Usage: ; MOV #Address.of.file.spec,R0 ; MOV #Length.of.file.spec,R1 ; JSR PC,GETMSG ; (Return) ; ; On return: ; - If an error else ; - If not. ;-- .PSECT $CODE$, RO GETMSG: MOV R0,ARGFLN ; Store the address of the file name MOV R1,FILLEN ; Store the length of the file name MOV #ARGBLK,R5 ; Set up the argument block CALL RDMSG ; Call the subroutine that does the ; work TST STATUS ; Did we get an error? BGE 99$ ; No, just give a good return ; Here to pass a failure return back to the caller. Do this by setting ; the carry bit. SEC ; Set the failure (carry ; Here to return to the user. Note that carry is cleared by the TST, ; so we don't have to do it. 99$: RTS PC ; And return to the caller .SBTTL Send the error message ;++ ; This routine will issue the error message on the user's screen and send ; the error message back to the remote system. ; ; Usage: ; JSR PC,SNDMSG ; (Return) ; ; Assumes: ; GETMSG was called just before this. ; ;-- .PSECT $CODE$, RO SNDMSG: MOV RTNLEN,R0 ; Get the length returned CMP #79.,R0 ; Compare against max of 80 ; on the screen BGE 10$ ; Skip this if less than MOV #79.,R0 ; Truncate at 80 10$: BLSCAL BL$MOV,,+ ; Move the message to the buffer ;[02] ;[02] Build message with correct prefix to have KERMSG send ;[02] BLSCAL BL$MOV,<#PROK$L,#M$PROK,#ERRMSB>,+ ;[02] Copy prefix BLSCAL BL$CPY,,+ MOV ERRLEN,R2 ;[02] Get message length ADD #PROK$L,R2 ;[02] Including prefix BLSCAL SND.ER,,+ ;[02] Send the error the the remote MOV #1.,R2 ; Position to 1,23 MOV #18.,R5 ;[01] . . . JSR PC,CURABS ; Put the cursor there BLSCAL TT.TEXT,<#MESSAG>,+ ; Output the argument BLSCAL TT.OUTPUT,,- ; Output the text RTS PC ; Return to the caller .SBTTL End of KERERR .END