	.TITLE	ERMSG
	.ENABL	LC
	.IDENT	/BL3.2/
;
;	Routine rewritten by J. CLEMENT April 1982
;
;	Error message routine
;
; LOCAL DATA
;
; ERROR MESSAGES
;
	.psect	$TABL,RO,D,LCL,CON
	.even
ERRTAB:	.WORD	ERR0,ERR1,ERR2,ERR3,ERR4,ERR5,ERR6
	.WORD	ERR7,ERR8,ERR9,ERR10,ERR11,ERR12
	.WORD	ERR13,ERR14,ERR15,ERR16,ERR17,ERR18
	.WORD	ERR19,ERR20,ERR21,ERR22,ERR23,ERR24
	.WORD	ERR25,ERR26,ERR27,ERR28,ERR29,ERR30
	.WORD	ERR31,ERR32,ERR33,ERR34,ERR35,ERR36
	.WORD	ERR37,ERR38,ERR39,ERR40,ERR41,ERR42
	.WORD	ERR43,ERR44,ERR45,ERR46,ERR47,ERR48
	.WORD	ERR49,ERR50,ERR51
ERREND:
FLGTAB:	.WORD	MODEM
	.WORD	TEXF,TEXM,NOTF,NOTM,FOTF,FOTM,LCKF,LCKM,FILLF,FILLM
	.WORD	JUSTF,JUSTM,0
	.word	FLAGM
	.word	MARGM
	.WORD	NLPG,RMARG,LMARG,TMARG,NSPNG,0	; List of variables
	.PSECT	TEXT,RO,D,LCL,CON
	.nlist	bin
ERR0:	.ASCIZ	 /RNO -- Unknown error message/
ERR1:	.ASCII	/RNO -- Bad parameters/<15><12>
	.ASCIZ	 / -- Parameter too large/
ERR2:	.ASCII	/RNO -- Bad parameters/<15><12>
	.ASCIZ	 / -- Parameter too small/
ERR3:	.ASCIZ	 /RNO -- Symbol already defined/
ERR4:	.ASCIZ	 /RNO -- Bad parameters/
ERR5:	.ASCIZ	 /RNO -- Unrecognized command/
ERR6:	.ASCIZ	 /RNO -- Error in formatting equation/
ERR7:	.ASCIZ	 /RNO -- Missing parameter from command/
ERR8:	.ASCII	/RNO -- Bad parameters/<15><12>
	.ASCIZ	 / -- Param too big or negative/
ERR9:	.ASCII	/RNO -- Internal error/<15><12>
	.ASCIZ	 / -- Contact your system manager/
ERR10:	.ASCIZ	 /RNO -- Output file error/
ERR11:	.ASCIZ	 /RNO -- Input file error/
ERR12:	.ASCII	/RNO -- Insufficient dynamic memory/<15><12>
	.ASCII	/ -- Reduce either footnote length,/<15><12>
	.ASCII	/ -- Number of .DEFINE statements,/<15><12>
	.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/<15><12>
	.ASCII	/ -- Input DEVICE:FILE probably doesn't exist, or/<15><12>
	.ASCIZ	 / -- You lack privelege to use the file/
ERR20:	.ASCII	/RNO -- Too many nested .REQ/<15><12>
	.ifdf	RT11
	.ASCIZ	 / -- Maximum nesting is 7 levels/
	.iff
	.ASCIZ	 / -- Maximum nesting is 5 levels/
	.endc
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:	.ASCII	/RNO -- Illegal character specified as flag/<15><12>
	.ASCIZ	 / -- Only special characters may be flags/
ERR27:	.ASCIZ	 /RNO -- Extraneous characters after legal command/
ERR28:	.ASCII	/RNO -- Illegal command/<15><12>
	.ASCIZ	  / -- Missing .FOOTNOTE before .END FOOTNOTE/
ERR29:	.ASCII	/RNO -- Illegal command/<15><12>
	.ASCIZ	 / -- Missing .NOTE before .END NOTE/
ERR30:	.ASCII	/RNO -- Illegal command/<15><12>
	.ASCIZ	 / -- Missing .LIST before .END LIST/
ERR31:	.ASCII	/RNO -- Illegal command/<15><12>
	.ASCIZ	 / -- Missing .LITERAL before .END LITERAL/
ERR32:	.ASCIZ	 /RNO -- Too many tabs specified -- Max is 32/
ERR33:	.ASCII	/RNO -- Permanent footnote error/<15><12>
	.ASCIZ	 / -- Footnote already specified for this page/
ERR34:	.ASCIZ	 /RNO -- Char specified is not special flag/
ERR35:	.ASCII	/RNO -- Maximum list level exceeded/<15><12>
	.ASCIZ	 / -- Max level is 6 indented lists/
ERR36:	.ASCII	/RNO -- Maximum subindex levels exceeded/<15><12>
	.ASCIZ	 / -- No more than 6 subindices are allowed/
ERR37:	.ASCIZ	/RNO -- Illegal command on subpage/
ERR38:	.ASCII	\RNO -- Switch /UL:n is bad\<15><12>
	.ASCII	\ -- n must be either L(line),B(backspace),\<15><12>
	.ASCIZ	\S(simulate) or N(No)\
ERR39:	.ASCII	\RNO -- Switch /PS:h:w has bad w\<15><12>
	.ASCIZ	\ -- paper width must be between 15 and 256\
ERR40:	.ASCII	\RNO -- Switch /PS:h:w has bad v\<15><12>
	.ASCIZ	\ -- paper height must be between 15 and 128\
ERR41:	.ASCII	\RNO -- Switch /-FF:n has n too big or negative.\<15><12>
	.ASCIZ	\ -- The page length may not exceed 127.\
ERR42:	.ASCIZ	\RNO -- User requested traceback\
ERR43:	.ASCIZ	\RNO -- Conflicting command\
ERR44:	.ASCIZ	\RNO (WARNING) -- Substitution is not unique\
ERR45:	.ASCII	\RNO -- IF - too many nestings\<15><12>
	.ASCIZ	\ -- The maximum nesting is 31\
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/
;
;	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
	.list	bin
	.PSECT	$CODE,RO,I,LCL,CON
;
;	This entry point also loads error messages from overlay
;
ERMSG:: CLC
	ASL	R0			; Now is table pointer
	CMP	R0,#ERREND-ERRTAB	; Check it
	BLO	10$			; Not too big ?
	CLR	R0			; Output null message
10$:	MOV	ERRTAB(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	#',,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
