.TITLE ERMSG - Error Processing .IDENT /V01.00/ .ENABL LC ;+ ; This routine formats and outputs error messages. ; ; Call with: JSR PC,ERMSG ; ; R0 = Error number (0 if none). ; R1 = Error type (0 if none). ; R2 = Error message (0 if none). ; R3 = Error PC (0 if none)(odd if exiting). ; R4 = Parameter to supply to optional line routine. ; R5 = Address of optional line routine (0 if none). ; ; R1 and R2 are pointer to ASCIZ strings. ; ; Exit with: Message output, task exits if PC is odd. ;- .MCALL EXST$S,EXIT$S,GTSK$S,ALUN$S,QIOW$,DIR$ CR = 15 ;CARRIAGE RETURN. LF = 12 ;LINE FEED. .PSECT ERR$TX,RO,D DSHMSG: .ASCIZ / -- / XITMSG: .ASCIZ /Exiting due to / ERRMSG: .ASCIZ /error / APCMSG: .ASCIZ /at PC / .PSECT ERR$RW,RW,D BUFFER: .BLKB <64.*4>+4 ;Output message buffer ERRTMP::.BLKW 18. ;Temporary buffer MSGDPB: QIOW$ IO.WVB,,24.,,,, .PSECT ERR$CD,RO,I ERMSG:: MOV R2,-(SP) ;Save the error message MOV R0,-(SP) ;Save the error number MOV R1,-(SP) ;Save the error type ; ; Format the first line. ; (taskname) -- [Exiting due to] [(error type)] ERROR [(error number)] ; MOV #BUFFER,R0 ;Get start of buffer MOVB #CR,(R0)+ ;Insert blank line MOVB #LF,(R0)+ ; .. MOVB #LF,(R0)+ ;Insert blank line GTSK$S #ERRTMP ;Get the taskname MOV ERRTMP+0,R1 ;Get the first part of the task name CALL $C5TA ;Convert to ASCII MOV ERRTMP+2,R1 ;Get the last part of the task name CALL $C5TA ;Convert to ASCII MOV #DSHMSG,R1 ;Get dashes CALL ERMOV ;Move to buffer BIT #1,R3 ;Is this message an exit? BEQ 1000$ ; if EQ - I think not MOV #XITMSG,R1 ;Say we are exiting CALL ERMOV ;Move to buffer 1000$: MOV (SP)+,R1 ;Get the error type BEQ 1100$ ; if EQ - there is none CALL ERMOV ;Move to buffer MOVB #' ,(R0)+ ;Place a space into buffer 1100$: MOV #ERRMSG,R1 ;Get the word error CALL ERMOV ;Move to buffer MOV (SP)+,R1 ;Get the error number BEQ 1200$ ; if EQ - no error number to output CLR R2 ;No leading zeros CALL $CBDSG ;Convert to signed decimal ascii 1200$: MOVB #CR,(R0)+ ;Done with first line MOVB #LF,(R0)+ ; ... ; ; Format the second line. ; [(error message)] ; MOV (SP)+,R1 ;Get message address BEQ 1300$ ; if EQ - none CALL ERMOV ;Move to buffer MOVB #CR,(R0)+ ;Done with second line MOVB #LF,(R0)+ ; .. ; ; Format the third line. ; [(optional error line)] ; 1300$: TST R5 ;Is there a routine BEQ 1400$ ; if EQ - none CALL (R5) ;Call said routine MOVB #CR,(R0)+ ;Done with third line MOVB #LF,(R0)+ ; ... ; ; Format the fourth line. ; [at PC (pc)] ; 1400$: BIT #177776,R3 ;Is there a PC? BEQ 1500$ ; if EQ - no MOV #APCMSG,R1 ;Get at PC message CALL ERMOV ;Move to buffer MOV R3,R1 ;Get PC BIC #1,R1 ;Make sure even MOV #1,R2 ;Set for leading zeros CALL $CBOMG ;Convert to octal magnitude MOVB #CR,(R0)+ ;Done with fourth line MOVB #LF,(R0)+ ; ... ; ; Output the resulting message. ; 1500$: MOVB #LF,(R0)+ ;Skip line SUB #BUFFER,R0 ;Get number of characters in message MOV R0,MSGDPB+Q.IOPL+2 ;Store in QIO DPB MOV ERLUN1,R0 ;Get the logical unit ALUN$S R0,#"TI,#0 ;Assign to user terminal MOV R0,MSGDPB+Q.IOLU ;Store lun number DIR$ #MSGDPB ;Issue QIO BIT #1,R3 ;Should we exit BEQ 9999$ ; if EQ - no, return to caller EXST$S #EX$SEV ;Exit with severe error EXIT$S ;Exit if exit status fails 9999$: SEC ;Set error return RETURN ;Return to caller ;+ ; Move ASCIZ string to buffer and update buffer pointer. ;- ERMOV:: MOVB (R1)+,(R0)+ ;Move character BNE ERMOV ; if NE - continue moving DEC R0 ;Back up buffer pointer RETURN ;Return to caller .END