.TITLE DIRERR - 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: DIRERR.MAC ; Author: Robin Miller ; Date: February 19, 1985 ; ; Description: ; ; Write a directive or FCS error message. ; ; Modification History: ; ; April 12, 1985 by Robin Miller. Edit (01), Version 1.1 ; If an error occurs when getting a brief directory format, add ; carriage control if we're not at the first column position. ; ;- .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. ALLBIT = TXTBIT!MIDBIT!SEVBIT!FACBIT ; All error text bits. ; 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 %DIR% ; The facility name. UNRECM: .ASCIZ %Unrecognized command - % .EVEN .SBTTL CHKERR - Check for directive and I/O errors. ;+ ; ; CHKERR - Check for directive or I/O errors to terminal. ; CHKDSK - Check for directive or I/O errors from disk I/O. ; ; 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 ... CHKDSK::BCS CHKDIR ; If CS, directive error. MOV R0,-(SP) ; Save R0 on the stack. MOVB DSKSB,R0 ; Copy the I/O status code. BR 10$ ; And use common code ... CHKERR::BCS CHKDIR ; IF CS, DIRECTIVE ERROR MOV R0,-(SP) ; SAVE R0 ON STACK MOVB TIOSB,R0 ; I/O ERROR ENCOUNTERED ? 10$: 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. ; ; Outputs: ; C bit is set to indicate error occured. ; ; All registers are preserved. ; ;- .ENABL LSB WRTERR::CALL $SAVAL ; Save all registers. MOV #ERRBLK,R5 ; Address of the argument block. MOV R0,@ERROFF(R5) ; Save the error code. MOV #ALLBIT,@FLGOFF(R5) ; Include all error text. BIT #B.STUP,STATUS ; Are we in the startup code ? BNE 10$ ; If NE, yes. MOV #TXTBIT,@FLGOFF(R5) ; No, get the message text only. 10$: CALL WAITIO ; Wait for any outstanding I/O. CALL GETMSG ; Get the error message text. MOV BUFADR,R0 ; Copy the output buffer address. MOV BUFOFF(R5),R1 ; Copy the error buffer address. MOV @STAOFF(R5),R2 ; Copy the output byte count. BMI 90$ ; If MI, no message returned. ; If in the startup code, put file name at end of error message. MOV EENTRY,R5 ; Copy the erroring file entry. BIT #B.FERR,STATUS ; Did we have a file error ? BEQ 20$ ; If EQ, no. BIT #B.STUP,STATUS ; Are we in the startup code ? BEQ 30$ ; If EQ, no. 20$: CALL MOVEC ; Copy error text to output buffer. BIT #B.FERR,STATUS ; Did we have a file error ? BEQ 80$ ; If EQ, no (no file name). MVS < - > ; Delimiter between file name. MOV O.DEVU(R5),R1 ; Yes, copy device/UIC address. CALL MOVEC ; And append to the buffer. MOV O.FNAM(R5),R1 ; Set address of the file name. CALL MOVEC ; Append it to the output buffer. BR 80$ ; Now, go display the message. ; If displaying a file, append error to end of file name. 30$: MOV BUFPTR,R0 ; Copy current output buffer address. TSTB SWMASK ; Getting a brief directory ? (01) BNE 50$ ; If NE, no. (01) TST COLCNT ; Is this the first column ? (01) BEQ 40$ ; If EQ, yes. (01) CRLF ; No, add carriage control. (01) CLR COLCNT ; Show we're at first column. (01) 40$: CALL DONAME ; Format the device/file name. (01) MOV #M.BREF,FLDMAX ; Set maximum brief field size. (01) PAD ; Pad the file name field. (01) BR 70$ ; Now add the error message. (01) 50$: BIT #B.FULL,SWMASK ; Getting a full directory ? BEQ 60$ ; If EQ, no. CRLF ; Else, add carriage control. 60$: CALL DONAME ; Format the device/file name. 70$: CALL MOVEC ; Now append the error message. CRLF ; Add some carriage control. 80$: MOV R0,R1 ; Copy the ending buffer address. MOV BUFADR,R0 ; Copy the output buffer address. SUB R0,R1 ; Calculate the byte count. CALL WRITIT ; Write it to the terminal. CALL WAITIO ; Wait for any outstanding I/O. 90$: SEC ; Show there was an error. RETURN .DSABL LSB .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. ; ; Inputs: ; R1 = The message address (terminated by null). ; R2 = The message byte count. ; ; Outputs: ; All registers are preserved. ; ;- OUTMSG::JSR R2,$SAVVR ; Save R0 - R2. CALL WRTMSG ; Write the message to the terminal. ; R1 = The message buffer address. 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. MOV R0,R5 ; Save the starting buffer address. MOV BUFADR,R0 ; Copy the output buffer address. MOV #UNRECM,R1 ; Set the message address. CALL MOVEC ; Copy it. MOV R3,R2 ; Copy the remaining byte count. SUB R5,R4 ; Calculate the bytes processed. BEQ 20$ ; If EQ, we're at start of the buffer. 10$: MOVB (R5)+,(R0)+ ; Now copy start of the string. SOB R4,10$ ; Loop until done. 20$: TST R2 ; Any unprocessed bytes ? BEQ 40$ ; If EQ, no. MOVB #'{,(R0)+ ; Show where the error occured. 30$: MOVB (R5)+,(R0)+ ; Copy the remaining bytes. SOB R2,30$ ; Loop until we're done. MOVB #'},(R0)+ ; Show end of erroring text. 40$: CALL TYPMSG ; Write message to the terminal. 100$: SEC ; Show there has been an error. RETURN .END