.TITLE ERROR .IDENT "V1.8" ; ; Author: D. Mischler 10-JUN-87 ; ; This module contains the error handling routines ; and all error message definitions. ; ; ; Macro to define an error code and message. ; .MACRO ERRDEF NAME,MESSAG NAME:: .ASCIZ \MESSAG\ .ENDM ERRDEF .PAGE .PSECT CODE,I,RO ; ; Subroutine to display an ASCIZ error message pointed to by R1. ; The appearance of a percent sign in the message indicates ; that the string pointed to by R0 should be inserted. ; ERROR:: CALL $SAVAL ; Save all registers. MOV SP,R5 ; Remember current stack position. MOV R1,R3 ; Copy error message address. ; See if the message contains a percent sign. CLR R4 ; Indicate no percent sign (yet). 10$: CMPB #'%,(R3) ; Found a percent sign? BNE 20$ ; No, check for end of string. MOV R0,R4 ; Indicate a percent sign was found. 20$: TSTB (R3)+ ; Hit end of string yet? BNE 10$ ; No, keep looking. TST R4 ; Did the message contain a percent sign? BEQ 70$ ; No, take the easy way out. ; Build the actual error message for display on the stack. 30$: CALL U$FTRM ; Find end of inserted string. SUB R4,R0 ; Get length of inserted item. SUB R1,R3 ; Get length of message text. ADD R0,R3 ; Get composite length. BIC #1,R3 ; Make sure length is even. SUB R3,SP ; Allocate a buffer. ; Copy the message onto the stack. MOV SP,R2 ; Produce a destination pointer. 40$: CMPB #'%,(R1) ; Found percent sign? BNE 60$ ; No, copy character into place. ; Insert the string pointed to by R4. TST R0 ; String copy already complete? BEQ 55$ ; Yes, do not buffer percent sign. 50$: MOVB (R4)+,(R2)+ ; Buffer a character. SOB R0,50$ ; Do 'em all. 55$: INC R1 ; Skip over percent sign. ; Buffer character. 60$: MOVB (R1)+,(R2)+ ; Buffer character, terminator? BNE 40$ ; No, keep copying. MOV SP,R1 ; Point to resulting message. ; Output the message. 70$: CALL LINOUT ; Output error message line. MOV R5,SP ; Restore incoming stack pointer. RETURN .PAGE .PSECT STRING,D,RO ; ; Error message definitions. ; ERRDEF E.AMBG, ERRDEF E.AROV,
ERRDEF E.AWMF,
ERRDEF E.BAR, ERRDEF E.BCF, ERRDEF E.BONF, ERRDEF E.CMDF, ERRDEF E.DAFU, ERRDEF E.DBZA, ERRDEF E.DFER, ERRDEF E.EQMS,