.TITLE VTLERR - Write An Error Message .IDENT /1.1/ .ENABL LC ;+ ; ; Free software BY ; Project Software & Development, Inc. ; ; This software is furnished for free and may be used and copied as ; desired. This software or any other copies thereof may be provided or ; otherwise made available to any other person. No title to and ; ownership of the software is hereby transferred or allowed. ; ; The information in this software is subject to change without notice ; and should not be construed as a commitment by PROJECT SOFTWARE ; AND DEVELOPMENT, INC. ; ; PROJECT SOFTWARE assumes no responsibility for the use or reliability ; of this software on any equipment whatsoever. ; ; Project Software & Development, Inc. ; 14 Story St. ; Cambridge, Ma. 02138 ; 617-661-1444 ; ; ; Title: VTLERR.MAC ; Author: Robin Miller ; Date: June 30, 1983 ; ; Description: ; ; Write a directive or FCS error message. ; ; Modification History: ; ; June 13, 1984 by Robin Miller. Edit (01), Version 1.1 ; Modified the write syntax routine (WRTSYN) to call routine DOCHAR ; to copy and format control characters on the command line. ; ;- .ENABL AMA .NLIST BEX .MCALL ALUN$S, PUT$, QIOW$S ; Offsets into error message block. ERROFF = 2 ; The error code offset. BUFOFF = 4 ; The output buffer offset. FLGOFF = 6 ; The message flags offset. FACOFF = 10 ; The facility name offset. STAOFF = 12 ; The status return offset. ALTOFF = 14 ; The alternate facility offset. ; Equates for RSX-11M error messages. TXTBIT = 1 ; Include text of the message. MIDBIT = 2 ; Include message the id field. SEVBIT = 4 ; Include severity the level. FACBIT = 10 ; Include the facility name. ; Argument block for error messages. ERRBLK: .BYTE 6,0 ; Argument block for GETMSG. .WORD ERRCOD ; Address of the error code. .WORD ERRBUF ; Address of the message buffer. .WORD MSGFLG ; Address of the flag word. .WORD FACNAM ; Address of the facility name. .WORD STACOD ; Address for the status return. .WORD -1 ; Address of the message facility. ERRCOD: .WORD 0 ; The error message code. MSGFLG: .WORD TXTBIT!MIDBIT!SEVBIT!FACBIT ; Include everything. STACOD: .WORD 0 ; RSXMSG status return code. FACNAM: .ASCIZ %VTL% ; The facility name. UNRECM: .ASCIZ %Unrecognized command - % .EVEN .SBTTL CHKERR - CHECK FOR ERRORS ;+ ; ; CHKERR - Check for directive or I/O errors to terminal. ; ; Inputs: ; $DSW = status from last directive issued. ; TIOSB = the terminal I/O status code. ; ; Outputs: ; C bit clear/set = success/failure. ; On failure, an error message is output. ; ;- .ENABL LSB CHKDIR::MOV R0,-(SP) ; SAVE R0 ON STACK BCC 30$ ; IF CC, SUCCESS MOV $DSW,R0 ; COPY THE ERROR CODE BR 20$ ; USE COMMON CODE ... CHKERR::BCS CHKDIR ; IF CS, DIRECTIVE ERROR MOV R0,-(SP) ; SAVE R0 ON STACK 10$: MOVB TIOSB,R0 ; I/O ERROR ENCOUNTERED ? BPL 30$ ; IF PL, NO (C CLEAR FROM $DSW) BIC #^C377,R0 ; CLEAR TO SHOW I/O ERROR ; Output the error message. 20$: CALL WRTERR ; Write the error message. 30$: MOV (SP)+,R0 ; Restore R0. RETURN .DSABL LSB .SBTTL WRTERR - Report an error message. ;+ ; ; WRTERR - Report an error message. ; ; This routine sets up the argument block and calls GETMSG to get the ; RSX-11M error message text. ; ; Inputs: ; R0 = The error code. ; R5 = The file table entry address. ; ; Outputs: ; C bit is set to indicate error occured. ; ; All registers are preserved. ; ;- WRTERR::CALL $SAVAL ; Save all registers. MOV R5,R4 ; Copy the file entry address. MOV #ERRBLK,R5 ; Address of the argument block. MOV R0,@ERROFF(R5) ; Save the error code. BIT #B.STUP,SWMASK ; Are we in the startup code ? BNE 10$ ; If NE, yes. MOV #TXTBIT,@FLGOFF(R5) ; No, get the message text only. 10$: CALL GETMSG ; Get the error message text. MOV BUFOFF(R5),R1 ; Copy the output buffer address. MOV @STAOFF(R5),R2 ; Copy the output byte count. BMI 90$ ; If MI, no message returned. ; If there was an FCS error, append the file name. BIT #B.FERR,STATUS ; Was there an FCS error ? BEQ 20$ ; If EQ, no. MOV R1,R0 ; Copy the starting buffer address. ADD R2,R0 ; Point to the end of the buffer. MOVB #SPACE,(R0)+ ; Put delimiter MOVB #'-,(R0)+ ; between error MOVB #SPACE,(R0)+ ; and file name. CALL BOLD ; Add the bold video attribute. MOV O.FNAM(R4),R1 ; Copy the file name buffer address. CALL MOVEC ; Copy the file name. MOV R0,R2 ; Copy the updated buffer address. MOV BUFOFF(R5),R1 ; Copy the starting buffer address. SUB R1,R2 ; Calculate the new byte count. 20$: CALL OUTMSG ; Output the error message. 90$: SEC ; Show there was an error. RETURN .SBTTL OUTMSG - Output a message to the terminal. ;+ ; ; OUTMSG - Output a message to the terminal. ; ; Thise routine is called to write a message to the terminal. If we're ; in the startup code, the message is written via a PUT$ incase we're ; running in batch on VAX/VMS. It we're not in the startup code, the ; message is written to the message line. ; ; Inputs: ; R1 = the message address. ; R2 = the message byte count. ; ; Outputs: ; All registers are preserved. ; ;- OUTMSG::JSR R2,$SAVVR ; Save R0 - R2. MOV R1,R0 ; Copy the output buffer address. ADD R2,R0 ; Point to the end of the buffer. MOV R1,R2 ; Save the starting buffer address. ; R0 = The ending buffer address. ; R1/R2 = The starting buffer address. ; If in the startup code, append carriage control. BIT #B.STUP,SWMASK ; Are we in the startup code ? BEQ 10$ ; If EQ, no. MOVB #CR,(R0)+ ; Append a carriage return MOVB #LF,(R0)+ ; and a line feed. CALL ADDBEL ; Ring the bell to wake them up. MOV R0,R1 ; Copy the updated buffer address. SUB R2,R1 ; Calculate the new byte count. PUT$ #TOFDB,R2,R1 ; Write it to the terminal/file. BR 20$ ; And use common return ... ; When not in the startup code, write message to message line. 10$: CALL WRTMSG ; Write the message to the terminal. ; R1 = The message buffer address. 20$: RETURN .SBTTL WRTSYN - Report a syntax error. ;+ ; ; WRTSYN - Report a syntax error. ; ; This routine is called when a syntax error has been detected by the ; table parser. ; ; Inputs: ; R0 = The starting buffer address. ; R3 = The remaining buffer byte count. ; R4 = The updated buffer address. ; ; Outputs: ; All registers are preserved. ; ;- WRTSYN::CALL $SAVAL ; Save all registers. BIT #B.MSG,STATUS ; Is a message already displayed ? BNE 100$ ; If NE, yes. MOV R0,R5 ; Save the starting buffer address. MOV #FMTBUF,R0 ; Setup the output buffer address. CALL SETMSG ; Position/clear the message line. MOV #UNRECM,R1 ; Set the message address. CALL MOVEC ; Copy it. MOV R3,R2 ; Copy the remaining byte count.(01) SUB R5,R4 ; Calculate the bytes processed. BEQ 20$ ; If EQ, we're at start of the buffer. 10$: MOVB (R5)+,R3 ; Copy the next character. (01) CALL DOCHAR ; Copy and format the character.(01) ;(01) MOVB (R5)+,(R0)+ ; Now copy start of the string. SOB R4,10$ ; Loop until done. 20$: TST R2 ; Any unprocessed bytes ? (01) BEQ 40$ ; If EQ, no. BIT #B.AVO,SWMASK ; Does terminal have the AVO ? BNE 25$ ; If NE, yes. CALL ATTOFF ; No, turn off the attributes. BR 30$ ; And continue ... 25$: CALL BOLD ; AVO, BOLD the remaining bytes. 30$: MOVB (R5)+,R3 ; Copy the next character. (01) CALL DOCHAR ; Copy and format the character.(01) ;(01) MOVB (R5)+,(R0)+ ; Copy the remaining bytes. SOB R2,30$ ; Loop until we're done. (01) 40$: CALL TYPMSG ; Write message to the terminal. 100$: SEC ; Show there has been an error. RETURN .END