	.TITLE	ERMSG
	.IDENT	/BL3.2/
;
;	Routine rewritten by J. CLEMENT April 1982
;
;	Error message routine
;
; LOCAL DATA
;
; ERROR MESSAGES
;
	.const
ERRTAB:	.WORDA	ERR0
	.WORDA	ERR1
	.WORDA	ERR2
	.WORDA	ERR3
	.WORDA	ERR4
	.WORDA	ERR5
	.WORDA	ERR6
	.WORDA	ERR7
	.WORDA	ERR8
	.WORDA	ERR9
	.WORDA	ERR10
	.WORDA	ERR11
	.WORDA	ERR12
	.WORDA	ERR13
	.WORDA	ERR14
	.WORDA	ERR15
	.WORDA	ERR16
	.WORDA	ERR17
	.WORDA	ERR18
	.WORDA	ERR19
	.WORDA	ERR20
	.WORDA	ERR21
	.WORDA	ERR22
	.WORDA	ERR23
	.WORDA	ERR24
	.WORDA	ERR25
	.WORDA	ERR26
	.WORDA	ERR27
	.WORDA	ERR28
	.WORDA	ERR29
	.WORDA	ERR30
	.WORDA	ERR31
	.WORDA	ERR32
	.WORDA	ERR33
	.WORDA	ERR34
	.WORDA	ERR35
	.WORDA	ERR36
	.WORDA	ERR37
	.WORDA	ERR38
	.WORDA	ERR39
	.WORDA	ERR40
	.WORDA	ERR41
	.WORDA	ERR42
	.WORDA	ERR43
	.WORDA	ERR44
	.WORDA	ERR45
	.WORDA	ERR46
	.WORDA	ERR47
	.WORDA	ERR48
	.WORDA	ERR49
	.WORDA	ERR50
	.WORDA	ERR51
	.WORDA	ERR52
	.WORDA	ERR53
	.WORDA	ERR54
	.WORDA	ERR55
	.WORDA	ERR56
	.WORDA	ERR57
	.WORDA	ERR58
	.WORDA	ERR59
ERREND:
FLGTAB:	.WORDA	MODEM
	.WORDA	TEXF
	.WORDA	TEXM
	.WORDA	NOTF
	.WORDA	NOTM
	.WORDA	FOTF
	.WORDA	FOTM
	.WORDA	LCKF
	.WORDA	LCKM
	.WORDA	FILLF
	.WORDA	FILLM
	.WORDA	JUSTF
	.WORDA	JUSTM
	.WORDA	0
	.WORDA	FLAGM
	.WORDA	MARGM
	.WORDA	NLPG
	.WORDA	RMARG
	.WORDA	LMARG
	.WORDA	TMARG
	.WORDA	NSPNG
	.WORDA	0	; List of variables
	.text
ERR0:	.ASCIZ	/RNO -- Unknown error message/
ERR1:	.ASCIZ	/RNO -- Parameter too large/
ERR2:	.ASCIZ	/RNO -- Parameter too small/
ERR3:	.ASCIZ	/RNO -- Symbol already defined/
ERR4:	.ASCIZ	/RNO -- Bad parameter/
ERR5:	.ASCIZ	/RNO -- Unrecognized command/
ERR6:	.ASCIZ	/RNO -- Error in formatting equation/
ERR7:	.ASCIZ	/RNO -- Missing parameter from command/
ERR8:	.ASCIZ	/RNO -- Param too large or negative/
ERR9:	.ASCII	/RNO -- Internal error/<CR><LF>
	.ASCIZ	/ -- Contact your system manager/
ERR10:	.ASCIZ	/RNO -- Output file error/
ERR11:	.ASCIZ	/RNO -- Input file error/
ERR12:	.ASCII	/RNO -- Insufficient dynamic memory/<CR><LF>
	.ASCII	/ -- Reduce either footnote length,/<CR><LF>
	.ASCII	/ -- Number of .DEFINE statements,/<CR><LF>
	.ASCIZ	/ -- or .TEXT section length/
ERR13:	.ASCIZ	/RNO -- Can't indent list element/
ERR14:	.ASCIZ	/RNO -- Can't reduce margins/
ERR15:	.ASCIZ	/RNO -- Command string syntax error/
ERR16:	.ASCIZ	/RNO -- Output file specification error/
ERR17:	.ASCIZ	/RNO -- Output file open error/
ERR18:	.ASCIZ	/RNO -- Input file specification error/
ERR19:	.ASCII	/RNO -- Input file open error/<CR><LF>
	.ASCII	/ -- Input DEVICE:FILE probably doesn't exist, or/<CR><LF>
	.ASCIZ	/ -- You lack privelege to use the file/
ERR20:	.ASCIZ	/RNO -- Too many nested .REQ/
ERR21:	.ASCIZ	/RNO -- Illegal command inside footnote/
ERR22:	.ASCIZ	/RNO -- Illegal command inside note/
ERR23:	.ASCIZ	/RNO -- Illegal command after .LOCK command/
ERR24:	.ASCIZ	/RNO -- Illegal command during .TEXT section/
ERR25:	.ASCIZ	/RNO -- Character is already defined as a flag/
ERR26:	.ASCIZ	/RNO -- Illegal character specified as flag/
ERR27:	.ASCIZ	/RNO -- Extraneous characters after legal command/
ERR28:	.ASCIZ	/RNO -- Missing .FOOTNOTE before .END FOOTNOTE/
ERR29:	.ASCIZ	/RNO -- Missing .NOTE before .END NOTE/
ERR30:	.ASCIZ	/RNO -- Missing .LIST before .END LIST/
ERR31:	.ASCIZ	/RNO -- Missing .LITERAL before .END LITERAL/
ERR32:	.ASCIZ	/RNO -- Undefined message/
ERR33:	.ASCII	/RNO -- Permanent footnote error/<CR><LF>
	.ASCIZ	/ -- Footnote already specified for this page/
