	.NLIST
;
; Copyright (c) 1976
; Digital Equipment Corporation, Maynard, Mass.
;
; This software is furnished under  a license for use only  on  a
; single computer system and may be  copied only with  the inclu-
; sion of  the  above  copyright notice. This software,  or  any
; other copies thereof, may not be  provided  or  otherwise  made
; available to any other person except  for  use  on  such system
; and to  one who agrees  to  these license  terms.  Title to and
; ownership of the software shall at all times remain in DEC.
;
; The information in this software  is  subject to change without
; notice and should not be construed  as  a commitment by Digital
; Equipment Corporation.
;
; DEC assumes no responsibility for the use or reliability of its
; software on equipment which is not supplied by DEC.
;
; Version -1.0.0-
;
; Runoff prefix file
;
;R$$STS = 0			; Define this symbol if running on RSTS/E
R$$11M = 0			; Define this symbol if using RSX-11M
R$$OCK	= 0			; Define this symbol for Rockwell version
A$$RAP	= 0			; Define this symbol for ARAP version
				; This version has different metacharacters:
				; % is the quote-character
				; @ is the superscript character
				; ~ is the subscript character
				; Also, lines are given in terms of half-
				; lines (converted to normal lines for the
				; non-DIABLO printers) rather than in terms
				; of whole lines as in standard RUNOFF.
;R$$11D = 0			; Define this symbol if using RSX-11D
;I$$AS   = 0			; Define this symbol if IAS V3.0 or later
V$$MS	= 0			; Define this symbol for VAX - for RUNOFF
				; startup message only
R$$EIS  = 0			; Define this symbol if EIS is available
;R$$EXT	= 0			; Define this symbol if EXTK$ macro is
				; available.  This should be true for
				; RSX-11M, RSTS, VAX/VMS, and IAS V3.1.
				; For RSX-11D and versions of IAS before
				; 3.1, and for versions of RSX-11M before
				; V3.1, this should be false.
				; Alternatively, if a small amount of code
				; saving is desired on the systems with
				; the EXTK$ macro, this can be left out.
H$$PHN  = 0			; Define this symbol if hyphenation wanted
R$$SCR	= 0			; Define this symbol to get the SCRIPT-like
				; command abbreviations.
R$$SWI	= 0			; Define this symbol to make formatting
				; switches legal on the output and TOC
				; files.  The use of these switches on
				; the alternate files causes the same
				; actions as if they were specified
				; on the input file;  the motivation is
				; that not allowing them saves a little
				; space.
;
; Set the implied parameters
;
	.IF DF	I$$AS		; IAS always has EIS
R$$EIS	=	0		; set it to always have EIS
	.ENDC	; I$$AS
	.IF DF	R$$11D		; RSX-11D always has EIS
R$$EIS	=	0		; Set it to always have EIS
	.ENDC	;R$$11D
;
; Macro definitions
;
	.MCALL	SAVE,UNSAVE	; From RNO.MLB

	.IF NDF	R$$EIS		; If not an EIS machine ...
	.MACRO	SOB	R,A
	DEC	R
	BGT	A
	.ENDM
	.ENDC	;R$$EIS
;
; Bit test equal and branch
;

	.MACRO	BITEQ ARG1,ARG2,BDST
	BIT	ARG1,ARG2
	BEQ	BDST
	.ENDM

;
; Bit test not equal and branch
;

	.MACRO	BITNE ARG1,ARG2,BDST
	BIT	ARG1,ARG2
	BNE	BDST
	.ENDM

;
; Bit test equal byte and branch
;

	.MACRO	BITEQB ARG1,ARG2,BDST
	BITB	ARG1,ARG2
	BEQ	BDST
	.ENDM

;
; Bit test not equal byte and branch
;

	.MACRO	BITNEB ARG1,ARG2,BDST
	BITB	ARG1,ARG2
	BNE	BDST
	.ENDM

;
; Compare equal and branch
;

	.MACRO	CMPEQ ARG1,ARG2,BDST
	CMP	ARG1,ARG2
	BEQ	BDST
	.ENDM

;
; Compare not equal and branch
;

	.MACRO	CMPNE ARG1,ARG2,BDST
	CMP	ARG1,ARG2
	BNE	BDST
	.ENDM

;
; Compare equal byte and branch
;

	.MACRO	CMPEQB ARG1,ARG2,BDST
	CMPB	ARG1,ARG2
	BEQ	BDST
	.ENDM

;
; Compare not equal byte and branch
;

	.MACRO	CMPNEB ARG1,ARG2,BDST
	CMPB	ARG1,ARG2
	BNE	BDST
	.ENDM

;
; Test equal and branch
;

	.MACRO	TSTEQ ARG1,BDST
	TST	ARG1
	BEQ	BDST
	.ENDM

;
; Test not equal and branch
;

	.MACRO	TSTNE ARG1,BDST
	TST	ARG1
	BNE	BDST
	.ENDM

;
; Test equal byte and branch
;

	.MACRO	TSTEQB ARG1,BDST
	TSTB	ARG1
	BEQ	BDST
	.ENDM

;
; Test not equal byte and branch
;

	.MACRO	TSTNEB ARG1,BDST
	TSTB	ARG1
	BNE	BDST
	.ENDM

;
; Call subroutine and return
;

	.MACRO	CALLR	ARG
	JMP	ARG
	.ENDM

;	Declare data P-section
;
	.MACRO	DATA,NAME,TYPE
	.IF	B	TYPE
	.PSECT	NAME,D,RW,GBL,REL,CON
	.IFF
	.PSECT	NAME,D,RW,TYPE,REL,CON
	.ENDC
	.ENDM	DATA
;
;	Declare pure data P-section
;
	.MACRO	PDATA,NAME,TYPE
	.IF	B	TYPE
	.PSECT	NAME,D,RO,GBL,REL,CON
	.IFF
	.PSECT	NAME,D,RO,TYPE,REL,CON
	.ENDC
	.ENDM	PDATA

;	Declare code P-section
;
	.MACRO	CODE,NAME,TYPE
	.IF	B	TYPE
	.PSECT	NAME,I,RW,GBL,REL,CON
	.IFF
	.PSECT	NAME,I,RW,TYPE,REL,CON
	.ENDC
	.ENDM	CODE

;	Header definition

	.MACRO	PROCED,NAME,ID
	.TITLE	NAME
	.IDENT	-ID-
	.NLIST	ME,CND,BEX
	.LIST	TTM
	.ENABL	LC
	.ENDM	PROCED

;	Buffer header definition

	.MACRO	DH	LEN,?X
	.IF	NB	LEN
	.WORD	X
	.WORD	X
	.WORD	X+LEN-2
	.WORD	0
X:	.BLKB	LEN
	.EVEN
	.IFF
	.WORD	0,0,0,0
	.ENDC
	.ENDM	DH

	CBBIT=1
	CBFBT=0

;	diagnostic error message

	.MACRO	DIAG	MSG,OPT
	.IF	NB	OPT
	.IF	IDN	<FCS>,OPT
	TRAP+FCSERR+MSG
	.IFF
	TRAP+0+MSG
	.ENDC
	.IFF
	TRAP+0+MSG
	.ENDC
	.ENDM	DIAG

;	fatal error message

	.MACRO	FATAL	MSG
	TRAP	100+MSG
	.ENDM	FATAL

	FTLERR	=	100
	FCSERR	=	200

;	error message numbers

	HALTM	=	0	; Fatal error in RUNOFF
	BFOVF	=	1	; Internal buffer overflow (footnote, for ex)
	ILCMM	=	2	; Illegal command
	WILCRD	=	3	; * filespec not allowed
	JUSRM1	=	4	; Can't justify line
	BADMET	=	5	; Metacharacter not found (.change)
	DUPMET	=	6	; Duplicate metacharacter (.change)
	ILLMET	=	7	; Illegal renaming of metacharacter (.change)
	OUTERR	=	10	; I/O error on output file
	INPERR	=	11	; I/O error on input file
	CORERR	=	12	; Insufficient dynamic memory
	LSTERR	=	13	; Can't indent list item
	NOTERR	=	14	; Can't reduce margins
	MGCDME	=	15	; Command syntax error
	MGOFER	=	16	; Output file specification error
	MGOPER	=	17	; Output file open error
	MGIFER	=	20	; Input file specification error
	MGIPER	=	21	; Input file open error
	MGWIGL	=	22	; Waiting for <return> (/WA switch)
	IDTRNC	=	23	; Index item truncated to 52 characters
	IASSP1	=	24	; Output device intercept spooled (IAS)
	IASSP2	=	25	; TI: device not a TT: device, /WA ignored
	IASSP3	=	26	; Output device has directory, /WA ignored
	MGBELL	=	27	; Ring the bell
	TPAGES	=	30	; Display total pages printed
	VERSN	=	31	; Display version #
	EXIT	=	32	; Exit runoff
	SEVERR	=	33	; Severe error
	TOCER	=	34	; Table of contents error
	BADFRE	=	35	; Internal error - free space already free
	INVFRM	=	36	; Invalid forms type specified
	INVCOP	=	37	; Invalid # of copies specified
	INDERR	=	40	; Include file error
	FTNOVF	=	41	; Footnote overflow
	NOTOC	=	42	; No TOC file active, SWAP ignored
	USRMSG	=	43	; User defined message
				; Generate RNO - user_defined_message
				; See .PRINT command
	UNDSYM	=	44	; Undefined symbol
	INVSYM	=	45	; Invalid use of symbol
	INVPIT	=	46	; Invalid pitch, must be 10 or 12
	IFOERR	=	47	; Include file open errror

;	Foootnote list offsets

	FN.FWD = 0		; Foward pointer
	FN.BCK = 2		; Back pointer
	FN.P1  = 4		; Start of buffer	(BF.ADR)
	FN.P2  = 6		; Current open pointer	(BF.PTR)
	FN.P3  = 10		; End of buffer pointer	(BF.END)
	FN.P4  = 12		; Length of footnote	(BF.LEN)
	FN.SIZ = 14		; Length of link header

;	Buffer header offsets

	BF.ADR	=	0	; Starting address
	BF.PTR	=	2	; Current position within buffer
	BF.END	=	4	; End of buffer pointer
	BF.LEN	=	6	; Length word

;	File input flags

	FIN.CR	=	1	; Carriage return has been done
	FIN.LF	=	2	; Line feed has been done

	.LIST