ERR34:	.ASCIZ	/RNO -- Char specified is not special flag/
ERR35:	.ASCIZ	/RNO -- Maximum list level exceeded/
ERR36:	.ASCIZ	/RNO -- Maximum subindex levels exceeded/
ERR37:	.ASCIZ	/RNO -- Illegal command on subpage/
ERR38:	.ASCII	\RNO -- Switch/UL:n is bad\<CR><LF>
	.ASCII	/ -- n must be either L(line),B(backspace),/<CR><LF>
	.ASCIZ	/S(simulate) or N(No)/
ERR39:	.ASCIZ	\RNO -- Switch/PS:h:w - bad width\
ERR40:	.ASCIZ	\RNO -- Switch/PS:h:w - bad height\
ERR41:	.ASCIZ	\RNO -- Switch/-FF:n - n too big or negative\
ERR42:	.ASCIZ	/RNO -- User requested traceback/
ERR43:	.ASCIZ	/RNO -- Conflicting command/
ERR44:	.ASCIZ	/RNO (WARNING) -- Substitution is not unique/
ERR45:	.ASCIZ	/RNO -- IF - too many nestings/
ERR46:	.ASCIZ	/RNO -- Improperly nested IF,ENDIF, or ELSE/
ERR47:	.ASCIZ	/RNO -- Permanent footnote too long/
ERR48:	.ASCIZ	/RNO -- Undefined escape sequence/
ERR49:	.ASCIZ	/RNO -- Undefined substitution/
ERR50:	.ASCIZ	/RNO -- Definition too long/
ERR51:	.ASCIZ	/RNO -- Literal or label too long/
ERR52:	.ASCIZ	/RNO -- Unrecognized command/
ERR53:	.ASCIZ	/RNO -- Command illegal inside user defined command/
ERR54:	.ASCIZ	/RNO -- Unrecognized parameter/
ERR55:	.ASCIZ	/RNO -- Missing END LIST/
ERR56:	.ASCIZ	/RNO -- Missing END NOTE/
ERR57:	.ASCIZ	/RNO -- Missing END TEXT/
ERR58:	.ASCIZ	/RNO -- Missing END FOOTNOTE/
ERR59:	.ASCIZ	/RNO -- Missing END LITERAL/
;
;	Traceback messages
;
FOTM:	.ASCIZ	/Footnote,/
TEXM:	.ASCIZ	/Text section,/
FILLM:	.ASCIZ	/Fill,/
JUSTM:	.ASCIZ	/Justify,/
NOTM:	.ASCIZ	/Note,/
LCKM:	.ASCIZ	/Lock,/
MARGM:	.ASCIZ	/-- page size,right,left,top margins,spacing, --/
FLAGM:	.ASCIZ	/-- Flags:/
MODEM:	.ASCIZ	/-- Modes:/
TABM:	.ASCIZ	/<tab>/
	.even
	.code
;
;	This entry point also loads error messages from overlay
;
ERMSG:: CLC
	INDXA	R0			; Now is table pointer
	CMP	R0,#ERREND-ERRTAB	; Check it
	BLO	10$			; Not too big ?
	CLR	R0			; Output null message
10$:	ADD	#ERRTAB,R0
	MOV	(R0),R0			; Get address of error message
	JMP	EROUT			; TRANSFER TO REAL OUTPUT ROUTINE
;
;	TRACE command
;
TRACE::	MOV	#TTBF,R3		; Temporary buffer
	MOV	#ERR42,R0
	CALL	EROUT			; User requested traceback
	MOV	#FLGTAB,R4		; Table of flags
	CALL	198$			; SET UP TABLE
10$:	MOV	(R4)+,R1		; Get flag bits
	BEQ	20$			; Done ?
	MOV	(r4)+,R2		; Message
	BITEQ	R1,F.1,10$		; No feature ?
	CALL	200$			; Output message
	BR	10$			; Continue till done
20$:	CALL	205$			; OUTPUT A LIN
	CALL	198$			; SETUP a line
	MOV	#$AFLSW,R2		; Get flags
	MOV	#NFLAGS+1,R5		; Counter
25$:	TSTNEB	1(R2),30$		; No flag ?
	MOVB	(r2),R1
	BEQ	30$			; No flag ?
	CMPNE	R1,#TAB,26$		; Not tab ?
	MOV	R2,-(SP)		; Save
	MOV	#TABM,R2		; Output tab indicator
	CALL	200$
	MOV	(SP)+,R2		; Restore
	BR	27$
26$:	CALL	PBYT
27$:	MOV	#SPC,R1			; Get space
	CALL	PBYT			; Into buffer
30$:	TST	(R2)+
	SOB	R5,25$			; Continue
	CALL	205$
	MOV	(r4)+,R0		; Print margins
	CALL	EROUT
	CALL	CLRBF			; Start at beginning
50$:	MOV	(R4)+,R0		; Address of param
	BEQ	100$			; Done ?
	MOV	(R0),R0			; Number to convert
	CALL	DECTY			; Convert number
	MOV	#CMA,R1			; Character to insert
	CALL	PBYT
	BR	50$
100$:	CALL	205$			; Output the line
	JMP	ONLIN			; Type traceback message
198$:	CALL	CLRBF
199$:	MOV	(R4)+,R2		; input
200$:	MOVB	(r2)+,R1		; Get char
	BEQ	210$			; Done ?
	CALL	PBYT
	BR	200$
205$:	CLR	R1
	CALL	PBYT			; Zero 1 byte
	MOV	#TTBUF,R0		; Buffer containing message
	CALL	EROUT
210$:	RETURN
	.END
