


OVTYPE=OLA
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM


OVPRNT=.-OVRLCA		/ ENTRY POINT TO HANDLE PRINTER
OBPRNT=OVTYPE+OVNUM	/ CONTROL BLOCKS

/ UP TO THIS POINT, A START CONTROL FOLLOWED BY A P HAS BEEN SEEN
/ WE FIRST PARSE FOR THE REST OF THE WORD PRINTER

	JMS	GTWORD		/ GET THE NEXT WORD INTO THE TOKEN BUFFER
	JMP	PRSTRP		/ DOESN'T FIT, GO STRIP REST OF CONTROL
	JMS	PARSE		/ TOKEN FITS IN BUFFER, CHECK IT OUT
		RINTER		/ POINTER TO LIST OF LEGAL ARGUMENTS
		JMP PRSPRI	/ MATCH FOUND TO STRING "PRINTER"
		JMP PRSTRP	/ NO MATCH, STRIP REST OF CONTROL

/ WE HAVE FOUND THE CONTROL "PRINTER" FOLLOWED BY A SEPARATOR
/ WHICH WE HAVE DISCARDED

PRSPRI,		/ PARSE WHATEVER COMES AFTER "PRINTER"
	JMS	GTWORD		/ GET NEXT WORD
	JMP	PCSTEL		/ DOESN'T FIT, GO STRIP TO LF
	JMS	PARSE		/ TOKEN FITS IN BUFFER, CHECK IT OUT
		STSEXX
		JMP PCSEND	/ SEND
		JMP PCHRST	/ CHRSET
		JMP PCFONT	/ FONT
		JMP PCSELE	/ SELECT
		JMP PCPTCH	/ CHANGE DRAFT PRINTER PITCH
		JMP PCGRAP	/ GO ENABLE SIXEL GRAPHICS
		JMP PCGRET	/ DO DISABLE SIXEL GRAPHICS
		/JMP PCSTEL	/ STRING NOT IN LIST

PCSTEL,		/ STRIP TO END OF LINE (HARD RETURN)
		/ IF AN END OF FILE IS FOUND BEFORE END OF CONTROL	/A191
		/ REPORT MISSING CONTROL				/A191
	JMS	PTSTST		/ SEE IF USER WANTS TO STOP		/A182
	JMS	PRGCHC		/ GET A CHR
	JMP	PCSTR1		/ END OF CONTROL			/C192
	TAD	(-LF)		/ SEE IF END OF LINE (HARD RETURN)
	SZA CLA
	JMP	PCSTEL		/ NO, KEEP STRIPPING
	JMP	PRSPRI		/ YES, PARSE WHAT COMES AFTER "PRINTER"


GTWORD,	XX			/ GET WORD INTO TOKEN BUFFER
	/ SEARCH FOR NEXT SEPARATOR
	/ LOAD PCTBUF WITH TOKEN
	/ RETURN TO PCSTR1 IF END OF CONTROL IS FOUND
	/ RETURN TO NEXT LOC IF TOKEN TOO LARGE FOR BUFFER
	/ RETURN TO NEXT LOC +1 IF ALL OK
	/ (MUST ALSO WORK IF NEXT TOKEN IS ON NEXT LINE)

	TAD	(PCTBUF-1	/ SET UP INDEX REGISTER
	DCA	X1
	TAD	(-PCTBSZ	/ AND A COUNTER
	DCA	T2

GTWOR0,	JMS	PCSTLS		/ GET A CHR
	JMS	PCKSEP		/ SKIP IF A SEPARATOR
	JMP	GTWOR1		/ NOT A SPEARATOR
	JMP	GTWOR0		/ IGNORE LEADING SEPARATOR
GTWOR1,	TAD	T1		/ GET CHR BACK
	DCA I	X1		/ SAVE IT
	JMS	PCSTLS		/ GET ANOTHER CHR
	JMS	PCKSEP		/ SKIP IF A SEPARATOR
	JMP	GTWOR2		/ NO, A REAL CHR
	JMP	GTWOR3		/ FINAL SEPARATOR FOUND
GTWOR2,	ISZ	T2		/ COUNT THE CHR
	JMP	GTWOR1		/ NO OVERFLOW
	JMP I	GTWORD		/ TOO MANY CHR FOR BUFFER SIZE

GTWOR3,	ISZ	GTWORD		/ OK RETURN
	JMP I	GTWORD

	PCTBSZ=13
PCTBUF,	ZBLOCK	PCTBSZ		/ TOKEN BUFFER


PCKSEP,	XX			/ SKIP IF SEPARATOR
				/ CHR IS ALREADY IN AC
	TAD	(-LF)		/ SEE IF END OF LINE
	SNA
	ISZ	PCKSEP		/ YES, TAKE SKIP RETURN
	TAD	(LF-SPC)	/ SEE IF SPACE
	SNA CLA
	ISZ	PCKSEP		/ YES, TAKE SKIP RETURN
	JMP I	PCKSEP		/ ELSE TAKE NORMAL RETURN

/**********************************************************************/
/									/
/	PARSE--SUBROUTINE TO PARSE A LIST OF TEXT STRINGS		/
/		ASCII TEXT IS PLACE UNPACKED IN PCTBUF			/
/		ONLY THE LOWER 5 BITS ARE CHECKED			/
/		IF THE STRING IN PCTBUF IS LONGER THAN THE MATCH STRING	/
/		A MATCH WILL OCCUR, FOR EXAMPLE, IF A USER ENTERS	/
/		"PROPORTIONAL" IN HIS CONTROL BLOCK AND WE HAVE		/
/		A STRING TEXT "PROP" IN OUR STRING LIST, IT WILL MATCH	/
/									/
/	EACH FAILED MATCH BUMPS THE RETURN ADDRESS ONE POSITION		/
/									/
/***********************************************************************/

PARSE,	XX
	AC7777			/ MAKE IT NICE FOR THE PROGRAMMER!
	TAD I	PARSE		/ GET STRING POINTER
	DCA	X0		/ SAVE POINTER IN INDEX REGISTER
	ISZ	PARSE		/ BUMP TO NEXT LOCATION


PARSE0,	TAD	(PCTBUF-1	/ INIT INDEX REGISTER
	DCA	X1
PARSEL,	TAD I	X0		/ GET A CHR TO MATCH
	DCA	T3		/ SAVE
	TAD	T3		/ RESTORE
	BSW			/ SWAP BYTES
	JMS	PARSCK		/ SEE IF MATCH HIGH BYTE
	JMP	PARSE1		/ NO MATCH
	TAD	T3		/ GET WORD FROM LIST
	JMS	PARSCK		/ CHECK FOR MATCH LOW BYTE
	JMP	PARSE1		/ NO MATCH
	JMP	PARSEL		/ YES, LOOP

PARSE1,		/ NO MATCH
		/ ADVANCE LIST POINTER TO BEGINNING OF NEXT ITEM

	ISZ	PARSE		/ AND RECORD NO MATCH
	TAD	T3		/ SEE IF WAS LAST CHR
PARSE2,	AND	(37)		/ SEE IF WAS LAST WORD
	SNA CLA
	JMP	PARSE0		/ FOUND BEGINNING OF NEXT STRING IN MATCH LIST
	TAD I	X0		/ NOT BEGINNING, MOVE POINTER AHEAD
	JMP	PARSE2		/ IN SEARCH OF BEGINNING


PARSCK,	XX			/ SUBROUTINE TO CHECK FOR MATCH
				/ EXITS PARSE SUBROUTINE IF LOWER BYTE IS ZERO
				/ SKIPS IF LOWER BYTE MATCHES
				/ NO SKIP IF NO MATCH AND BYTE NON ZERO

	AND	(37		/ STRIP TO 5 BITS
	SNA
	JMP I	PARSE		/ RETURN, MATCH
	CIA			/ NEGATE
	TAD I	X1		/ GET A CHR FROM TOKEN STRING
	AND	(37		/ MASK OFF THE ASSEMBLER 200 BIT
				/ AND THE LOWER CASE BIT
	SNA CLA
	ISZ	PARSCK		/ BUMP RETURN IF MATCH
	JMP I	PARSCK		/ AND EXIT



PCSELE,	JMS	GTWORD		/ GET THE NEXT WORD
	JMP	PCSTEL		/ DOESN'T FIT, STRIP TO EOL
	JMS	PARSE		/ PARSE THE TRAY
		STGSE		/ POINTER TO STRINGS
		IAC		/ LETTERHEAD (NEXT)			/A172
		IAC		/ ENVELOPE
		IAC		/ REAR
		TAD (4)		/ FRONT
	DCA	PRQSSS		/ SET UP CURRENT SE SETTING
	JMP	PCSTEL		/ ALL DONE OR NOT IN LIST, STRIP TO EOL
/----------------------
	PAGE

/***********************************************************************/
/									/
/	PCSTLS--STRIP LEADING SPACES					/
/		RETURN WITH STRIPPED CHR IN T1 AND AC IF NOT 2040	/
/		IF 2040 (LEADING SPACE), GET ANOTHER CHR		/
/		IF END OF CONTROL JMP PCSTR1				/
/									/
/***********************************************************************/

PCSTLS,	XX
PCSTL1,
	JMS	PTSTST		/ SEE IF USER WANTS TO STOP		/A182
	JMS	PRGCHC		/ GET A CHR				/C192
	JMP	PCSTR1		/ END OF CONTROL			/C192
	TAD	(-2040)		/ SEE IF A LEADING SPACE
	SNA CLA
	JMP	PCSTL1		/ YES, STRIP IT
	TAD	T1		/ NO, RESTORE AC
	AND	P177		/ MASK TO 7 BITS			/A254
	DCA	T1		/ UPDATE RESULT				/A254
	TAD	T1		/ RESTORE AC				/A254
	JMP I	PCSTLS		/ AND RETURN



PCNOUT,	XX			/ OUTPUT NUMERIC CHR, IF ANY
	TAD	PCNMBR		/ GET NUMBER
	SMA
	JMS	PRCHAR		/ OUTPUT IT IF POSITIVE
	CLA
	JMP I	PCNOUT		/ RETURN


PCTMP,	0
PCNMBR,	0

RINTER,	IFDEF ENGLSH <
	TEXT "RINTER"
	>
	IFDEF ITALIAN <
	TEXT "TAMPANTE"
	>
	IFDEF V30NOR <
	TEXT "KRIVER"
	>
	IFDEF V30SWE <
	TEXT "KRIVARE"
	>
	IFDEF DUTCH <
	TEXT "RINTER"
	>
	IFDEF SPANISH <
	TEXT "RINTER"
	>


	0

STSEXX,	IFDEF ENGLSH <
	TEXT "XMT"
	TEXT "CHRSET"
	TEXT "FONT"
	TEXT "SELECT"
	TEXT "PITCH"
	TEXT "GRA"
	TEXT "RET"
	>
	IFDEF ITALIAN <
	TEXT "XMT"
	TEXT "TIPO"
	TEXT "STILE"
	TEXT "SELEZ"
	TEXT "PASSO"
	TEXT "GRA"
	TEXT "RIT"
	>

	IFDEF V30NOR <
	TEXT "XMT"
	TEXT "TGNSETT"
	TEXT "TYPE"
	TEXT "VELG"
	TEXT "BRSTEG"
	TEXT "GRA"
	TEXT "RET" 
	>
	IFDEF V30SWE <
	TEXT "XMT"
	TEXT "TKNUPP"
	TEXT "STIL"
	TEXT "VALJ"
	TEXT "TKNTATHET"
	TEXT "GRA"
	TEXT "RET"
	>

	IFDEF DUTCH <
	TEXT "XMT"
	TEXT "TEKENSET"
	TEXT "FONT"
	TEXT "SELECTEER"
	TEXT "PITCH"
	TEXT "GRA"
	TEXT "RET"
	>

	IFDEF SPANISH <
	TEXT "XMT"
	TEXT "CHRSET"
	TEXT "FONT"
	TEXT "SELECT"
	TEXT "PITCH"
	TEXT "GRA"
	TEXT "RET"
	>

	0


STGSE,	IFDEF ENGLSH <
	TEXT "LET"						/A172
	TEXT "ENV"
	TEXT "REAR"
	TEXT "FRONT"
	>
	IFDEF ITALIAN <
	TEXT "ALT"
	TEXT "BUS"
	TEXT "DIET"
	TEXT "DAVAN"
	>
	IFDEF V30NOR <
	TEXT "BRV"
	TEXT "KONV"
	TEXT "KURV1"
	TEXT "KURV2"
	>

	IFDEF V30SWE <
	TEXT "BREV"
	TEXT "KUVERT"
	TEXT "BAK"
	TEXT "FRAM"
	>
	IFDEF DUTCH <
	TEXT "BRI"						/A172
	TEXT "ENV"
	TEXT "ACHTER"
	TEXT "VOOR"
	>
	IFDEF ENGLSH <
	TEXT "LET"						/A172
	TEXT "ENV"
	TEXT "REAR"
	TEXT "FRONT"
	>


	0

PCSEND,	TAD	(OVNUMM)	/ ENTER SEND NUMERIC MODE
	JMS	PROV
		OBNUMM


PCGRAP,	TAD	(OVGRAP-OVGRET	/ ENTER SIXEL GRAPHICS
PCGRET,	TAD	(OVGRET)	/ OR EXIT SIXEL GRAPHICS
	JMS	PROV		/ AS APPROPRIATE
		OBGRAP		/ (MUST BOTH BE IN SAME OVERLAY)


PCHRST,			/ CHRSET PARSED--GO TO ANOTHER OVERLAY
	TAD	(OVCHST
	JMS	PROV
		OBCHST

PCFONT,			/ FONT PARSED--GO TO ANOTHER OVERLAY
	TAD	(OVFONT
	JMS	PROV
		OBFONT

/WE ARE AT THE END OF THE PRINT CONTROL.  WE MUST RESET THE READ LINK AS
/IT WAS CHANGED WHEN THE END OF THE CONTROL WAS FOUND.

PCSTR1,	TAD	(OVEXPC		/GO FINISH PRINT CONTROL BLOCK		/A173
	JMS	PROV		/					/A173
		OBEXPC		/					/A173

PCPTCH,	TAD	LPONLN		/ SEE IF DRAFT PRINTER			/A197
	AND	(DPMSK)		/					/A197
	SNA CLA			/ IF SO, SKIP				/A197
	JMP	PCSTEL		/ NOT A DRAFT PRINTER, STRIP		/A197

				/ OUTPUT PITCH ONLY TO DRAFT PRINTER	/A197
	JMS	GTWORD		/ GET TOKEN AFTER "PITCH"

	JMP	PCSTEL		/ NO TOKEN
	JMS	PARSE		/ SEE WHAT IT IS
		STGPI		/ LOOK IN THE PITCH LIST
		IAC		/ 8
		IAC		/ 7
		IAC		/ 6
		IAC		/ 5
		IAC		/ 16
		IAC		/ 13
		IAC		/ 12
		IAC		/ 10
	JMS	PRESCS		/ PUT OUT PITCH
		PCDPIT
		CLA

	JMS	PROV							/A252
		OBCHST		/CALLL THE "B" OVERLAY			/A252
	JMP	PCPTC1		/GO RUN IT				/A252

STGPI,	TEXT "8"
	TEXT "7"
	TEXT "6"
	TEXT "5"
	TEXT "16"
	TEXT "13"
	TEXT "12"
	TEXT "10"
	0
/--------------------
	PAGE

OVTYPE=OLB			/ CHANGED FROM C TO B OVERLAY		/C193
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM
/ AT THIS POINT WE ARE DOING A PRINTER CHRSET CONTROL
/ WE NOW DETERMINE WHICH OF THE THREE KEYWORDS COME NEXT:
/ [NORMAL, BOLD, OR NONBOLD].  IF BOLD WE USE THE FINAL
/ TO SELECT G2; IF NONBOLD WE USE THE FINAL TO SELECT G1;
/ IF NORMAL WE USE THE FINAL TO SELECT BOTH G1 AND G2.

OVCHST=.-OVRLCA
OBCHST=OVTYPE+OVNUM

	JMS	PCBI		/ GO PARSE BOLD AND FINAL
	JMS	PCHFSZ		/ RETURN IF FINAL STRING NOT TOO LONG	/M208
	TAD	PCBIT1		/ RESTORE RESULT CODE
	SNA			/ SEE IF TOKEN AFTER CHRSET VALID
				/   {NORMAL BOLD NONBOLD}
	JMP	PCSTEL		/ NO, STRIP TO EOL

	TAD	(-3)		/ SEE IF NORMAL
	SZA			/ SKIP IF NORMAL			/C208
	JMP	PCHNN		/ JMP IF NOT NORMAL			/A208
	JMS	PCHRNB		/ SELECT G1
	JMS	PCHRBO		/ DO BOTH SUBROUTINES IF NORMAL
				/ SUBROUTINE RETURNS CLEAR AC SO	/A208
				/ FALL THROUGH IS OK			/A208
PCHNN,									/A208
	IAC			/ SEE IF NONBOLD
	SNA
	JMS	PCHRNB		/ YES, SELECT G1
	IAC			/ SEE IF BOLD
	SNA CLA
	JMS	PCHRBO		/ SELECT G2

	/ IN ORDER TO ESTABLISH PRBIF WE COMPARE THE TWO STORED STRINGS
	/ IF THEY ARE EQUAL THERE IS NO BOLD INTERPRETATION

	TAD	(PCHFNB-1	/ SET UP FOR STRING COMPARE
	DCA	X0
	TAD	(PCHFBO-1
	DCA	X1
PCHSCP,	TAD I	X0
	SPA			/ SEE IF LAST COMPARE
	JMP	PCHSC1		/ YES
	CIA
	TAD I	X1
	SNA CLA
	JMP	PCHSCP		/ CHR MATCH, LOOP
				/ NOT EQUAL
PCHNEQ,	AC0001			/ IF NOT EQUAL
PCHEQU,	DCA	PRBIF		/ ELSE ZERO
	JMP	PCSTEL		/ GO STRIP

PCHSC1,			/ LAST COMPARE (SIGN BIT ON)
	CIA
	TAD I	X1
	SZA CLA
	JMP	PCHNEQ		/ NO COMPARE
	JMP	PCHEQU		/ COMPARE


PCBIT1,	XX			/ LOCATION TO STORE RESULT		/A208

PCHRBO,	XX			/ SET BOLD				/C179
	TAD	(PCHFBO-1	/ IN THIS BUFFER
	JMS	PCHFSV		/ SAVE THE FINAL STRING

	TAD	(PCHFBO		/ GET ADDRESS OF SUBSTRING FOR PRESCS	/A179
	JMS	PRESCS		/ SEND ESCAPE SEQUENCE
		PCSTG1		/ TO SELECT THE G1 SET
		CLA
	JMP I	PCHRBO


PCHRNB,	XX			/ SET NONBOLD				/C179
	TAD	(PCHFNB-1	/ IN THIS BUFFER
	JMS	PCHFSV		/ SAVE THE FINAL STRING
	TAD	(PCHFNB		/ GET THE ADDRESS OF THE FINAL SUBSTRING/C179
	JMS	PRESCS		/ SEND ESCAPE SEQUENCE
		PCSTG0		/ TO SELECT THE G0 SET
		CLA
	JMP I	PCHRNB


PCHFSZ,	XX			/ RETURN IF FINAL STRING NOT TOO LONG
				/ ELSE GOTO PCSTEL
	TAD	T2		/ GET COUNTER USED IN GTWORD
	TAD	(-CHRSSZ+PCTBSZ	/ SEE IF HAS ADVANCED BEYOND CHRSSZ LIMIT
	SMA CLA			/
	JMP	PCSTEL		/ YES, STRIP
	TAD	X1		/ ALL OK, ATTACH TERMINATOR
	DCA	T2		/ GET ADDRESS OF LAST CHR IN PCTBUF
	TAD I	T2		/ GET THE CHR
	TAD	(4000		/ TURN ON THE SIGN BIT SO IT WILL
	DCA I	T2		/ BE THE TERMINATOR
	JMP I	PCHFSZ		/ RETURN

PCHFSV,	XX			/ SAVE CHRSET FINAL STRING
	DCA	X1		/ DESTINATION INDEX
	TAD	(PCTBUF-1
	DCA	X0		/ SOURCE INDEX
	TAD	(-CHRSSZ
	DCA	T1		/ COUNT
PCHFS1,	TAD I	X0		/ MOVE STRING IN PCTBUF
	DCA I	X1		/ TO SPECIFIED BUFFER
	ISZ	T1		/ DONE?
	JMP	PCHFS1		/ NO, LOOP BACK
	JMP I	PCHFSV		/ YES, EXIT


PCBI,	XX			/ PARSE BOLD INTERPRETATION KEYWORD
	JMS	GTWORD		/ GET THE NEXT TOKEN INTO THE BUFFER
	JMP	PCSTEL		/ THERE ISN'T ONE
	JMS	PARSE		/ SEE WHICH ONE IT IS
		STGBI		/ MATCH STRING LIST
		IAC		/ NORMAL
		IAC		/ NONBOLD
		IAC		/ BOLD
		DCA PCBIT1	/ NOT IN LIST; SAVE RESULT
	JMS	GTWORD		/ GET THE FINAL TOKEN (S.B. 1 CHR)
	JMP	PCSTEL		/ THERE IS NONE
	JMP I	PCBI


STGBI,	IFDEF ENGLSH <
	TEXT "NORMAL"
	TEXT "NONBOL"
	TEXT "BOLD"
	>
	IFDEF ITALIAN <
	TEXT "NORMAL"
	TEXT "NON_NE"
	TEXT "NERE"
	>
	IFDEF V30NOR <
	TEXT "NORMAL"
	TEXT "IKKEFET"
	TEXT "FET"
	>

	IFDEF V30SWE <
	TEXT "NORMAL"
	TEXT "EJ_FET"
	TEXT "FET"
	>

	IFDEF DUTCH <
	TEXT "NORMAAL"
	TEXT "NIETVET"
	TEXT "VET"
	>
	IFDEF SPANISH <
	TEXT "NORMAL"
	TEXT "NONBOL"
	TEXT "BOLD"
	>


	0

PCPTC1,	TAD	LPONLN		/0 FOR HOST				/A252
	SNA								/A252
	JMP	PCSTEL		/HOST, SO EXIT				/A252
	TAD	(-LA50)		/IS IT LA50?				/A252
	SNA CLA								/A252
	JMP	PCSTEL		/LA50					/A252
	TAD	PRMCLM		/GET LEFT MARGIN EVEN IF MULTI-COLUMN	/A252
	JMS	PRESCS							/A252
		PCIND		/INDENT MARGIN ON LA100			/A252
	CLA								/A252
	TAD	(CR)		/RESET CARRIAGE TO NEW MARGIN		/A252
	JMS	PRCHAR							/A252
	JMP	PCSTEL		/EXIT					/A252
/-----------------
	PAGE

/ AT THIS POINT WE ARE DOING A PRINTER FONT CONTROL
/ WE NOW DETERMINE WHICH OF THE THREE KEYWORDS COME NEXT:
/ [NORMAL, BOLD, OR NONBOLD].  IF NONBOLD WE SELECT
/ THE SPECIFIED FONT IMMEDIATELY.
/ IF BOLD OR NONBOLD WE SAVE THE APPROPRIATE FINAL

OVFONT=.-OVRLCA
OBFONT=OVTYPE+OVNUM

	JMS	PCBI		/ GO PARSE BOLD AND FINAL
	TAD	PCBIT1		/ RESTORE RESULT CODE
	SNA			/ SEE IF TOKEN AFTER FONT VALID
	JMP	PCSTEL		/ NO, STRIP TO EOL

	TAD	(-3)		/ SEE IF NORMAL
	SNA
	JMP	PCFONN		/ NORMAL FONT
	IAC			/ SEE IF NONBOLD
	SNA
	JMS	PFONNB		/ YES, SAVE FINAL
	IAC			/ SEE IF BOLD
	SNA CLA
	JMS	PFONBO		/ SAVE FINAL
	AC0002			/ SET PRBIF
	DCA	PRBIF
	JMP	PCSTEL

PCFONN,		/ PRINTER FONT NORMAL FINAL
	DCA	PRBIF		/ STOP BOLD INTERPRETATION
	TAD	PCTBUF		/ SAVE FINAL
	DCA	PRBIFN		/ FOR BOTH NONBOLD
	TAD	PCTBUF		/ AND
	DCA	PRBIFB		/ BOLD
	TAD	PRBIFN		/ AND SEND ESCAPE SEQUENCE
	JMS	PRESCS		/ TO ENABLE THIS FONT
		PCSTFN
		CLA
	JMP	PCSTEL		/ GO STRIP

PFONNB,	XX
	TAD	PCTBUF
	DCA	PRBIFN
	JMP I	PFONNB

PFONBO,	XX
	TAD	PCTBUF
	DCA	PRBIFB
	JMP I	PFONBO

/PRCLUP "CLEANS UP" ANY EXTRA JUSTIFICATION NEEDED TO BE DONE. THIS COULD
/OCCUR IF WE HAVE JUST PROCESSED A HEADER OR FOOTER AND HAVE ADDED MORE
/OR LESS THAN 2 CHARACTERS FOR BACKSLASH PROCESSING, AS IN THE INSERTION
/OF THE DATE FOR \D. IF THIS IS NECESSARY, THE APPROPRIATE NUMBER OF SOFT
/SPACES ARE DELETED OR ADDED UNTIL THE LINE IS AGAIN PROPERLY JUSTIFIED.

	OBCLUP=OVTYPE+OVNUM

/AC=0	FROM PRGTLN
/PRCLUP
/AC=0

PRCLUP,	XX								/A230

	TAD I	PLPTR		/ CHECK TYPE OF RETURN			/A230
	TAD	(-1412		/ IS IT A CENTERED RETURN?		/A230
	SZA CLA								/A230
	JMP	PRCLU1		/ NO -- SKIP AHEAD			/A230

/ WE HAVE A CENTERED RETURN -- WE MUST HALVE THE COUNT IN EXPCNT	/A230

	TAD	EXPCNT		/ GET COUNT				/A230
	CLL			/ IN CASE OF EXTRA JUNK			/A230
	SPA			/ OKAY IF POSITIVE			/A230
	STL			/ OTHERWISE KEEP IT NEGATIVE		/A230
	RAR			/ DIVIDE BY 2				/A230
	SNA			/ IF ADJUSTMENT IS NIL			/A249
	JMP I	PRCLUP		/ FORGET IT! (BUGFIX 298)		/A249
	DCA	EXPCNT		/ REPLACE IT				/A230
	CLL			/ JUST IN CASE IT WAS AN ODD NUMBER	/A230
/
PRCLU1,	TAD	EXPCNT		/ GET ACTUAL EXPANSION COUNT		/A230
	SPA CLA			/ SKIP IF IT'S BIG			/A230
	JMP	PR2SML		/ OTHERWISE IT'S TOO SMALL		/A230


/ IF MORE THAN TWO CHARACTERS WERE ADDED FOR EACH BACKSLASH, THE LINE	/A230
/ IS LONGER THAN IT SHOULD BE AND WE MUST BACK UP IN THE BUFFER AND	/A230
/ REMOVE SOFT SPACES UNTIL THE LINE IS ONCE AGAIN THE RIGHT LENGTH.	/A230

PR2BIG,	TAD	EXPCNT		/ GET EXPANSION COUNT			/A230
	CIA			/ MAKE IT NEGATIVE FOR ISZ		/A230
	DCA	EXPCNT		/ PUT IT BACK				/A230
/
PR2BGA,	TAD	SOFTPT		/ GET THE POS OF THE LAST SOFT SPACE	/A230
	DCA	CLUPT1		/ SAVE IT				/A230
	IAC			/ ONE POSITION MORE THAN...		/A230
	TAD	SOFTPT		/ ...THE LAST SOFT SPACE		/A230
	DCA	CLUPT2		/ SAVE IT FOR NOW			/A230
	TAD	PLPTR		/ GET END POINTER			/A230
	CIA			/ MAKE IT NEGATIVE			/A230
	TAD	CLUPT2		/ -DIFFERENCE FROM HERE TO END		/A230
	DCA	CLUPT4		/ SAVE IT FOR LOOP			/A230
PR2BG1,	TAD I	CLUPT2		/ GET NEXT CHARACTER			/A230
	DCA I	CLUPT1		/ AND OVERWRITE THE ONE BEFORE IT	/A230
	ISZ	CLUPT1		/ INCREMENT COUNTER 1			/A230
	ISZ	CLUPT2		/ INCREMENT COUNTER 2			/A230
	ISZ	CLUPT4		/ INCREMENT LOOP COUNTER		/A230
	JMP	PR2BG1		/ CONTINUE IF MORE TO DO		/A230
/
	AC7777			/ GET READY TO DECREMENT POINTER	/C249
	TAD	PLPTR		/ DO IT					/A230
	DCA	PLPTR		/ MAKE IT OFFICIAL			/A230
	ISZ	EXPCNT		/ SEE IF MORE SPACES TO DELETE		/A230
	JMP	PR2BG2		/ YES -- FIND NEXT SOFT SPACE		/A230
	JMP I	PRCLUP		/ NO -- GO HOME				/A230
/
PR2BG2,	AC7777			/ GET READY TO DECREMENT POINTER	/C249
	TAD	SOFTPT		/ DECREMENT POINTER			/A230
	DCA	SOFTPT		/ SAVE NEW VALUE			/A230
	TAD	SOFTPT		/ GET IT BACK
	CIA			/ MAKE NEGATIVE FOR COMPARE		/A230
	TAD	(PRLBUF		/ CHECK AGAINST BEGINNING OF BUFFER	/A230
	SNA CLA			/ HAVE WE GONE BACK TOO FAR?		/A230
	JMP I	PRCLUP		/ YES -- GET OUT OF HERE		/A230
	TAD I	SOFTPT		/ NO -- CHECK ON WHAT'S THERE		/A230
	TAD	(-2040		/ IS IT A SOFT SPACE?			/A230
	SNA CLA								/A230
	JMP	PR2BGA		/ IT IS! GO HANDLE IT...		/A230
	JMP	PR2BG2		/ IT ISN'T -- TRY AGAIN			/A230

/ IF LESS THAN TWO CHARACTERS WERE ADDED FOR EACH BACKSLASH, THE LINE	/A230
/ IS SHORTER THAN IT SHOULD BE AND WE MUST INSERT MORE SOFT SPACES TO	/A230
/ RESTORE THE LINE TO ITS PROPER LENGTH IN THE BUFFER			/A230

PR2SML,	ISZ	SOFTPT		/ TO GET NEXT CHAR FROM BUFFER		/A230
	TAD	SOFTPT		/ ONE PLACE BEYOND LAST SOFT SPACE	/A230
	DCA	CLUPT1		/ SAVE IT
	TAD I	CLUPT1		/ GET CHARACTER				/A230
	DCA	CLUPT2		/ SAVE IT FOR NOW			/A230
	TAD	(2040		/ GET A SOFT SPACE			/A230
	DCA I	CLUPT1		/ REPLACE CHARACTER WITH IT		/A230
/
	TAD	PLPTR		/ GET BUFFER POINTER POS (EOB)		/A230
	CMA			/					/C249
	TAD	CLUPT1		/ -DIFFERENCE FROM HERE TO THERE	/A230
	DCA	CLUPT4		/ SAVE IT				/A230
/
PR2SM1,	ISZ	CLUPT1		/ INCREMENT TEMP BUFFER POINTER		/A230
	TAD I	CLUPT1		/ GET NEXT CHARACTER			/A230
	DCA	CLUPT3		/ SAVE IT				/A230
	TAD	CLUPT2		/ GET PREVIOUS CHARACTER		/A230
	DCA I	CLUPT1		/ PUT IT IN THE BUFFER			/A230
	TAD	CLUPT3		/ GET SAVED CHARACTER			/A230
	DCA	CLUPT2		/ SAVE IT FOR NEXT LOOP			/A230
/	
	ISZ	CLUPT4		/ INCREMENT COUNTER			/A230
	JMP	PR2SM1		/ LOOP IF NOT ZERO YET			/A230

	ISZ	PLPTR		/ THE END POINT MOVES TOO!		/A264
	ISZ	EXPCNT		/ INCREMENT COUNT OF EXTRA SPACES	/A230
	JMP	PR2SML		/ LOOP IF MORE TO DO			/A230
	TAD	CLUPT1		/ GET NEW LAST POSITION			/A230
	DCA	PLPTR		/ MAKE IT OFFICIAL			/A230

	JMP I	PRCLUP		/ RETURN TO CALLER			/A230
/
CLUPT1,	0			/ TEMP 1 (POSITION COUNTER)		/A230
CLUPT2,	0			/ TEMP 2 (CHARACTER STORAGE)		/A230
CLUPT3,	0			/ TEMP 3 (CHARACTER STORAGE)		/A230
CLUPT4,	0			/ TEMP 4 (INNER LOOP COUNTER)		/A230

/--------------------
	PAGE

OVTYPE=OLB
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM


OVNUMM=.-OVRLCA
OBNUMM=OVTYPE+OVNUM

DCSESC="/&177		/CHARACTER TO CHANGE MODES			/A257

/ WE NOW ENTER THE OCTAL NUMERIC MODE.  IF AND/OR WHEN WE ENCOUNTER
/ A DCSESC CHARACTER, WE WILL ENTER THE TEXT MODE.  WE WILL STAY IN THE TEXT
/ MODE UNTIL WE ENCOUNTER ANOTHER DCSESC CHARACTER, WHICH WILL PUT US BACK IN
/ THE OCTAL NUMERIC MODE, ETC. UNTIL THE END OF THE LINE

/ WE CONVERT NUMERIC CHARACTERS ON THE FLY, BUT IF WE ENCOUNTER
/ TEXT WE WILL BUFFER IT IN THE TOKEN BUFFER UNTIL A SEPARATOR IS FOUND.
/ WE THEN SEE IF THE TOKEN IS THE NAME OF AN ASCII CHARACTER.  IF SO,
/ WE TRANSMIT THE APPROPRIATE ASCII VALUE.  IF THE TEXT IS NOT MATCHED
/ WE ENTER THE TEXT MODE SO THE USER CAN SEE THE MISTAKE.

/ AT THE END OF THE LINE WE RETURN TO PARSE ANY CONTROLS WHICH
/ MAY COME AFTER PRINTER.  END OF LINE HAS NO EFFECT IN TEXT MODE

/ IN THE NUMERIC MODE WE TREAT THE SPACE CHARACTER AS A SEPARATOR
/ BETWEEN SUCESSIVE NUMERIC CHARACTERS.  A SPACE IS NOT REQUIRED
/ BEFORE A DCSESC CHARACTER MODE CHANGE CHARACTER.

	TAD	PRQINU		/ GET MENU PRINT MARGIN PU		/A212

	JMS	LPIND		/ INDENT IN CASE ANY TEXT IS IN CONTROL BLK

PCNUMM,	AC7777			/ SET THE NUMBER TO NON EXISTENT AS YET
	DCA	PCNMBR
	TAD	(PCTBUF-1)	/ SET UP TO USE BUFFER
	DCA	X1		/ INIT INDEX
	TAD	(-PCTBSZ)
	DCA	AT2		/ INIT COUNTER				/C261
	DCA	PCTBUF		/ CLEAR FIRST CHR IN TOKEN BUFFER
PCNLOO,	JMS	PCSTLS		/ GET A CHARACTER

	TAD	(-SPC)		/ IS IT SPACE?				/C254
	SNA			/
	JMP	PCNSPC		/ YES

	TAD	(SPC-DCSESC)	/ IS IT DCSESC CHARACTER?
	SNA
	JMP	PCNBSL		/ YES

	TAD	(DCSESC-LF)	/ SEE IF A HARD RETURN
	SNA CLA
	JMP	PCNEOL		/ YES

	TAD	T1		/ GET CHR BACK
	AND	(170)		/ TURN OFF OCTAL BITS
	TAD	(-60)		/ SEE IF A VALID OCTAL DIGIT
	SNA CLA
	JMP	PCVOCT		/ YES
PCNSVC,	TAD	T1		/ NO, RECOVER THE CHR
	DCA I	X1		/ AND SAVE IN BUFFER
	ISZ	AT2		/ MAKE SURE IT FITS			/C261
	JMP	PCNLOO		/ IT FITS, LOOP
	JMP	PCSTEL		/ IT DOESN'T FIT, STRIP


PCNBSL,	JMS	PCNASC		/ DCSESC CHARACTER
	JMP	PCTXTL
PCNSPC,	JMS	PCNASC		/ SPACE
	JMP	PCNUMM
PCNEOL,	JMS	PCNASC		/ END OF LINE
	JMP	PRSPRI		/ GO PARSE WHAT COMES AFTER "PRINTER"


PCNASC,	XX			/ OUTPUT NUMERIC OR ASCII
	DCA I	X1		/ SET STOPPER
	JMS	PCNOUT		/ OUTPUT THE NUMBER, IF ANY
	TAD	PCTBUF		/ GET FIRST CHR IN BUFFER
	SNA CLA			/ SKIP IF SOMETHING THERE
	JMP I	PCNASC		/ NOTHING, RETURN
	JMS	PARSE		/ PARSE ANY TEXT
		STGASC		/ LIST OF STRINGS
		TAD (-36)	/ SOH (SOH-US)
		IAC	/ US
		IAC	/ RS
		IAC	/ GS
		IAC	/ FS
		IAC	/ ESC
		IAC	/ SUB
		IAC	/ EM
		IAC	/ CAN
		IAC	/ ETB
		IAC	/ SYN
		IAC	/ NAK
		TAD (2	/ DC4
		TAD (2	/ DC2
		IAC	/ DLE
		IAC	/ SI
		IAC	/ SO
		IAC	/ CR
		IAC	/ FF
		IAC	/ VT
		IAC	/ LF
		NOP	/ TAB
		IAC	/ HT
		IAC	/ BS
		IAC	/ BEL
		IAC	/ ACK
		IAC	/ ENQ
		IAC	/ EOT
		IAC	/ ETX
		TAD (2)	/ STX
	JMP	PCASCI		/ GO PRINT ASCII CHARACTER
	JMP	PCTXTL		/ NOT IN PARSE LIST
PCASCI,	JMS	PRCHAR		/ NULL OR WHATEVER ELSE GOT ADDED
	JMP I	PCNASC		/ RETURN


PCVOCT,		/ THE CHR IS A VALID OCTAL DIGIT 60-67 ASCII
	TAD	PCTBUF		/ SEE IF WE ARE ASSEMBLING A TOKEN
	SZA CLA
	JMP	PCNSVC		/ YES, GO SAVE CHR
	TAD	PCNMBR		/ SEE IF FIRST DIGIT
	SPA CLA			/ IF SO, CLEAR THE VALUE
	DCA	PCNMBR

	TAD	PCNMBR		/ GET THE PREVIOUS VALUE
	CLL R3L			/ ROTATE 3 LEFT
	TAD	T1		/ ADD IN THIS DIGIT
	TAD	(-60)		/ SUBTRACT THE ASCII BIAS
	AND	P377		/ STRIP TO 8 BITS
	DCA	PCNMBR		/ AND SAVE RESULT TO DATE
	JMP	PCNLOO		/ AND LOOP FOR NEXT NUMBER

AT2,	0			/ A COUNTER FOR PCNUMM ROUTINE		/A261
/------------------------
	PAGE

PCTXTL,	JMS	PCSTLS		/ STRIP LEADING SPACES
	TAD	(-DCSESC)		/ IS IT DCSESC CHARACTER?
	SNA CLA
	JMP	PCNUMM		/ YES, GO TO NUMERIC MODE

	TAD	T1		/ GET CHR BACK
	AND	P177		/ STRIP
	TAD	(-LF)		/ IS IT LF?
	SNA
	JMP	PCTLF		/ YES, HANDLE IT
	TAD	(-GNL+LF)	/ SEE IF GRAPHICS NEW LINE CODE
	SNA CLA			/
	ISZ	GRALNC		/ YES, COUNT IT AND OUTPUT IT
	NOP

	TAD	T1		/ NO, RESTORE AC
	AND	P177		/ spare us from 8 bit chars		/a271
	JMS	PRCHAR		/ AND OUTPUT CHR
	JMP	PCTXTL		/ AND LOOP TEXT MODE

PCTLF,		/ TEXT MODE END OF LINE SEEN
	TAD	(CR)		/ SEND A CARRIAGE RETURN
	JMS	PRCHAR
	TAD	PRQPNT		/ GET DOCUMENT DESTINATION		/A214
	TAD	(-DHOST2)	/ 					/A214
	SZA CLA			/ SKIP IF A REAL HOST			/A214
	TAD	PRLLSZ		/ AND MOVE AHEAD THE LINE SIZE
	JMS	PRMOVE
	JMP	PCTXTL		/ AND LOOP TEXT MODE

STGASC,			/ ASCII STRINGS
/ ASCII CONTROL CODES BY NAME

	TEXT "SOH"	/ SOH MUST PRECEDE SO!
	TEXT "US"
	TEXT "RS"
	TEXT "GS"
	TEXT "FS"
	TEXT "ESC"
	TEXT "SUB"
	TEXT "EM"
	TEXT "CAN"
	TEXT "ETB"
	TEXT "SYN"
	TEXT "NAK"
	TEXT "DC4"
	TEXT "DC2"
	TEXT "DLE"
	TEXT "SI"
	TEXT "SO"
	TEXT "CR"
	TEXT "FF"
	TEXT "VT"
	TEXT "LF"
	TEXT "TAB"
	TEXT "HT"
	TEXT "BS"
	TEXT "BEL"
	TEXT "ACK"
	TEXT "ENQ"
	TEXT "EOT"
	TEXT "ETX"
	TEXT "STX"
	TEXT "NUL"
	0


OVGRAP=.-OVRLCA
OBGRAP=OVTYPE+OVNUM

/ "PRINTER GRAPHIC" CONTROL SEEN
/ ENTER SIXEL GRAPHICS MODE.  SEND THE ESCAPE SEQUENCE TO ENTER THE MODE
/ AND THEN ENTER THE TEXT MODE.  THIS MERELY SENDS THE TEXTUAL CHARACTERS
/ SEEN IN THE REST OF THE CONTROL, WHICH ARE INTERPRETED AS SIXELS.  THE
/ SIXEL TEXT MUST BE WITHINT THE CONTROL SO THAT NORMAL LINE COUNTING
/ IS DISABLED.  IN THIS MODE WE COUNT GRAPHIC NEW LINE CODES (HYPHENS),
/ KEEP TRACK OF HOW FAR DOWN THE PAGE THE GRAPHIC TAKES US.  WE DO NOT
/ ATTEMPT TO DETERMINE IF WE GO BEYOND A PAGE BOUNDARY.  IN ORDER TO EXIT
/ GRAPHICS MODE WE HAVE AN END CONTROL, A START CONTROL WITH

/ "PRINTER RETURN", FOLLOWED BY END CONTROL
	DCA	GRALNC		/ CLEAR COUNT OF GRAPHIC NEW LINES
	TAD	PRMCLM		/ INDENT THE GRAPHIC
	JMS	LPIND		/
	JMS	PRESCS		/ PUT OUT ESCAPE SEQUENCE
		PCGR		/ TO ENTER SIXEL GRAPHICS MODE
	JMP	PCTXTL		/ AND ENTER TEXT MODE

OVGRET=.-OVRLCA

/ "PRINTER RETURN" SEEN.  EXIT THE GRAPHICS MODE, AND RETURN TO THE VERTICAL
/ POSITION ON THE PAGE WHERE GRAPHICS MODE WAS ENTERED.

	JMS	PRESCS		/ SEND SEQUENCE
		PCGREX		/ TO EXIT GRAPHICS MODE
				/ *** NOTE THIS SEQUENCE CONTAINS A CARRIAGE
				/ RETURN WHICH IS NECESSARY TO RESET THE
				/ INDENT BECAUSE LPIND DOES IT AGAIN WITH
				/ SPACES FOR THE LA50...
	TAD	GRALNC		/ GET NUMBER OF GRAPHIC LINES
	CLL RAL			/ MULTIPLY
	CLL RAL			/ BY FOUR
	CIA			/ NEGATE
	JMS	PRESCS		/ CALL PRESCS TO OUTPUT MOVE
		PCMPUP		/
		CLA		/
	DCA	GRALNC		/ CLEAR LINE COUNT
	JMS	PRSTRP		/ STRIP REST OF CONTROL
	TAD	(OVSTRP		/ GO STRIP REST OF CONTROL
	JMS	PROV
		OBSTRP

XSGRAP,	ESC; "P&177; "q&177+4000
XSGRET,	ESC; "\&177; 4015	/INCLUDES CARRIAGE RETURN!
/----------------
	PAGE

OVTYPE=OLB
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM



/THIS ROUTINE IS CALLED WHEN A BACKSLASH IS FOUND IN A LINE OF A HEADER
/OR FOOTER.  THE CHARACTER WHICH FOLLOWS THE BACKSLASH IS IN PRBTYP.  THE
/ROUTINE DETERMINES IF THE DATE (\d), THE PAGE (\p), OR THE SECTION (\s)
/SHOULD BE INSERTED INTO THE LINE BEING BUILT, AND DOES SO IF NEED BE.

OVBSLH=.-OVRLCA
OBBSLH=OVTYPE+OVNUM

	JMS	PRGCHR	/GET THE NEXT CHARACTER
	DCA I	PLPTR	/SAVE IN THE BUFFER
	ISZ	BSLCNT	/ COUNT BACKSLASHES IN THE LINE FOR PRCLUP	/A230
	ISZ	BSLCNT	/ TWICE TO INCLUDE CHARACTER WITH SLASH		/A230

/THE CHARACTER FOLLOWING THE BACKSLASH IS IN THE BUFFER.  TEST IT.

	TAD I	PLPTR	/GET THE CHARACTER
	AND	(1600)	/SAVE THE MODE BITS
	DCA	PRHMOD

	TAD I	PLPTR	/RECOVER THE CHARACTER
	AND	P177	/STRIP THE MODE BITS
	TAD	(-144)	/IS IT A DATE (d)?
	SNA
	JMP	PRHODT	/JUMP IF SO

	IFNDEF V30NOR <
	TAD  (144-160)	/IS IT A PAGE (p)?
	>
	IFDEF V30NOR <
	TAD   (144-163) >	/ S is Norwegian for (p) for page	/A275
	SNA
	JMP	PRHOPG	/JUMP IF SO
	IFNDEF V30NOR <
	TAD  (160-163)	/IS IT A SECTION (s)?
	>
	IFDEF V30NOR <
	TAD (163-141) > / Norwegian for Section is (a)			/A275
	SNA		/						/C255
	JMP	PRHOCH	/JUMP IF SO
	IFNDEF V30NOR <
	TAD  (-166+163)	/IS IT A VERSION (\v)?
	>
	IFDEF V30NOR <
	TAD  (141-166)>	/ 						/A275
	SNA
	JMP	PRHOV	/YES
	TAD  (166-146)	/IS IT A FIXED STRING (\f)?
	SNA
	JMP	PRHOF	/YES

/THE BACKSLASH STOOD FOR NOTHING SPECIAL.  RETURN TO INSERT THE CHARACTER.

PRHONS,	AC7777		/ CLA AND DECREMENT BACKSLASH COUNTER		/C255
	DCA	BSLCNT	/ IF CHARACTER WAS MEANINGLESS			/A230
			/ BECAUSE WE ALREADY COUNTED IT ABOVE		/A230
	JMP	PRGLO3	/RETURN TO THE MAIN ROUTINE

/THE BACKSLASH COMMAND REQUESTS THE INSERTION OF THE SECTION INTO THE
/LINE BUFFER.  THIS SECTION HANDLES THE REQUEST.

PRHOCH,
	TAD	PRSCNM	/GET THE SECTION NUMBER
	JMS	PRHPV	/INSERT IT
	JMP	PRGLO6	/RETURN

/THE BACKSLASH COMMAND REQUESTS THE INSERTION OF THE PAGE INTO THE
/LINE BUFFER.  THIS SECTION HANDLES THE REQUEST.

PRHOPG,
	TAD	PRPGNM	/GET THE PAGE NUMBER
	JMS	PRHPV	/INSERT IT
	JMP	PRGLO6	/RETURN

/THE BACKSLASH COMMAND REQUESTS THE INSERTION OF THE DATE INTO THE
/LINE BUFFER.  THIS SECTION HANDLES THE REQUEST.

/THE DATE IS PICKED UP FROM THE DATE-TIME STRING IN THE MENU FIELD	/A211
/THIS IS THE STRING THAT APPEARS ON THE SCREEN AT MAIN MENU		/A211
/THE STRING IS COPIED INTO THE BUFFER UP TO THE POINT WHERE		/A211
/THE FIRST SPACE IS ENCOUNTERED INDICATING THE END OF THE DATE		/A211

PRHODT,									/A211
	CDFMNU								/A211
	TAD I	(DATESP		/ GET LOCATION OF DATEST(RING)		/A211
	CDFMYF								/A211
	DCA	PRHOD2		/ SAVE IT FOR LATER			/A211
PRHOD1,									/A211
	CDFMNU								/A211
	TAD I	PRHOD2		/ GET FIRST CHARACTER OF DATE		/A211
	CDFMYF								/A211
/ IF WE TEST FOR SPACE, WE WILL END THE STRING AFTER THE DATE		/A250
/ IF WE TEST FOR NULL, WE WILL PRINT THE STRING AS SEEN ON THE SCREEN	/A250
IFNDEF DEVEL < TAD (-40 >	/ IS IT A SPACE?			/C250
	SNA			/ SKIP IF NO				/A211
	JMP	PRGLO6		/ IT IS A SPACE. RETURN TO CALLER	/A211
IFNDEF DEVEL < TAD (40 >	/ RESTORE CHARACTER			/C250
	JMS	PRINS		/ INSERT IT INTO LINE BUFFER		/A211
	ISZ	PRHOD2		/ INCREMENT TO NEXT CHAR LOCATION	/A211
	ISZ	EXPCNT		/ INCREMENT EXPANSION COUNT		/A230
	JMP	PRHOD1		/ PROCESS NEXT CHARACTER		/A211

PRHOD2,	0								/A211

/THIS SECTION INSERTS A HYPHEN INTO THE BUFFER BECAUSE A HYPHENATED
/RETURN TERMINATED THE LINE.

OVIHYP=.-OVRLCA
OBIHYP=OVTYPE+OVNUM

	TAD	(55)	/GET A HYPHEN
	JMS	PRINS	/INSERT IT INTO THE BUFFER

	TAD	(2012)	/GET A WORD WRAPPED END OF LINE
	DCA I	PLPTR	/INSERT IT INTO THE BUFFER

	JMP	PRGLO6	/JUMP TO RETURN FROM THE ROUTINE	

/THIS ROUTINE TAKES THE OCTAL NUMBER IN THE AC AND INSERTS THE CHARACTERS
/CORRESPONDING TO THE DECIMAL EQUIVALENT INTO THE CHARACTER BUFFER.  IT
/OPERATES BY USING A TABLE OF THE POWERS OF 10 AND FINDING HOW MANY TIMES
/EACH POWER FITS INTO THE ARGUMENT.

/REWRITTEN TO USE 13 BIT ARITHMETIC.   NUMBERS ARE NOW INTEGER VALUES
/IN THE RANGE 0 TO 4095						/A156

PRHPV,	XX

	SNA
	JMP	PRHPL5	/TREAT ZERO AS A SPECIAL CASE

	DCA	PRHPT1	/SAVE THE ARGUMENT

	TAD (PRTENS-1)	/GET THE ADDRESS OF THE BEGINNING OF THE TABLE
			/OF POWERS OF 10
	DCA	PRHPT2	/SAVE IT
	DCA	PRHPT3	/CLEAR THE COUNT


/THIS LOOP FINDS THE LARGEST POWER OF 10 WHICH IS LESS THAN THE ARGUMENT.
/WHEN IT FINISHES, PRHPT2 POINTS TO THIS POWER.


PRHPL1,	CLA CLL								/C156
	ISZ	PRHPT2
	TAD I	PRHPT2	/GET THE NEXT POWER OF 10
	TAD	PRHPT1	/ADD IN THE ARGUMENT
	SNL		/IF THE RESULT IS POSITIVE, THIS IS THE		/C156
			/POWER WE ARE LOOKING FOR
	JMP	PRHPL1	/HAVEN'T FOUND THE RIGHT POWER.  CONTINUE THE LOOP

/THIS LOOP FINDS THE NUMBER OF TIMES THE POWER OF 10 POINTED TO BY PRHPT2 WILL
/FIT INTO THE ARGUMENT CONTAINED IN PRHPT1.  IT KEEPS COUNT IN PRHPT3.


PRHPL2,
	CLL								/A156
	ISZ	PRHPT3	/INCREMENT THE COUNT
	DCA	PRHPT1	/SAVE THE REDUCED ARGUMENT
	TAD I	PRHPT2	/GET THE POWER OF 10

PRHPL3,
	TAD	PRHPT1	/ADD THE ARGUMENT
	SZL		/SKIP IF IT IS TOO LARGE			/C156
	JMP	PRHPL2	/CONTINUE THE LOOP


/THIS SECTION INSERTS THE COUNT INTO THE LINE AND CONTINUES THE LOOP

	CLA
	TAD	PRHPT3	/MAKE COUNT INTO CHARACTER
	TAD	(60)
	JMS	PRINS	/OUTPUT CHAR TO BUFFER

	ISZ	EXPCNT	/ INCREMENT EXPANSION COUNT			/A230
	ISZ	PRHPT2	/POINT TO THE NEXT POWER
	DCA	PRHPT3	/CLEAR THE COUNT
	TAD I	PRHPT2	/GET THE NEXT POWER
	SNA
	JMP I	PRHPV	/DONE--RETURN
	JMP	PRHPL3	/CONTINUE THE LOOP


/THIS SECTION HANDLES THE SPECIAL CASE OF ZERO.

PRHPL5,
	TAD	(60)	/GET THE CHARACTER ZERO
	JMS	PRINS	/OUTPUT THE CHARACTER INTO THE CHARACTER BUFFER
	JMP I	PRHPV	/DONE--RETURN


PRHPT1,	0	/THE VALUE WHICH MUST BE INSERTED INTO THE BUFFER
PRHPT2,	0	/POINTER TO THE NEXT POINTER
PRHPT3,	0	/COUNTER


	DECIMAL
PRTENS,	-1000
	-100
	-10
	-1
	0
	OCTAL



/THIS ROUTINE TACKS ON THE MODE BITS SAVED IN PRHMOD AND INSERTS THE
/CHARACTER INTO THE LINE BUFFER.

PRINS,
	XX

	TAD	PRHMOD	/ADD THE MODE BITS
	DCA I	PLPTR	/PUT INTO THE BUFFER
	JMS	PLNXT	/UPDATE THE BUFFER POINTERS
		NOP	/TOO BAD IF THERE'S NO MORE ROOM
	JMP I	PRINS	/AND RETURN
/---------------------
PAGE

/LIST PROCESSING READ LOOP--
/THIS WAIT LOOP CONTINUALLY TESTS PRIRFD.  AS LONG AS THE VALUE IS POSITIVE,
/THE WAIT LOOP CONTINUES.  WHEN THE VALUE GOES ZERO, PRINTING IS ENDED AND
/A NEW DOCUMENT IS RECOVERED.  IF THE VALUE IS NEGATIVE, ANOTHER COPY IS
/READY.  THIS NEGATIVE VALUE DOUBLES AS A CIF INSTRUCTION WHICH IS USED TO
/PATCH RDEDIT.

NCPYL5,
	JMS	SQPINP	/ SEE IF ANY CHRS COMING BACK			/A142
	CIFSYS
	JWAIT

OVNCP6=.-OVRLCA		/ ENTRY POINT FOR LIST PROCESSING READ LOOP
OBNCP6=OVTYPE+OVNUM

	DCA	PRQCPY	/CLEAR NUMBER OF COPIES
	DCA	PRQ2W	/AND TWO WHEEL FLAG
	TAD	PRIRFD	/GET FLAG--SHOULD WE GO ON?
	SPA
	JMP	NCPYL7	/NEGATIVE VALUE--CONTINUE PRINTING
	SZA CLA
	JMP	NCPYL5	/POSITIVE VALUE--WAIT FOR THE START FLAG
	TAD   (OVDONE)	/ZERO VALUE--GET A NEW DOCUMENT FROM THE QUEUE
	JMS	PROV
		OBDONE

/THE EDITOR IS READY TO SUPPLY CHARACTERS.  THE FLAG PRIRFD IS A CIF TO
/THE INSTRUCTION FIELD OF THE EDITOR.

NCPYL7,
	DCA	RDEDIT	/PATCH THE READ ROUTINE WITH THE CIF INSTRUCTION

/NOW, THE BUFFER FIELD FOR LIST PROCESSING HEADERS AND FOOTERS IS THE
/FIELD ABOVE THE EDITOR FIELD.  SET THE BUFFER FIELD IN THE LIST PROCESSING
/(HEADER/FOOTER) READ ROUTINE.

	TAD	PRIRFD	/GET THE CIF INSTRUCTION
	AND	(70)	/ISOLATE THE EDITOR FIELD NUMBER
	TAD   (CDF 10)	/CREATE A CDF TO THE FIELD ABOVE THE EDITOR FIELD
	DCA	RDBUF1	/SAVE IN THE LIST PROCESSING READ ROUTINE

	DCA	PRIRFD	/CLEAR THE FLAG

	AC7777
	DCA	LPFLAG	/SET LIST PROCESSING FLAG TO LIST PROCESSING IN
			/PROCESS

	TAD   (RDEDIT)	/USE THE LIST PROCESSING ROUTINE
	DCA	RDCHAR
	JMP	PRTOPP	/DO TOP OF PAGE PROCESSING AND ENTER MAIN LOOP

/ OUTPUT A FIXED STRING IF \f SEEN.  THIS IS DEVELOPMENTAL CODE
/ THEREFORE, FORGET ABOUT INSERTION STRING LENGTH JUSTIFICATION PROBLEMS.

PRHOF,
IFDEF DEVEL <
	TAD	(PRHVST-1)	/ SET UP
	DCA	X2		/ AN INDEX REGISTER
PRHOF1,	CDFMYF			/ LEAVE INCASE WE WANT TO PATCH
	TAD I	X2		/ READ A PACKED WORD
	CDFMYF			/ INCASE SHANGE FIELD ABOVE
	BSW			/ SWAP IT
	DCA	PRHOFT		/ SAVE IT
	TAD	PRHOFT		/ GET IT BACK
	JMS	PRHVCR		/ PROCESS IT
	   JMP	PRGLO6		/ END SEEN
	TAD	PRHOFT		/ NOW DO 2ND BYTE
	BSW
	JMS	PRHVCR		/ PROCESS IT
	   JMP	PRGLO6		/ END SEEN
	JMP	PRHOF1		/ GO GET NEXT WORD


PRHVCR,	XX			/ PROCESS A BYTE
	AND	P77		/ MASK IT
	SNA
	JMP I	PRHVCR		/ RETURN IF ZERO--END OF STRING
	ISZ	PRHVCR		/ NOT, PREPARE SKIP RETURN
	TAD	(-40)		/ SEE IF 40 OR GREATER
	SPA
	TAD	(100)		/ NO, ADD 100
	TAD	(40)		/ YES, JUST ADD 40
	JMS	PRINS		/ GO INSERT CHR IN BUFFER
	ISZ	EXPCNT		/ COUNT THIS EXPANSION
	JMP I	PRHVCR		/ RETURN

PRHOFT,	0			/ TEMP FOR PRHOF

PRHVST,	TEXT 'LN03 V3.3'
	>	/END IFDEF DEVEL

IFNDEF DEVEL <JMP PRHONS>



/VERSION NUMBER

PRHOV,
	TAD	(SYSVER&177
	JMS	PRINS
	ISZ	EXPCNT
	TAD	(SYSBAS&177
	JMS	PRINS
	ISZ	EXPCNT
	TAD	(SYSREV&177
	JMS	PRINS
	ISZ	EXPCNT
	JMP	PRGLO6
/----------------------
	PAGE

OVTYPE=OLB
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM



/THIS SECTION HANDLES PAGE FORMATTING.  THE PAGE CAN BE DIVIDED INTO SEVEN
/SECTIONS, AND THIS OVERLAY IS DIVIDED INTO SEVEN SECTIONS TO HANDLE THESE
/DIVISIONS.  THE SEVEN SECTIONS, THE ASSUMPTIONS OF EACH, AND THE ACTIONS
/OF EACH ARE DETAILED BELOW:

/TOP OF HEADER (TOPH)

/ASSUMPTIONS - THE PAGE IS POSITIONED AT THE TOP PAGE BOUNDARY.

/ACTION - IF A HEADER IS NOT IN EFFECT, THE PAGE IS MOVED TO THE BEGINNING
/         OF THE TEXT AREA (FOLLOWING THE TOP MARGIN) AND WE CONTINUE WITH
/	  NEW COLUMNS.  IF A HEADER IS IN EFFECT, THE PAGE IS MOVED TO
/	  THE BEGINNING OF THE HEADER AREA.  PREPARATION IS THEN MADE
/	  TO PRINT THE HEADER AND WE CONTINUE WITH MORE SPACING.


/BOTTOM OF HEADER (BOTH)

/ASSUMPTIONS - THE PAGE IS POSITIONED SOMEWHERE IN THE TOP MARGIN AREA.

/ACTION - THE PAGE IS MOVED TO THE BEGINNING OF THE TEXT AREA (FOLLOWING
/	  THE TOP MARGIN.  PREPARATION IS MADE TO RESTORE REGULAR TEXT
/	  PRINTING.  WE CONTINUE WITH NEW COLUMNS.


/NEW COLUMNS (NEWC)

/ASSUMPTIONS - THE PAGE IS POSITIONED AT THE BEGINNING OF THE COLUMN AREA.
/	       THIS CAN BE ANYWHERE ON THE PAGE BELOW THE TOP MARGIN, SINCE
/	       A NEW SET OF COLUMNS CAN BEGIN ANYWHERE.

/ACTION - THE COLUMN VARIABLES ARE INITIALIZED AND WE CONTINUE WITH MORE
/	  SPACING.


/NEXT COLUMN (NXTC)

/ASSUMPTIONS - THE PAGE IS POSITIONED ANYWHERE BELOW THE TOP MARGIN.

/ACTION - IF ANOTHER COLUMN IS TO BE PRINTED, THE PAGE IS POSITIONED TO
/	  BEGIN THE NEW COLUMN AND WE CONTINUE WITH MORE SPACING.  IF
/	  ALL THE COLUMNS HAVE BEEN PRINTED, WE CONTINUE WITH TOP OF
/	  FOOTER.


/TOP OF FOOTER (TOPF)

/ASSUMPTIONS - THE PAGE IS POSITIONED ANYWHERE BELOW THE TOP MARGIN.

/ACTION - NORMAL INDENTATION IS RESTORED AND THE PAGE IS MOVED TO THE
/	  BEGINNING OF THE BOTTOM MARGIN OR TO THE END OF THE LONGEST
/	  COLUMN, WHICHEVER IS GREATER.  IF THERE IS A FOOTER IN EFFECT
/	  AND ROOM TO PRINT IT, FOOTER PRINTING IS SET UP AND WE CONTINUE
/	  WITH MORE SPACING.  OTHERWISE, WE CONTINUE WITH BOTTOM OF PAGE.


/BOTTOM OF FOOTER (BOTF)

/ASSUMPTIONS - THE PAGE IS POSITIONED SOMEWHERE IN THE BOTTOM MARGIN.

/ACTION - NORMAL TEXT PRINTING IS RESTORED AND WE CONTINUE WITH BOTTOM
/	  OF PAGE.


/BOTTOM OF PAGE (BOTP)

/ASSUMPTIONS - THE PAGE IS POSITIONED ANYWHERE.

/ACTION - THE PAGE NUMBER IS INCREMENTED AND THE PAGE IS MOVED TO THE
/	  NEXT PAGE BOUNDARY.  IF WE ARE AT THE END OF THE FILE, PRINTING
/	  OF THE CURRENT COPY IS TERMINATED.  OTHERWISE, WE CONTINUE WITH
/	  TOP OF PAGE PROCESSING.	



/THIS SECTION HANDLES THE TOP OF THE HEADER.

OVTOPH=.-OVRLCA
OBTOPH=OVTYPE+OVNUM

/IF PRINTING IS CURRENTLY SUPPRESSED, THERE IS NO NEED TO PROCESS A HEADER.

	TAD	PRYES	/IS PRINTING INHIBITED?
	SZA CLA
	JMP	TOPHL0	/YES--DO NOT PRINT THE HEADER

/DETERMINE WHETHER OR NOT A HEADER IS IN EFFECT.

	TAD	PRHSIZ	/GET THE HEADER SIZE.  IF NON-ZERO, THERE IS A HEADER.
	SZA
	JMP	TOPHL1	/THERE IS A HEADER--JUMP TO HANDLE IT

/THERE IS NO HEADER--SPACE THE TOP MARGIN AND CONTINUE WITH NEW COLUMNS.

TOPHL0,
	TAD	PRQTMG	/GET THE TOP MARGIN
	JMS	PRMOVE	/MOVE IT
	JMP	PRNEWC	/CONTINUE WITH NEW COLUMNS

/THERE IS A HEADER IN EFFECT--PREPARE TO PRINT IT.

TOPHL1,
	CIA		/NEGATE THE HEADER SIZE
	TAD	PRQTMG	/SUBTRACT FROM THE TOP MARGIN
	SMA		/SKIP IF THE RESULT IS NEGATIVE
	JMS	PRMOVE	/MOVE THE AMOUNT THE HEADER WON'T USE
	CLA

	TAD	PRQTMG	/USE THE TOP MARGIN SIZE
	DCA	PRGSMX	/AS THE MAXIMUM ATTAINABLE VERTICAL POSITION

	JMS	PROV	/LOAD THE OVLAY CONTAINING PRSAVE		/A185
		OBPRSV							/A185
	JMS	PRSAVE	/SAVE THE CURRENT TEXT LOCATION

	JMS	PROV	/LOAD THE OVERLAY				/A185
		OBREST	/CONTAINING PRREST				/A185
	AC0001
	JMS	PRREST	/RESTORE THE HEADER

	JMP	PRGSL1	/RETURN TO DO MORE SPACING



/THIS SECTION HANDLES THE BOTTOM OF THE HEADER.

OVBOTH=.-OVRLCA
OBBOTH=OVTYPE+OVNUM


	JMS	PROV	/LOAD THE OVERLAY				/A185
		OBREST	/CONTAINING PRREST				/A185
	JMS	PRREST	/RESTORE THE CURRENT TEXT

	TAD	PRGSVP	/SUBTRACT RELATIVE VERTICAL POSITION
	CIA
	TAD	PRQTMG	/FROM THE TOP MARGIN SIZE
	JMS	PRMOVE	/MOVE THE REMAINDER OF THE TOP MARGIN
	JMP	PRNEWC	/CONTINUE WITH NEW COLUMN


/THIS SECTION HANDLES NEW COLUMNS.

OVNEWC=.-OVRLCA
OBNEWC=OVTYPE+OVNUM

PRNEWC,

/SET UP THE COLUMN VARIABLES

	AC0001
	DCA	PRMCPC	/SET PRESENT COLUMN TO ONE

	TAD	PRGSVP	/GET RELATIVE VERTICAL POSITION
	
	DCA	PRMCTM	/SAVE AS THE TOP MARGIN

	DCA	PRMCLL	/INIT THE LONGEST LINE LENGTH

/SET THE MAXIMUM ATTAINABLE VERTICAL POSITION.

	TAD	PRQBMG	/GET BOTTOM MARGIN SIZE
	CIA
	TAD	PRQPSZ	/SUBTRACT FROM PAGE SIZE
	DCA	PRGSMX	/SAVE AS MAXIMUM POSITION

	DCA	PRMCBM	/CLEAR BOTTOM MARGIN

	JMP	PRGSL1	/CONTINUE TO DO MORE SPACING


/THIS SECTION HANDLES NEXT COLUMN.

OVNXTC=.-OVRLCA
OBNXTC=OVTYPE+OVNUM


/IF THE BOTTOM OF THIS COLUMN IS BEYOND THE CURRENT LARGEST BOTTOM MARGIN
/TO DATE, UPDATE THE BOTTOM MARGIN.

	TAD	T1	/CHECK TO SEE IF WE GOT HERE BY WAY OF E-O-F.	/A087
	SZA CLA		/ SKIP IF YES.					/A087
	JMP	NXTCL0	/ JMP IF NO. CONTINUE PROCESSING.		/A087
	AC0001		/ SET THE E-O-F SEEN FLAG.			/A087
	DCA	PREOF	/  ...						/A087
NXTCL0,	TAD	PRGSVS	/GET ACCRUED VERTICAL SPACING.			/A075
	TAD	PRGSVP	/GET THE CURRENT VERTICAL POSITION
	CIA
	TAD	PRMCBM	/SUBTRACT FROM THE CURRENT BOTTOM MARGIN
	SMA CLA
	JMP	NXTCL1	/THE OLD MARGIN WAS LARGER

/THE BOTTOM MARGIN MUST BE UPDATED.

	TAD	PRGSVS	/GET ACCRUED VERTICAL SPACING.			/A075
	TAD	PRGSVP	/GET THE CURRENT VERTICAL POSITION
	DCA	PRMCBM	/UPDATE THE BOTTOM MARGIN

/IF THE END OF FILE WAS REACHED, CONTINUE WITH TOP OF FOOTER CODE
/INSTEAD AS THERE IS NO MORE ROOM.  THIS TEST IS DONE AS A CONTINUATION
/OF THE SPACING ROUTINE.

NXTCL1,
	TAD	RDCHAR	/SEE IF THE END OF THE FILE HAS BEEN READ
	SNA CLA
	JMP	PRTOPF	/YES--CONTINUE WITH TOP OF FOOTER

	ISZ	PRMCPC	/INCREMENT THE COLUMN NUMBER
	TAD	PRMCPC	/GET THE COLUMN NUMBER
	CIA
	TAD	PRMCAY	/SUBTRACT FROM THE NUMBER OF COLUMNS
	SPA CLA
	JMP	PRTOPF	/CONTINUE WITH TOP OF FOOTER--NO MORE COLUMNS

/NOW DETERMINE THE PROPER INDENTATION

	TAD	PRMCLL	/IS THE WIDTH OF COLM DEFINED?			/A082
	SNA		/ SKIP IF YES. LET IT BE.			/A082
	TAD	RULRRM	/ OTHERWISE USE CURRENT RULER SETTING AS MAX	/A082
	DCA	PRMCLL	/  ...						/A082
	AC7777
	TAD   (PRMCAY)	/GET ADDRESS OF HEADER WORD OF TABLE
	TAD	PRMCPC	/ADD CURRENT COLUMN NUMBER TO GET WIDTH OF LAST COLUMN
	DCA	T1	/SAVE TO INDIRECT THROUGH
	TAD I	T1	/GET THE MARGIN SPECIFIED FOR THIS COLUMN
	CIA		/ COMPARE IT TO MAX LINE WIDTH.			/M082
	TAD	PRMCLL	/  ...						/M082
	SPA		/ SKIP IF LINE WIDTH IS MAX. RE-COMPUTE IT.	/A082
	CLA		/ MULTI-COLM CONTROL BLOCK ENVELOPE IS MAX.	/A082
	TAD I	T1	/ ADD CNTRL BLK ENVELOPE BACK IN.		/A082

	TAD	PRQCM	/ADD THE EXTRA COLUMN SPACING
	TAD	PRMCMG	/ADD THE PREVIOUS MULTICOLUMN MARGIN		/A243

	JMS	PRMCID	/SET THE LEFT MARGIN


/FINALLY, ROLL THE PAPER BACK UP TO THE TOP

	TAD	PRGSVP	/SUBTRACT RELATIVE VERTICAL POSITION
	CIA
	TAD	PRMCTM	/FROM THE TOP OF COLUMN POSITION
	JMS	PRMOVE	/MOVE THERE

	DCA	PRMCLL	/INIT LONGEST LINE IN COLUMN			/M079

	JMP	PRGSL1	/CONTINUE TO DO MORE SPACING


/THIS ROUTINE DOES INDENTATION

PRMCID,	XX
	DCA	PRMCMG	/SAVE AS THE MULTICOLUM LEFT COLUMN NUMBER	/A243
	TAD	PRMCMG	/RELOAD						/A243
	JMS	PRMULT	/FIND THE SPACING IN CHARACTER UNITS
		PLNRCS
	JMS	PRESCS	/INDENT TO THE LEFT MARGIN
		PCIND
	DCA	PRMCLM	/SET THE LEFT MARGIN TO THE ARGUMENT

	TAD	LPONLN	/IF A HOST					/A214
	SZA CLA		/SKIP THE CARRIAGE RETURN			/A214
	TAD	(CR)	/SEND CARRIAGE RETURN TO FORCE INDENT
	JMS	PRCHAR

	JMP I	PRMCID	/AND RETURN
/-------------------
PAGE


/THIS SECTION HANDLES TOP OF FOOTER PROCESSING.

/ IN PREVIOUS VERSIONS, FOOTERS WERE ALLOWED TO FLOAT DOWNWARD IF THE
/ BOTTOM MARGIN WAS INVADED BY EXTRA LINES (THIS CAN ONLY HAPPEN IN APNO).
/ AS OF THIS REWRITE (REV161) THE FOOTER POSITION WILL ALWAYS BE FIXED.
/ IF THE BOTTOM MARGIN IS INVADED, LINES WILL BE STRIPPED FROM THE TOP
/ OF THE FOTTER EVEN THOUGH THE FOOTER SIZE MAY BE LESS THAN THE BOTTOM
/ MARGIN SIZE.  THE CLEVER WPS USER WHO WANTS TO USE GOLD PAGE AND VIEW
/ ORPHAN LINES, AND DISCRETIONALLY MOVE DOWN THE NEW PAGE MARKER TO
/ ELIMINATE THEM, WILL LEAVE SOME BLANK LINES AT THE TOP OF THE FOOTER
/ TO FACILITATE HIS DESIRE.

/ THE PREVIOUS METHOD (REV161), IN REPOSITIONING TO THE TOP OF THE	/A200
/ FOOTER, REQUIRED REVERSE MOTION, IF THE NEXT HAD INVADED THE FOOTER.	/A200
/ THIS CAUSED A BUG ON DRAFT PRINTERS WHICH ARE NOT PROGRAMMED TO	/A200
/ DO REVERSE MOTION.  THUS, ALL REVERSE MOTION TO DRAFT PRINTER WAS	/A200
/ IGNORED AND THE PAGE REFERENCE WAS LOST				/A200
/ NOW (REV200) WE WILL NOT DO ANY REVERSE MOTION, SINCE NONE		/A200
/ IS REALLY NECESSARY, BUT WE MUST CHANGE OUR ALGORITHM A LITTLE	/A200

PRTOPF,
	DCA	PRMCPC	/SHOW NO COLUMN PRINTING

/ SEE WHERE WE ARE ON THE PAGE RELATIVE TO THE TOP OF THE FOOTER	/A200

	TAD	PRGSVP	/SUBTRACT CURRENT VERTICAL POSITION
	CIA
	TAD	PRGSMX	/FROM THE TOP OF THE FOOTER POSITION		/A135
	DCA	GSTMP1	/SAVE HOW FAR TO THE TOP OF THE NEXT FOOTER
			/PRGSVP IS MAINTAIN MODULO PAGE SIZE BY PRMOVE	/A200
	TAD	GSTMP1	/RESTORE DISTANCE IN PRINT UNITS
	SMA SZA		/SKIP IF MINUS OR ZERO				/A200
	JMS	PRMOVE	/IF FORWARD MOTION (NO INVASION) MOVE THERE	/C200
	CLA		/CLEAR NECESSARY IF WE SKIPPED			/A200


/RESET THE LEFT MARGIN TO NORMAL INDENTATION

	TAD	PRQIND		/GET NORMAL INDENT IN COLUMNS		/C243
	JMS	PRMCID		/DO THE INDENTATION

/SEE IF THERE IS A FOOTER IN EFFECT OR NOT

	TAD	PRFSIZ	/GET THE FOOTER SIZE.  IF NON-ZERO, THERE IS A FOOTER.
	SNA CLA
	JMP	PRBOTP	/NO FOOTER--CONTINUE WITH BOTTOM OF PAGE PROCESSING

/IF PRINTING IS INHIBITED, DO NOT PROCESS THE FOOTER.

	TAD	PRYES	/GET THE PRINT INHIBIT FLAG
	SZA CLA
	JMP	PRBOTP	/CONTINUE WITH BOTTOM OF PAGE PROCESSING

/DETERMINE IF THE FOOTER SIZE IS LESS THAN THE INVASION AMOUNT		/A200
/THIS WILL SAVE TIME AND PREVENT GETTING AN ERRONEOUS MISSING CTL MSG	/A200

	TAD	PRFSIZ	/GET FOOTER SIZE				/A200
	TAD	GSTMP1	/AND NEGATIVE AMOUNT OF INVASION		/A200
	SPA CLA								/A200
	JMP	PRBOTP	/WE HAVE INVADED TO OR PAST THE WHOLE FOOTER	/A200

/NOW PRINT THE FOOTER IF THERE IS ROOM.

	TAD	PRQBMG	/GET THE BOTTOM MARGIN
	SNA CLA		/THERE IS ROOM FOR SOMETHING IF THE BM IS NONZERO
	JMP	PRBOTP	/NO ROOM, GO TO BOTTOM OF PAGE PROCESSING

	JMS	PROV	/LOAD THE OVERLAY				/A185
		OBPRSV	/CONTAINING PRSAVE				/A185
	JMS	PRSAVE	/SAVE THE CURRENT TEXT LOCATION

	JMS	PROV	/LOAD THE OVERLAY				/A185
		OBREST	/CONTAINING OBREST				/A185
	AC7777
	JMS	PRREST	/RESTORE THE FOOTER TEXT POSITION

/ DETERMINE IF WE MUST STRIP AWAY ANY OF THE FOOTER

	TAD	GSTMP1	/ IF SO, THE AMOUNT WE MOVED TO GET TO
			/ THE TOP OF FOOTER WILL BE ZERO OR NEGATIVE
/D214	SMA SZA CLA
/D253	SMA CLA							/C214
	SMA SZA CLA						/C253
	JMP	TOPFL3	/ THERE IS ENOUGH ROOM FOR ALL OF THE FOOTER

/ ESTABLISH HOW MUCH TO WHITTLE OFF FOOTER

	TAD	PRRLSZ	/GET LINE SIZE IN PRINT UNITS
	CIA		/NEGATE
	TAD	GSTMP1	/MAKE GSTMP1 MORE NEGATIVE
	DCA	GSTMP1
	TAD	PRRLSZ	/GET LINE SIZE					/C200
	JMS	PRMOVE	/MOVE AHEAD TO NEXT LINE

TOPFL2,
	TAD	GSTMP1	/GET NEGATIVE OF EXCESS FOOTER
	SMA CLA
	JMP	TOPFL3	/THERE IS ROOM NOW--LEAVE THE LOOP

/WE MUST TAKE AWAY THE FIRST LINE OF THE FOOTER AND TRY AGAIN.

	JMS	PRHIGS	/STRIP THE FIRST LINE OF THE FOOTER
		NOP	/WON'T FIND EOC
	TAD	PRLLSZ	/GET THE SIZE OF THE LINE WE STRIPPED
	TAD	GSTMP1	/ADJUST NEGATIVE OF EXCESS
	DCA	GSTMP1
	JMP	TOPFL2	/KEEP STRIPPING THE FOOTER

/THE FOOTER NOW FITS.

TOPFL3,
	TAD	PRQPSZ	/USE THE PAGE SIZE
	DCA	PRGSMX	/AS MAXIMUM ATTAINABLE VERTICAL POSITION

	JMP	PRGSL1	/CONTINUE TO DO MORE SPACING

GSTMP1,	0		/A TEMP FOR FOOTER ROUTINE

/THIS SECTION HANDLES BOTTOM OF FOOTER PROCESSING.

OVBOTF=.-OVRLCA
OBBOTF=OVTYPE+OVNUM

	JMS	PROV	/LOAD THE OVERLAY				/A185
		OBREST	/CONTAINING PRREST				/A185
	JMS	PRREST	/RESTORE THE REGULAR TEXT


/THIS SECTION HANDLES THE BOTTOM OF THE PAGE.

PRBOTP,
	TAD	PRQPNT		/GET DOCUMENT DESTINATION		/A247
	TAD	(-DHOST2)	/					/A247
	SZA CLA			/SKIP IF A REAL HOST			/A247
	JMP	PRBOT1		/NOT DD CHST, DO NORMAL STUFF		/A247

/ FOR DD CHST WE OUT A FORM FEED AND SKIP THE EXTRA LINE FEEDS		/A247
/ WE MUST ALSO RETURN THE CARRIAGE					/A253
/ AND/OR THE EJECT							/A247

	TAD	(CR)		/LOAD CARRIAGE RETURN CODE		/A253
	JMS	PRCHAR		/SEND IT OUT				/A253
	TAD	(FF)		/LOAD FORM FEED CODE			/A247
	JMS	PRCHAR		/SEND IT OUT				/A247
	JMP	BOTPL2		/CONTINUE BELOW				/A247

PRBOT1,		/ CONTINUE HERE IF NOT DD CHST				/A247

/FIND VERTICAL POSITION MOD PAGE SIZE AND MOVE TO THE NEXT PAGE BOUNDARY.
/THIS IS NECESSARY IF WE WERE DOING AP NO AND THERE WERE NO PAGE 	/A159
/MARKERS OR NEW PAGE COMMANDS						/A159

/D214	TAD	PRGSAP	/GET NEGATIVE OF ABSOLUTE VERTICAL POSITION
	TAD	PRGSVP	/GET NEGATIVE OF ABSOLUTE VERTICAL POSITION	/C214
	SNA		/WE MAY ALREADY BE AT THE TOP OF THE PAGE	/A159
	JMP	BOTPL2	/IN THAT CASE DON'T INSERT A BLANK PAGE		/A159
	CIA

BOTPL1,
	TAD	PRQPSZ	/ADD THE PAGE SIZE UNTIL THE POSITION BECOMES
			/POSITIVE AGAIN
	SPA		/LEAVE LOOP WHEN VALUE GOES POSITIVE
	JMP	BOTPL1	/CONTINUE THE LOOP

/THE VALUE IN THE AC IS (PAGE SIZE) MINUS (VERTICAL POSITION MOD PAGE SIZE).
/THIS IS THE AMOUNT WE WANT TO MOVE.

	JMS	PRMOVE	/DO THE MOVE
	JMS	PRFMOV	/FORCE THE MOVE

/NOW SEE IF THE USER HAS REQUESTED THAT PRINTING STOP AT THE END OF THE PAGE.

BOTPL2,			/						/A159
	TAD	PRSTNX	/GET THE STOP AFTER NEXT FLAG
	SNA CLA
	JMP	BOTPL3	/NO STOP REQUESTED

/THE STOP WAS REQUESTED.  INVOKE THE STOP PROCESSING OVERLAY.

	DCA	PRSTNX	/ Clear flag so don't stop next time thru!!!	/A073
	TAD	(5)	/SET THE STOP STATUS
	JMS	STSTTS	/ SET THE STOP STATUS.				/A056
	TAD   (OVSTP1)	/CONTINUE WITH THE STOP OVERLAY
	JMS	PROV
		OBSTP1

OVBPL3=.-OVRLCA		/CONTROL RESUMES HERE AFTER THE USER ACTION
OBBPL3=OVTYPE+OVNUM

BOTPL3,
	ISZ	PRPGNM	/INCREMENT THE PAGE NUMBER
	JMP	BOTPL4	/NO OVERFLOW					/C156
	AC7777		/OVERFLOW, LOCK AT MAX				/A156
	DCA	PRPGNM	/						/A156
BOTPL4,	ISZ	PRPCNT	/INCREMENT THE PAGE COUNT
	NOP		/(IN CASE IT OVERFLOWS)
									/A087
/IF WE ARE AT THE END OF THE FILE, JUMP TO THE NEW COPY CODE.		/A087
									/A087
	TAD	PREOF	/ARE WE AT THE END OF THE FILE?			/A087
	SNA CLA		/ SKIP IF YES.					/A087
	JMP	PRTOPP	/NO--CONTINUE WITH TOP OF PAGE PROCESSING	/A087
									/A087
/IF WE ARE PRINTING EVEN PAGES ONLY AND THE LAST PAGE PRINTED		/A260
/WAS A SKIPPED ODD PAGE, THEN WE NEED TO FEED AN EXTRA BLANK PAGE	/A260

	AC0004			/LOAD A MASK FOR PRINTING EVEN		/A260
	AND	PRQSP		/LOOK AT PRINT MENU SELECTION		/A260
	SNA CLA			/					/A260
	JMP	BOTPL5		/NOT PRINTING EVEN			/A260
	DCA	PRYES		/ENABLE PRINTING			/A260
	TAD	PRPGNM		/GET PAGE NUMBER			/A260
	RAR			/PUT ODD/EVEN BIT IN LINK		/A260
	SNL CLA			/					/A260
	TAD	(FF)		/LOAD A (FF OR A (NULL			/A260
	JMS	PRCHAR		/OUTPUT IT				/A260

BOTPL5,	TAD   (OVNCPY)	/CONTINUE WITH THE NEW COPY CODE		/A087
	JMS	PROV							/A087
		OBNCPY
/--------------------
PAGE

OVTYPE=OLB
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM


/THIS SECTION IS INVOKED WHEN A DOCUMENT HAS COMPLETED PRINTING AND A NEW
/ONE MUST BE TAKEN FROM THE QUEUE.

OVDONE=.-OVRLCA
OBDONE=OVTYPE+OVNUM

	DCA	PRYES	/RESET THE PRINT INHIBIT FLAG

			/RESET ALL CHARACTER ENHANCEMENTS	/A114	/C165
	JMS	PRESCS	/IN CASE THE NEXT PRINTER ACTIVITY IS 		/A114
		PCBOLD	/FROM ANOTHER SOURCE, SUCH AS CX, PRINT SCREEN	/A114
			/OR LIST PROCESSING				/A114


/SET THE WORD AND CHARACTER SPACE SIZES BACK TO THE DEFAULT PITCH IN CASE
/COMM USES THE PRINTER.  THIS SECTION IS SKIPPED IF PRINTING WAS STOPPED
/DUE TO A NON-EXISTENT PRINTER OR AN IN-USE COMM LINE.

	JMS	SKIPIF		/ SKIP IF				/A209
		LQPSE		/ LQPSE					/A209
	JMP	DONCL1	/   JMP TO LEAVE IT (FOR LQP02).		/A085
	TAD	PLNRCS							/M085
	JMS	PRESCS	/SET CHARACTER SPACE SIZE TO CURRENT PITCH
		PCCSIZ

	JMS	PRESCS	/SET WORD SPACE SIZE TO CURRENT PITCH
		PCWSIZ
		CLA
DONCL1,

/I DON'T THINK THE NEXT SECTION IS STILL NECESSARY			/A226
/I THINK IT IS A HOLDOVER FROM THE DAYS WHEN WE DIDN'T WAIT BETWEEN	/A226
/DOCUMENTS, THUS IT IS BEING DELETED:					/A226
/D226 /This sections sends out a dummy move command to the printer since when
/D226 /a restore is done for the next document the last move command is lost

/D226	JMS	PRESCS		/MOVE 0 VERTICAL LINES			/A017
/D226		PCMPUP							/A017

/D226	JMS	PRESCS	/FORCE ALL VECTICAL MOVEMENT			/A017
/D226		PCMFV							/A017

/ THIS SECTION WAITS FOR THE HANDLER TO FINISH. 			/C088
/  IF PRSTOP COMES ON BEFORE THE HANDLER FINISHES GO TO STOP OVERLAY	/C088
/  IF HANDLER FINISHES WITHOUT ERROR THEN START A TIMER SO THAT		/C088
/  THE NEXT OVPID REQUEST WILL NOT TIME OUT PREMATURELY			/C088
/									/A059
/ THE FOLLOWING SECTION IS PENCILLED IN AS AN IMPROVEMENT WHEN	/A210
/ DD IS HOST.  WE NEED TO CHECK THE HOST HANDLER, NOT THE LPTOU		/A210
/ HANDLER IN THAT CASE.  WE WILL ALSO NEED TO CHECK THAT WE CAN		/A210
/ RESET THE HS2OU HANDLER IF WE KILL THE DOCUMENT			/A210
/A210	TAD	PRQPNT		/ SEE IF WE ARE PRINTING TO HOST	/A210
/A210	TAD	(-DHOST		/ IF SO WE MUST CHECK A DIFFERENT	/A210
/A213	SZA			/ HANDLER				/A213
/A213	TAD	(-DHOST2+DHOST)	/					/A213
/A210	SZA CLA			/					/A210
/A210	TAD	(LPDNFG-CMDNFG)	/					/A210
/A210	TAD	(CMDNFG)	/					/A210
/A210	DCA	DNFGPT		/ SAVE IN POINTER LOCATION		/A210

DONE0A,
	TAD	PRSTOP		/ SEE IF STOPPED			/A088
	SNA CLA			/ SKIP IF STOPPED			/A088
	JMP	DONE0L		/ NO, GO CHK LPDNFG			/A088
	TAD	(OVSTP2		/ GO TO ASF/USER STOP REQUEST		/A088
	JMS	PROV		/ OVERLAY				/A088
		OBSTP2

DONE0L,	CDFSYS			/ MAP SYS FIELD.			/A059
	TAD I	DNFGPT		/ SEE IF HANDLER FINISHED		/C210
	CDFMYF		/ MAP OUR FIELD.				/A059
	SMA SZA CLA	/ SKIP IF NOT (ZERO OR NEGATIVE)		/C088
	JMP	DONE0B	/ JMP IF HANDLER DONE.				/A059
	JMS	SQPINP	/ SEE IF ANY CHARACTERS COMING BACK		/A142
	CIFSYS		/  WAIT FOR A BIT.				/A059
	JWAIT		/  ...						/A059
	JMP	DONE0A	/    TRY AGAIN.					/A059

DNFGPT,	LPDNFG			/ POINTER TO PROPER DONE FLAG		/A210

OVDON0=.-OVRLCA								/A130
OBDON0=OVTYPE+OVNUM
DONE0B,			/						/A130
	TAD	PRQPNT		/ GET DOCUMENT DESTINATION		/A145
	TAD	(-DHOST		/ SEE IF HOST				/A145
	SZA			/ CHECK BOTH TYPES			/A213
	TAD	(DHOST-DHOST2)	/					/A213
	SNA CLA
	JMP	DONEX		/ YES, DON'T QUERY FOR ID		/A145
	JMS	IDTMMX		/ GET MAXIMUM DELAY TO WAIT		/A130
	JMS	IDSTTM		/ SET THE TIMER				/A130
	TAD	(OVPIDW		/ GO ID THE PRINTER AGAIN		/A130
	JMS	PROV		/ WHEN IT ANSWERS IT IS DONE		/A130
		OBPIDW




DONEX,									/A130

/ IF DD HOST THEN WE MUST DO SPECIAL CLEANUP				/A209
/ WAIT A SECOND UNTIL ANY CHARACTERS ARE FULLY ECHOED BY THE HOST	/A209

	CDFSYS								/A209
	TAD I	(TIMOUT)
	CDFMYF
	IAC
	IAC
	DCA	IDTMC		/ SAVE AS VALUE TO COMPARE AGAINST
	JMS	PROV		/ LOAD OVERLAY WITH IDCKTM ROUTINE
		OBCKTM
	JMS	IDCKTM		/ CHECK THE TIMER
	JMP	.-1		/ WAIT UNTIL IT IS DONE


/ AND RESET THE INPUT HANDLER CALL

	TAD	(LPTIN		/ RESET THE PRINTER INPUT CALL
	DCA	SQPNXT+1	/ SO THAT SQPINP LOOKS AT THE PRINTER PORT


/ IF WE WERE PRINTING TO A PRINTER, WE RETURN HERE AFTER WE
/ THINK WE HAVE DETERMINED THAT THE PRINTER IS FINISHED PRINTING
/ THIS DOCUMENT
OVDON1=.-OVRLCA
OBDON1=OVTYPE+OVNUM


	DCA	PRYES		/RESET THE PRINT INHIBIT FLAG

/ WE RESET THE PAGE SIZE WHICH ALSO REESTABLISHES THE TOP
/ OF FORMS REFERENCE.  THIS IS DUE TO THE FACT THAT OUR REVERSE
/ VERTICAL MOTION IS DONE ENTIRELY VIA PLU COMMANDS, WHICH THE
/ PRINTER MAY NOT TRACK.  ALSO, IN THE CASE OF THE LQP02, THE
/ RESET WHICH IS SENT TO DETERMINE WHEN IT IS DONE RESETS THE PAGE
/ SIZE, AND WE WANT TO SET IT BACK TO THE SIZE OF THE LAST DOCUMENT
/ PRINTED, INCASE THE CUSTOMER IS USING SPECIAL SIZED FORMS

	TAD	PRQPSZ		/ GET PAGE SIZE IN PRINT UNITS		/A212
	JMS	PRESCS		/ OUTPUT IT				/A212
		PCPSIZ		/					/A212
		CLA		/					/A212

	JMS	PRRSST		/ CONDITIONALLY RESET STATUS		/A170

/RELEASE CONTROL OF THE COMM LINE IF THE PRINTER CONTROLS IT.  THIS
/GIVES THE COMM CODE A TURN TO USE IT IF NECESSARY.

	AC7775
	CDFSYS		/CHANGE TO DATA FIELD OF SYSTEM
	TAD I (CMADSX)	/GET COMM LINE FLAG (EQUALS 3 IF PRINTER CONTROLS IT)
	SNA CLA
	DCA I (CMADSX)	/RELEASE IT IF PRINTER CONTROLS IT
	CDFMYF		/CHANGE FIELD BACK

/IF WE WERE LIST PROCESSING, WE MUST CLOSE THE EDITOR SO THAT LIST PROCESSING
/MAY TERMINATE.  THIS INVOLVES READING A CHARACTER FROM THE EDITOR WITH THE
/AC NON-ZERO AT THE TIME OF CALL.

	TAD	LPFLAG	/WERE WE PRINTING LIST PROCESSING?
	SNA CLA
	JMP	DONE2	/NO--SKIP THE CLOSING

	TAD	RDEDIT	/GET THE CIF TO THE EDITOR'S FIELD
	DCA	DONE1	/SAVE IT IN LINE

	AC7777		/SET THE AC TO FORCE A CLOSE
DONE1,	0		/THE CIF TO THE EDITOR'S FIELD
	JMS I	PRIRAD	/CLOSE THE FILE
	DCA	LPFLAG	/CLEAR THIS FLAG SO ONLY CLOSE ONCE		/A157
			/BEFORE THIS STRANGE THINGS WOULD HAPPEN	/A157
			/AFTER LIST PROCESSSING (V2.1 BUG 159)		/A157

/NOW, CLEAR THE DOCUMENT FROM THE BEGINNING OF THE QUEUE.  IF THERE IS NO
/DOCUMENT AT THE BEGINNING OF THE QUEUE, JUMP DIRECTLY TO THE WAIT LOOP.
/THIS CASE ARISES ONLY WHEN THE PRINTER IS INITIALLY INVOKED AT BOOT TIME.

DONE2,
	CDFQUE		/CHANGE TO THE QUEUE'S DATA FIELD
	TAD I (PQFRST)	/GET THE FIRST QUEUE ENTRY
	CDFMYF		/CHANGE BACK TO THIS FIELD
	SNA
	JMP	PRWAIT	/THERE IS NOTHING THERE--WAIT FOR SOMETHING
	DCA	T1	/SAVE THE ENTRY

	CDFQUE		/CHANGE TO THE QUEUE'S DATA FIELD
	DCA I	T1	/ZERO FILENO WORD
	ISZ	T1	/POINT TO FLINK WORD
	TAD I	T1	/GET THE FLINK WORD
	DCA I (PQFRST)	/MAKE IT THE HEAD OF THE QUEUE

	TAD I (PQFRST)	/SEE IF ANYTHING LEFT IN THE QUEUE
	CDFMYF
	SNA
	JMP	DONE3	/NO--RESET THE QUEUE
			/FALL THROUGH TO PULL THE DOC FROM THE QUEUE	/C209
GETDC,									/A118
	DCA	T1		/ SAVE FOR INDIRECT			/A118

/ IF NOT PRINTER BUSY OR PRINTER STOPPED SET PRINTER BUSY		/A134
	TAD	PRSTTS		/ CHECK PRINTER STATUS			/A134
	SNA CLA			/ SKIP IF STATUS IS NON-ZERO		/A134
	ISZ	PRSTTS		/ ELSE SET STATUS TO ONE (BUSY)		/A134

	TAD	(OVREMAP)	/ GO REMAP DOCUMENT DESTINATION		/A118
	JMS	PROV							/A118
		OBREMAP
/-------------------
	PAGE

/**********************************************************************/
/									/
/	CLQP01--CLEAR LQP01.  IF THE LQP01 IS THE ATTACHED PRINTER	/
/		IT MUST BE CAREFULLY RESET SO OTHER PRINTING TASKS	/
/		LIKE CX OR PRINT SCREEN WILL FEED PAPER IF A FORM	/
/		FEED IS ISSUED, AND AS A MATTER OF GENERAL PRACTICE	/
/									/
/		THE RESET MUST BE PRECEDED BY OTHER COMMANDS WHICH	/
/		INSURE THAT THE RESET WILL NOT OVERRIDE WHATEVER	/
/		HAS BEEN SENT BUT NOT PRINTED				/
/									/
/***********************************************************************/

CLQP01,	XX		/ RESET LQP01 IF THAT IS THE ATTACHED PRINTER	/A115
	TAD	CLQPFG	/ SEE IF WE HAVE ALREADY EXECUTED THIS ROUTINE	/A151
	SZA CLA								/A151
	JMP I	CLQP01	/ YES, ONCE IS ENOUGH				/A151
	ISZ	CLQPFG	/ SET THE FLAG					/A151
	JMS	SKIPIF
		LQPSE
	JMP I	CLQP01	/ NOT, JUST EXIT

	AC4000		/ LOAD CODE FOR MINUS ZERO
	JMS	PRESCS	/ ESCAPE THAT MANY
		PCMPUP	/ VERTICAL UNITS
		CLA	/ CLEAR THE 4000 WHICH GOT RETURNED
	JMS	PRESCS
		PCMFV	/ FORCE VERTICAL MOVEMENT
	JMS 	PRESCS
		PCREST	/ FINALLY SEND THE RESET
	JMP I	CLQP01	/ RETURN

CLQPFG,	0/ FLAG WHICH IS SET WHEN ROUTINE IS EXECUTED THE FIRST TIME	/A151
			/ AFTER PRINTING THIS WILL BE RESET WHEN THE	/A151
			/ OVERLAY IS RELOADED				/A151
			/ WHAT ABOUT CX MALFUNCTIONS?			/A151

/***********************************************************************/A124
/									/A124
/ THIS ROUTINE LOADS THE AC WITH THE MAXIMUM TIME DELAYS IN SECONDS	/A124
/ WHICH SHOULD BE ALLOWED FOR THE DOCUMENT TO FINISH PRINTING		/C130
/ BASED ON WHAT KIND OF							/A124
/ PRINTER WAS LAST CONNECTED AND WHETHER OR NOT IT HAD AN ASF.		/A124
/									/
/ REWRITTEN REV143							/
/***********************************************************************/


IDTMMX,	XX		/ MAXIMUM TIME DELAY THAT COULD BE IN EFFECT	/A130

	DCA	IDTTMP		/ CLEAR A TEMP
	TAD	LPONLN		/
	AND	(DPMSK)		/ SEE IF A DP IS ATTACHED		/C164
	SZA CLA
	JMP	IDTMDP		/ A DRAFT PRINTER			/A164
	ISZ	IDTTMP		/ NO, OFFSET NOW 1			/A164
	ISZ	IDTTMP		/ NO, OFFSET NOW 2
	TAD	LPONLN
	AND	(ASFMSK)	/ SEE IF AN ASF IS ATTACHED
	SZA CLA
	ISZ	IDTTMP		/ YES, OFFSET NOW 3
IDTMEX,	TAD	IDTTMP		/ GET OFFSET
	TAD	(IDTMTB		/ ADD DELAY TABLE BASE
	DCA	IDTTMP
	TAD I	IDTTMP		/ READ TABLE
	JMP I	IDTMMX		/ RETURN

IDTMDP,			/ A DRAFT PRINTER IS ATTACHED			/A164
	TAD	LPONLN		/ GET TYPE				/A164
	AND	(XRPMSK)	/ SEE IF LA50 OR LA100			/A164
	SZA CLA			/					/A164
	ISZ	IDTTMP		/ YES, BUMP OFFSET INTO TABLE		/A164
	JMP	IDTMEX		/ GO READ TABLE AND EXIT

IDTMTB, 14			/ LA12, LA34 OR LA120		/C151	/C183
	300			/ 192 SECONDS FOR LA50 OR LA100		/A164
	100			/ LQP WITH NO ASF			/C253
	140			/ LQP WITH ASF				/C253

IDTTMP,	0

/THE QUEUE IS EMPTY AND MUST BE RESET.

DONE3,

	DCA	PRFNO	/CLEAR FILE NUMBER

	TAD (PQFRST-1)	/RESET QUEUE WORDS
	CDFQUE
	DCA I (PQLAST)
	CDFMYF

/WE MUST CAUSE THE DISK HANDLER TO IGNORE ANY SAVED HOME BLOCK
/AS THE USER MAY REMOVE THE DISK.  WHEN WE READ THE NEXT FILE
/WE WANT TO GUARANTEE THAT THE DISK HANDLER READS THE HOME BLOCK FROM
/THE DISK, NOT ITS MEMORY

	JMS	RDFIO		/ CALL RDFIO				/A207
		4000		/ WITH CODE OF ZERO TO WRITE HOME BLK	/A207

	JMP	WAIT2A	/GO CLEANUP & RESET STATUS			/A119

/THIS LOOP WAITS FOR A DOCUMENT TO BE ENQUEUED.  THIS LOOP IS WHERE
/THE PRINTER SPENDS ITS TIME WHEN NO DOCUMENTS ARE BEING PRINTED.


	PRWAIT,

/IF THE USER ACTIVATES STOP PROCESSING (SUCH AS REQUESTING A NEW PAGE),
/HONOR THAT REQEST HERE.

WAIT1A,	TAD	PRACTN	/GET THE ACTION FLAG			/M021	/C158

/ IF A JOB NEEDS THE PRINTER FIELD, IT WILL SET PRACTN=7777		/A203
/ WE MUST GO JEXIT IN RESIDENT CODE IN THAT CASE			/A203
/ THE OTHER JOB CLOBBERS THE PRINTER FIELD, AND WHEN DONE		/A203
/ RELOADS THE PRINTER FIELD BY READING ONLY THE RESIDENT BLOCKS		/A203
/ BACK IN FROM THE DISK.  WHEN THE OTHER JOB DOES THE JSTRT		/A203
/ WE WILL START IN RESIDENT CODE AND EVERYTHING WILL BE COOL		/A203
	SPA 			/ SKIP IF NORMAL ACTION			/A203
	JMP	WAITJ1		/ GO CLEANUP AND JEXIT IN RESIDENT	/A203

	SNA								/C158
	JMP	WAIT2	/NO ACTION REQUESTED--IGNORE
	TAD	(-1)	/SEE IF A NEW PAGE IS REQUESTED (PRACTN=1)
	SZA								/A118
	JMP	WAIT4	/NO, GO SEE IF ACTION WAS ABORT			/A118
				/ THIS ACTION COULD OCCUR IF THE STOP	/A118
				/ MENU IS ENTERED AS A RESULT OF AN	/A118
				/ ERROR THAT OCCURED FROM A CX USING	/A118
				/ PRINTER, OR A TASK OTHER THAN THE	/A118
				/ PRINTER JOB USING THE PRINTER		/A118

	TAD	PRQPNT		/ SEE IF LAST DOCUMENT WENT TO HOST	/A145
	TAD	(-DHOST)	/ THE HOST COULD HAVE A DUMB DRAFT	/A145
	SZA			/ CHECK BOTH TYPES			/A213
	TAD	(DHOST-DHOST2)	/					/A213
	SNA CLA			/ PRINTER ATTACHED, IN WHICH CASE	/A145
				/ WE WANT TO LEAVE THE HANDLER ALONE	/A145
				/ AND SKIP THE PRINTER ID		/A145
	JMP	WAIT2B		/ AND THE ASF CHECK			/A145

	JMS I	PRTID		/ POLL FOR PRINTER ID			/C231
/D145	TAD	(LPTOU)		/ RESET OUTPUT ROUTINE TO PRINTER	/A078
/D145	DCA	PRCHR3		/ (INCASE LAST DOC WENT TO HOST).	/A078

	/SEND AN EJECT IF AN ASF IS ATTACHED				/A109
	JMS	SKIPIF		/ SEE IF A SHEET FEEDER IS ATTACHED	/C213
		ASFMSK		/					/C213
	JMP	WAIT2B		/ NONE, GO ROLLUP CONTINUOUS FORM	/C109

	JMS	PRESCS		/ AC=0000 SO SEND EJECT SEQUENCE	/A009
		PCTRAY							/A009
	JMP	WAIT2A		/ SKIP THE ROLLUP			/A109


WAIT2B,			/ ROLLUP CONTINUOUS FORM			/A109

	TAD	PRQPSZ	/DO A NEW PAGE					/M069
	JMS	PRMOVE
	JMS	PRFMOV	/FORCE THE MOVE


/D199	WAIT2,	/ JMP HERE IF PRSTOP AND NO PRACTN OR ENTER FROM ABOVE	/A127
	AC7777		/CAN'T HANDLE ANY OTHER REQUEST--SIGNAL THAT
			/THROUGH PRACTV
	OVWAIT=.-OVRLCA		/ ENTRY POINT WHEN WAKEUP		/A203
	OBWAIT=OVTYPE+OVNUM	/					/A203
WAIT2A,	/ JMP HERE IF NO MORE DOC'S IN QUEUE				/A127
	/ JMP HERE FROM WAIT1B ABOVE IF SKIP ROLLUP			/A127
	/ ALSO ENTER HERE WHEN WAKEUP					/A203
			/SET PRACTV TO 7777 IF FALL THROUGH		/A203
			/TO SIGNAL NO HELP POSSIBLE			/A203
	DCA	PRACTV	/CLEAR USER ARGUMENT--OR SIGNAL NO HELP POSSIBLE
	DCA	PRSTOP	/CLEAR STOP FLAG
	DCA	PRACTN	/CLEAR USER ACTION
	DCA	PABORT	/CLEAR ABORT FLAG

/SET THE PRINTER STATUS BACK TO NOT PRINTING.
	JMS	PRRSST		/ CONDITIONALLY RESET STATUS		/A170

		/ MOVED JMS CLQP01 HERE ON REV127			/A019
		/ SO THAT THE LQPSE WILL BE RESET IF STOP MENU IS 	/A127
		/ ENTERED AFTER A CX ERROR AND CX WILL FEED PAPER 	/A127
		/ THE NEXT TIME IT IS ENTERED				/A127
	JMS	CLQP01	/ GO CHECK IF LQP01. IF SO, SEND IT A RESET SEQ	/A115
			/ THIS IS SO OTHER JOBS (PRINT SCREEN, CX, ETC)	/A115
			/ WILL FEED PAPER IF AN ASF IS ATTACHED		/A115


WAIT2,		/ HERE IF NO ACTION (DON'T JMS PRRSST ANYMORE)		/A199
	CDFQUE		/CHANGE TO THE USER'S FIELD			/A019
	TAD I (PQFRST)	/IS ANYTHING QUEUED?				/A019
	CDFMYF		/CHANGE BACK TO THIS FIELD			/A019
	SZA								/A019
	JMP	GETDC	/YES--JUMP TO PRINT IT				/A118
WAITEX,									/A118
/D148	JEXIT			/ EXIT THE PRINTER JOB			/A118
	CIFSYS			/					/A118
	JWAIT			/					/A118
	JMS	SQPINP		/ SEE IF AN CHARACTERS HAVE COME IN	/A148
	JMP	WAIT1A		/ GO SEE WHAT TO DO

WAIT4,	TAD	(-1)		/ SEE IF ACTION WAS ABORT		/A118
	SZA CLA			/ YES, GO TO STOP OVERLAY		/A118
	JMP	WAIT4A		/ GO CLEAR ACTION BUT NOT PRSTOP	/A118
	TAD	(OVSTP2)	/					/A118
	JMS	PROV		/					/A118
		OBSTP2

WAIT4A,	DCA 	PRACTN		/ CLEAR ACTION				/A118
	JMP	WAITEX		/ GO AWAIT FURTHER INSTRUCTIONS		/A118

WAITJ1,				/ CLEANUP AND GO JEXIT IN RESIDENT	/A203
	TAD	(OVPRJX+1	/ WE KNOW AC=7777			/C213
	JMS	PROV		/ FIRST DO SOME STUFF IN OVLY		/A203
		OBPRJX		/					/A203
/---------------------
	PAGE

OVTYPE=OLA
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM



/A NEW DOCUMENT HAS BEEN SELECTED FROM THE QUEUE TO PRINT.  THIS SECTION
/MODIFIES SEVERAL OF THE MENU SETTINGS COPIED FROM THE HEADER BLOCK INTO
/A FORM USABLE BY THE SPOOLER.

OVNDOC=.-OVRLCA
OBNDOC=OVTYPE+OVNUM

/IF WE ARE PRINTING TO A LETTER QUALITY PRINTER ( SQ1, SQ2) WE
/NOW THE TWO WHEEL SETTING IS ADJUSTED IF SET.

	TAD	LPONLN	/ARE WE PRINTINT TO AN LQP?			/A143
	SPA CLA		/SKIP IF NOT WHICH RESULTS IN PRQ2W=0		/A143
	TAD	PRQ2W	/SEE IF IN 2 WHEEL MODE
	SZA CLA
	TAD	PRQCPY	/IF SO MAKE EQUAL TO MINUS NUMBER OF COPIES
	CIA
	DCA	PRQ2W

/IF PROPORTIONAL PITCH IS SPECIFIED AND WE ARE PRINTING TO AN LQP02	/A195
/WE WILL SELECT TABLE 2.  OTHERWISE FOR THE LQP02 WE WILL SELECT TABLE 1/A195

	JMS	SKIPIF							/A195
		LQP02							/A195
	JMP	NDOCL0		/ NOT LQP02				/A195
	TAD	PRQPIT		/ SEE IF PROPORTIONAL (PRQPIT=0)	/A195
	SNA CLA			/					/A195
	AC0002			/ ...YES				/A195
	JMS	PRESCS		/ SELECT EITHER TABLE 1 (0) OR 2 (2)	/A195
		PCTABL		/					/A195
	CLA			/					/A195

NDOCL0,				/					/A195

/IF PROPORTIONAL PITCH IS SPECIFIED (PRQPIT=0),
/THE PITCH IS SET TO 12.

	TAD	PRQPIT	/IS PROPORTIONAL PITCH SPECIFIED?
	SNA CLA
	JMP	NDOCL3	/YES--JUMP TO SET THE PITCH TO 12.

/THE PITCH SET IN THE MENU IS CHARACTERS/INCH.  THE FOLLOWING LOOP SETS THE
/PITCH TO UNITS/CHARACTER.  THERE ARE 120 UNITS/INCH.  DIVIDING BY
/CHARACTERS/INCH YIELDS UNITS/CHARACTER.

	DCA	T1	/CLEAR THE PITCH COUNTER
	
DECIMAL
	TAD	(-240)	/INITIALIZE THE AC
OCTAL

/THIS LOOP DIVIDES THE MENU SETTING INTO 240, ROUNDING UP ANY REMAINDER.
	
NDOCL1,
	TAD	PRQPIT	/ADD THE MENU SETTING
	ISZ	T1	/INCREMENT THE PITCH COUNTER
	SPA		/SKIP IF THE DIVISION IS COMPLETE
	JMP	NDOCL1	/CONTINUE THE LOOP

/TWICE THE PITCH VALUE IS IN T1.  DIVIDE BY T1 AND USE THAT VALUE TO SET
/THE PITCH.

	CLA
	TAD	T1	/GET THE CALCULATED VALUE
	CLL RAR		/DIVIDE BY TWO
	JMP	NDOCL4	/JUMP TO SET THE PITCH

NDOCL3,	TAD	(12)	/PITCH FOR PROPORTIONAL PRINTING

NDOCL4,	DCA	PLNRCS	/SAVE THE CHARACTER SIZE


/WE CALCULATE THE SIZE OF THE LEFT MARGIN IN CHARACTER UNITS.

	TAD	PRQIND	/GET NUMBER OF COLS TO INDENT FROM PRINT MENU
	JMS	PRMULT	/MULTIPLE BY
		PLNRCS	/THE SIZE OF A COLUMN IN PRINT UNITS

	DCA	PRQINU	/SAVE SIZE OF INDENT IN PRINT UNITS

/NOW WE CALCULATE THE SIZE OF THE PAGE, TOP MARGIN, BOTTOM MARGIN, AND
/EXTRA LINE SPACING IN TERMS OF PRINT UNITS.

	TAD   (PRNLSZ)
	JMS	PRMULT	/THE SIZE OF THE TOP MARGIN
		PRQTMG

	DCA	PRQTMG	/SAVE IT AWAY

	TAD   (PRNLSZ)
	JMS	PRMULT	/THE SIZE OF THE BOTTOM MARGIN
		PRQBMG

	DCA	PRQBMG	/SAVE IT AWAY

	TAD    (PRNHL)
	JMS	PRMULT	/THE AMOUNT OF EXTRA SPACING
		PRQLSZ

	DCA	PRQLSZ	/SAVE IT AWAY

	TAD   (PRNLSZ)
	JMS	PRMULT	/THE SIZE OF THE PAGE
		PRQTMP							/M074

	JMS	PRESCS	/TRANSMIT THE PAGE SIZE
		PCPSIZ

	DCA	PRQPSZ	/SAVE IT AWAY

/THE SUBSTITUTION CHARACTERS ARE SET UP TO FACILITATE COMPARISON IN	/002
/PRINT OVERLAY, WHICH IS TIGHT ON SPACE.  IN PARTICULAR:   		/002
/PRQSB1 = NEGATIVE OF FIRST CHARACTER					/002
/PRQSB2 = FIRST CHARACTER MINUS SECOND CHARACTER			/002

	TAD	PRQSB2	/SUBTRACT THE SECOND CHARACTER			/002
	CIA								/002
	TAD	PRQSB1	/FROM THE FIRST CHARACTER			/002
	DCA	PRQSB2	/AND REPRESENT AS SECOND CHARACTER		/002

	TAD	PRQSB1	/NEGATE THE FIRST CHARACTER			/002
	CIA								/002
	DCA	PRQSB1	/AND REPRESENT AS FIRST CHARACTER		/002


	DCA	PRRSRT	/CLEAR THE RESTART LOCATION

/	JMP	NCPYL0	/CONTINUE WITH THE NEW COPY CODE
OVNCPY=.-OVRLCA
OBNCPY=OVTYPE+OVNUM

/ THIS SECTION IS INVOKED TO PRINT THE NEXT COPY OF THE QUEUED DOCUMENT.
/ IF ANY MORE COPIES ARE CALLED FOR, THEY ARE PRINTED.  IF NONE ARE CALLED
/ FOR, THE DONE OVERLAY IS INVOKED TO GET A NEW DOCUMENT FROM THE QUEUE.

NCPYL0,
	TAD	PRQSSM		/ SAVE SE MENU SETTING			/C177
	DCA	PRQSSS		/ IN CURRENT SE SETTING			/C177
	DCA	P2PSET		/ SAY LQP02 WHEEL NOT SELECTED YET.	/A084
	DCA	PRYES		/ RESET THE PRINT INHIBIT FLAG

/SEE IF THERE ARE ANY MORE COPIES TO BE PRINTED.

	TAD	PRQCPY		/ ANY MORE COPIES?
	SZA CLA
	JMP	NCPYL4		/ YES--PRINT THEM

/ EVEN IF THERE ARE NO MORE COPIES TO PRINT, IT MAY BE TIME TO DO THE SECOND
/ PASS FOR TWO-WHEEL PRINTING.  THIS SECTION INVESTIGATES THAT POSSIBILITY.

	TAD	PRQ2W		/ GET THE TWO-WHEEL FLAG
	SZA CLA			/ TEST FOR PRQ2W=0		/140 ADDED CLA
	JMP	NCPYL3
NCPYTX,			/TWO WHEEL EXIT CODE JOINS HERE			/A140
	DCA	PRQ2W		/ HARMLESS FROM ABOVE BUT NEEDED WHEN JOIN/A140
	TAD   (OVDONE)		/ NO SECOND PASS NEEDED--GET A NEW DOCUMENT
	JMS	PROV
		OBDONE

/WE NOW CONTINUE BY WAITING FOR THE PRINT WHEEL CHANGE.
/IF WE ARE PRINTING TO A CUT SHEET FEEDER, SEND AN EJECT.		/A048
/									/A048
NCPYL3,									/A140
	TAD	LPONLN							/A143
	AND	(ASFMSK)						/A143
	SNA CLA		/ SKIP IF AN ASF PRESENT			/A048
	JMP	NCPY3A	/Not present--do not send escape sequence	/A048
	JMS	PRESCS	/ SEND A BDT EJECT (BUT NO TRAY SELECT)		/A048
		PCTRAY							/A048
NCPY3A,	AC0006
	JMS	STSTTS	/ SET THE STOP STATUS TO TWO-WHEEL WAIT.	/M056
	TAD   (OVSTP1)	/JUMP TO THE STOP OVERLAY TO DO THE WAIT
	JMS	PROV
		OBSTP1

/WHEN THE USER CHANGES THE PRINT WHEEL AND SO INDICATES BY TYPING "R,"
/CONTROL RETURNS HERE							/A140

OVRTW=.-OVRLCA	/RESUME FROM A TW STOP					/A140
OBRTW=OVTYPE+OVNUM
/WE HAVE TWO ACTIONS TO TAKE DEPENDING ON WHETHER PRQ2W IS POSITIVE	/A140
/   OR NEGATIVE.

/IF PRQ2W<0, WE MUST DO A SECOND PASS.  SINCE PRQ2W IS THE NEGATIVE OF
/     THE NUMBER OF COPIES, IT IS NEGATED AND STORED IN PRQCPY.  PRQ2W
/     IS MADE POSITIVE TO INDICATE SECOND PASS.

/IF PRQ2W>0, WE ARE THROUGH WITH THE SECOND PASS.  PRQ2W IS CLEARED, AND
/     WE CONTINUE BY RETURNING TO THE DONE OVERLAY			/C140

	TAD	PRQ2W	/GET TWO WHEEL FLAG				/A140
	SMA		/DETERMINE THE SIGN OF PRQ2W
	JMP	NCPYTX	/GO RESET PRQTW AND GO TO DONE OVLY		/A140
	CIA		/IF PRQ2W>0, AC=0
			/IF PRQ2W<0, AC=NUMBER OF COPIES TO MAKE
	
	DCA	PRQCPY	/PRQCPY IS SET TO THE PROPER NUMBER IF PRQ2W<0;
			/REMAINS CLEARED IF PRQ2W>0

	TAD	PRQCPY
	DCA	PRQ2W	/IF PRQ2W>0, NOW PRQ2W=0
			/IF PRQ2W<0, NOW PRQ2W>0
	JMP	NCPYL4		/CONTINUE ON NEXT PAGE OF THIS OVERLAY
/-------------------
	PAGE
NCPYL4,
	DCA	PREOF	/ RESET E-O-F FLAG.				/A087

	AC7777
	TAD	PRQCPY	/DECREMENT THE COPY COUNT
	DCA	PRQCPY	

	AC0001
	DCA	PRMCAY	/INITIALIZE TO SHOW ONE COLUMN IN TEXT AREA

	DCA	PRGCBK	/RESET THE BACKUP LOCATION
	DCA	PRCCH	/RESET THE CARRIAGE LOCATION
	DCA	PRSTNX	/RESET STOP AFTER NEXT

	DCA	PRFLAG	/SET TO REGULAR TEXT PRINTING
	DCA	PRMCPC	/SHOW NO COLUMN PRINTING NOW
	DCA	PRHSIZ	/SET TO NO HEADER
	DCA	PRFSIZ	/SET TO NO FOOTER

/ IF WE ARE PRINTING TO A DRAFT PRINTER WE WANT TO SET THE		/A168
/ SETTINGS DIFFERENTLY							/A168

	TAD	LPONLN							/A168
	AND	(DPMSK)	/SEE IF A DRAFT PRINTER ATTACHED		/A168
	SNA CLA								/A168
	JMP	NCPY4A							/A168

/ SET THE PITCH TO A DRAFT PRINTER					/A168
/ SUPPORTED DRAFT PRINTERS ACCEPT PITCH COMMANDS AS FOLLOWS:		/A168
/	N	 LA34	LA50	LA100	LA120
/	0	10	10	10	10
/	1	10	10	10	10
/	2	12	12	12	12
/	3	13.2		13.2	13.2
/	4	16.5	16.5	16.5	16.5
/	5		5	5	5
/	6		6	6	6
/	7			6.6	6.6
/	8		8.25	8.25	8.25

	TAD	PRQPIT		/GET THE PITCH VALUE			/A168
	DECIMAL								/A168
	TAD	(-16)		/SEE IF 16.5 PITCH DESIRED		/A168
	SZA								/A168
	JMP	NCPY4B		/NO					/A168
	AC0004			/YES, SET AC TO 4			/A168
	JMP	NCPY4C		/GO SEND ESCAPE SEQUENCE		/A168
NCPY4B,	TAD	(16-10)							/A168
	SPA								/A168
	TAD	(10)		/RESTORE AC IF PITCH LESS THAN 10	/A168
	OCTAL								/A168

NCPY4C,			/SEND DRAFT PRINTER PITCH ESCAPE SEQUENCE	/A168
	JMS	PRESCS							/C173
		PCDPIT							/A173
	JMP	NCPY4D	/GO SKIP SPI AND CLEAR AC			/A245

NCPY4A,									/A168

	TAD 	PLNRCS							/A031
	JMS 	PRESCS	/SET CHARACTER SIZE				/A031
		PCCSIZ
NCPY4D,	CLA								/A060
	TAD	PRQINU	/GET THE INDENT VALUE
	JMS	PRESCS	/SET THE INDENT VALUE
		PCIND
	DCA	PRMCLM	/SET THE LEFT MARGIN TO THE INDENT VALUE

	TAD	PRQIND	/AND RESET THE LEFT MARGIN IN COLUMN UNITS	/A243
	DCA	PRMCMG	/RESET COLUMN UNITS FOR NEXT COPY		/A243

	TAD	LPONLN	/IF A HOST					/A214
	SZA CLA		/SKIP THE CARRIAGE RETURN			/A214
	TAD	(CR)	/SEND A CARRIAGE RETURN TO FORCE THE INDENT
	JMS	PRCHAR

	TAD	PRQPGO	/INITIALIZE THE PAGE NUMBER TO THE ORIGIN
	DCA	PRPGNM

	AC0001
	DCA	PRPCNT	/INITIALIZE THE PAGE COUNT TO ONE

	AC0001
	DCA	PRSCNM	/INITIALIZE THE SECTION NUMBER TO ONE

	JMS	CHFNRS	/RESET TO DEFAULT CHARACTER SETS AND FONTS

/NOW WE MUST DETERMINE WHETHER THE DOCUMENT IS COMING FROM THE FILE SYSTEM
/OR FROM THE EDITOR (IN CASE OF LIST PROCESSING) AND PATCH THE READ ROUTINE
/ACCORDINGLY.

	TAD	PRIRFD	/IS THIS LIST PROCESSING?
	SZA CLA
	JMP	NCPYL6	/YES--JUMP TO HANDLE IT

	DCA	LPFLAG	/CLEAR THE LIST PROCESSING FLAG TO SHOW REGULAR
			/PRINTING

	TAD   (RDFILE)	/SET THE FILE READING ROUTINE LINK
	DCA	RDCHAR

	TAD	PRFNO	/GET THE FILE NUMBER

/OPEN THE FILE FOR READING.

	JMS	RDINIT	/CALL THE INITIALIZATION ROUTINE
	JMP	PRTOPP	/DO TOP OF PAGE PROCESSING AND ENTER MAIN LOOP

/ GO HANDLE READING FOR LIST PROCESSING IN ANOTHER OVERLAY		/A168
NCPYL6,
	TAD	(OVNCP6
	JMS	PROV
		OBNCP6

OVCFRS=.-OVRLCA								/A226
OBCFRS=OVTYPE+OVNUM							/A226

CHFNRS,	XX		/RESET TO DEFAULT CHARACTER SET AND FONT

	JMS	SKIPIF		/DON'T EXECUTE CHFNRS IF		/A232
		LQPSE		/AN LQPSE IS ATTACHED			/A232
		SKP		/					/A232
	  JMP I	CHFNRS		/LQPSE, JUST RETURN			/A232

/ RESET TO THE DEFAULT CHRSET FOR THE USER'S COUNTRY			/C221
/ BY GETTING FORMAT WORD AND CONVERTING IT TO AN ASCII CHAR		/C221
/ WHICH IS THEN STORED FOR USE AS BOTH G0 AND G1 ESC SEQ TERMINATORS	/C221
/ THE VALUE OF MNLANG IS DETERMINED IN WP2CMF AND IS SET AS		/A221
/ FOLLOWS: 	UPPER BYTE    LOWER BYTE				/A221
/              SIXBIT LETTER  SIXBIT ZERO				/A221
/ THE IAC BSW IN THE FOLLOWING CODE WILL CONVERT THIS VALUE INTO	/A221
/ THE APPROPRIATE ASCII CODE FOR THE ESC SEQ DELIMITER TO SET THE	/A221
/ DEFAULT CHRSET FOR THE USER'S COUNTRY					/A221
/ *******************************************************************	/A221
/ *****  THIS ONLY WORKS IF THE VALUE IN MNLANG IS DEFINED THE  *****	/A221
/ *****    SAME WAY FOR ALL LANGUAGES AS IT IS NOW FOR US/UK    *****	/A221
/ *******************************************************************	/A221
	CDFMNU			/ CHANGE TO MENU FIELD			/A221
	TAD I	(MNLANG+MUBUF	/ GET FORMAT WORD			/A221
	CDFMYF			/ COME BACK				/A221
	IAC			/ ADD 1					/A221
	BSW			/ SWAP PLACES TO GET ASCII CHAR CODE	/A221
	TAD	(4000)							/A221
	DCA	PCHFNB		/ PUT IT IN G0 SPOT			/A179
/d270	TAD	PCHFNB		/ GET IT BACK				/A221
	TAD	(4060)		/ Get the line drawing set specifier	/a270
	DCA	PCHFBO		/ PUT IT IN G1 SPOT			/A179
	DCA	PRBIF		/ DISABLE BOLD INTERPRETATION		/A179
	TAD	(PCHFNB		/ GET THE ADDRESS OF THE FINAL SUBSTRING/C179
	JMS	PRESCS		/ SEND ESCAPE SEQUENCE
		PCSTG0		/ TO SPECIFY THE G0 SET
	CLA			/ Clear for next specifier		/a270
	TAD	(PCHFBO		/ Next specifier is in here		/a270
	JMS	PRESCS		/ SEND ESCAPE SEQUENCE			/A208
		PCSTG1		/ TO SPECIFY THE G1 SET			/A208
/		CLA		/ BE SURE AND CLEAR VALUE PRESCS RETURNS
	AC7777			/ SETUP PRBICS SO AS TO GUARANTEE	/A193
	DCA	PRBICS		/ THAT THE FIRST TIME THROUGH LPBI	/A193
	TAD	(SO+1)		/ SELECT G0 AT BEGINNING OF DOCUMENT	/A208
	JMS	PRCHAR		/ 					/A208
				/ EITHER AN SO OR SI WILL GET SENT	/A193
				/ AS APPROPRIATE			/A193

/ SET UP G2 AND G3 FOR OPERATION WITH TECHNICAL CHARACTER		/A223
/ DESIGN PHILOSOPHY:  G2 IS DEC MULTINATIONAL, G3 IS DEC TECHNICAL	/A223
	JMS	PRESCS		/ SET UP G2 AND G3			/A223
		PCTCSI		/ TECHNICAL CHR INIT G2 AND G3		/A223

/ WE RESET THE BOLD AND NONBOLD FONTS TO FONT 1 AND			/A173
/ SELECT FONT ONE							/A173

	AC0001								/A173
	DCA	PRBIFN		/ NORMAL FONT				/A173
	AC0001								/A173
	DCA	PRBIFB		/ BOLD FONT				/A173
	AC0001								/A173
	JMS	PRESCS							/A173
		PCSTFN		/ SELECT FONT				/A173
		CLA							/A173

	JMP I	CHFNRS		/ RETURN				/A226
/---------------
	PAGE

OVTYPE=OLC
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM


/THIS OVERLAY HANDLES THE PROCESSING WHEN THE PRINTER IS STOPPED.  THERE ARE
/MANY REASONS WHY THE PRINTER CAN BE STOPPED.  THESE REASONS, ALONG WITH THE
/CODE IDENTIFYING THE REASON IN PRSTTS, ARE:

/ 2 - THE USER REQUESTED THAT THE PRINTER STOP
/ 3 - STOPPED AT THE TOP OF A PAGE FOR "SE FIRST"
/ 4 - STOPPED AT THE TOP OF A PAGE FOR "SE YES"
/ 5 - STOPPED AT THE END OF A PAGE BECAUSE THE USER REQESTED THAT THE
/      PRINTER STOP AT THE END OF THE NEXT PAGE
/ 6 - STOPPED AT THE END OF A COPY BECAUSE TWO-WHEEL PROCESSING WAS IN
/      EFFECT AND IT IS TIME FOR THE PRINT WHEEL CHANGE
/ 7 - STOPPED BECAUSE THE DOCUMENT DESTINATION SPECIFIED BY THE USER IS
/      A NON-EXISTENT PRINTER
/10 - THE DOCUMENT DESTINATION DOES NOT MATCH THE ATTACHED PRINTER
/11 - PRTID RECEIVED AN ID BUT NO XON.  WE PRESUME THE PAUSE SWITCH
/	WAS ON.
/12 - STOPPED BECAUSE THE DOCUMENT DESTINATION SPECIFIED BY THE USER
/      REQUIRES THE USE OF A COMMUNICATION LINE WHICH IS ALREADY IN USE.
/13 - STOPPED BECAUSE OF A MALFUNCTION (FATAL ERROR).
/15 - THE PAUSE SWITCH IS ON
/16 - OUT OF RIBBON
/17 - SHEET FEEDER ERROR--LQP02
/20 - COVER OPEN
/21 - OUT OF PAPER
/22 - DOCUMENT DISK READ ERROR
/23 - SYSTEM DISK READ ERROR
/24 - SHEET FEEDER ERROR--LQPSE
/25 - LQPSE FATAL ERROR (CANCEL)
/26 - COMMUNICATIONS ERROR TO PRINTER					/A155

/THE USER HAS SEVERAL ACTION OPTIONS OPEN DEPENDING ON WHAT TYPE OF STOP
/WE HAVE.  ONE OR MORE OF THE FOLLOWING ACTIONS MAY BE ALLOWED DEPENDING
/ON THE STOP REASON.  WHICH ACTIONS ARE ALLOWED IS DETERMINED BY A TABLE
/IN WPCUT.

/-1. LIST THE DOCUMENTS IN THE PRINT QUEUE
/1.  MOVE THE PAPER TO THE NEXT PAGE BOUNDARY
/2.  ABORT PRINTING THE DOCUMENT
/3.  CONTINUE PRINTING TIL THE END OF THE PAGE
/4.  RESTART FROM THE BEGINNING OF THE CURRENT COPY
/5.  GO BACK N PAGES AND RESTART
/6.  CONTINUE PRINTING
/7.  CHANGE DOCUMENT DESTINATION (RESPONSE TO CODE 10 ONLY)

/THIS IS THE ENTRY POINT IF THE PRINTER IS STOPPED DUE TO USER REQUEST
/OR A CUT SHEET FEEDER ERROR.  IF AN ASF IS ATTACHED NO PAPER WILL BE
/FED AFTER A P OR R RESPONSE.


OVSTP2=.-OVRLCA
OBSTP2=OVTYPE+OVNUM


	DCA	T3	/ CLEAR FLAG USED BELOW				/A014
	JMS	PSCHSZ	/ GO RESET CHR SIZE				/A186


PRSTL0,			/ MAKE SURE WE DETECT  THE FOLLOWING:		/A133
			/ WE MUST ALWAYS COME BACK THIS FAR AND CHECK	/A133
			/ TO SEE IF THE STATUS HAS BECOME 1 (ERROR FIXED/A133
			/ IF SO WE WILL NEED USER ACTION TO CONTINUE THE/A133
			/ JOB, SO WE MUST CHANGE TO A USER STOP TO LET	/A133
			/ HIM KNOW.					/A133
			/ RELATED TO SL DOING A STOP FOR THE USER	/A133
	AC7777		/ IS THERE AN ERROR STATUS?			/A054
	TAD	PRSTTS	/ PRSTTS = 1 IF NO.				/A054
	SNA CLA		/ SKIP IF STATUS IS AN ERROR STATUS.		/A054
	ISZ	PRSTTS	/ SET STATUS FROM 1 TO 2 FOR USER REQUESTED STOP/A054
/D133	JMP	PRSTL2	/ ENTER THE DISPATCH LOOP
	JMP	PRSTL1	/ INCLUDE THE JWAIT				/A133

/THIS IS THE ENTRY POINT IF THE SPOOLER STOPS THE PRINT JOB DUE TO REASONS
/3, 4, 5, 6, 7, OR 12, OR IF THE SPOOLER DETECTS AN ERROR BEFORE THE
/DOCUMENT FINISHES PRINTING.
/IF WE ARE STOPPED OF SE FIRST AND IF AN ASF IS ATTACHED A NEW SHEET
/OF PAPER WILL BE FED AFTER AN R OR P RESPONSE.


OVSTP1=.-OVRLCA
OBSTP1=OVTYPE+OVNUM


	AC7777
	DCA	PRSTOP	/SET THE STOP FLAG TO INDICATE THAT THE SPOOLER
			/STOPPED THE JOB

	JMS	PSCHSZ	/ GO RESET CHR SIZE				/A186

	JMP	PRSTL2	/ENTER THE DISPATCH LOOP


/THIS LOOP WAITS UNTIL THE USER SPECIFIES AN ACTION TO THE STOP MENU, AND
/THEN BRANCHES TO TAKE CARE OF THE ACTION.  SOME ACTIONS ARE NOT VALID FOR
/CERTAIN STOP REASONS.  THESE ARE IGNORED IF THEY ARE ASSERTED.

PRSTL1,
	JMS	SQPINP	/ SEE IF ANY CHARACTERS COMING BACK		/A142
	CIFSYS
	JWAIT

PRSTL2,
/ CODE WHICH CHECKED FOR VALIDITY OF STOP ACTIONS DELETED		/A121
/ THESE FUNCTIONS ARE NOW DONE BY WPCUT AND MN1				/A121

/ PABORT MAY BE SET BY
/  1.  WPCUT IF A STOP ACTION WAS SPECIFIED AND THE STOP FLAG DID	/A191
/	NOT CLEAR WITHIN A REASONABLE TIME.  SETTING THE ABORT FLAG	/A191
/	MAY GET THE SPOOLER OUT OF THE PRLOOP BY DISCARDING CHARACTERS	/A191
/	TO THE END OF THE LINE, SO THE STOP FLAG CAN BE SEEN AND THE	/A191
/	STOP OVERLAY WILL THEN BE REACHED.  SUCH A CONDITION IS TYPICAL	/A191
/	OF A PRINTER WHICH DOES NOT REPORT ERRORS SUCH AS THE LA100	/A191
/									/A191
/	THE PROBLEM IS WORSE IN LIST PROCESSING SINCE THE PRINTER	/A191
/	STATUS MESSAGE DOES NOT APPEAR ON THE SCREEN			/A191
/									/A191
/  2.	WPEDOV IN LIST PROCESSING IF GOLD HALT IS HIT			/A191

	TAD	PABORT	/IS ABORT FLAG SET? HAS HANDLER ABORTED?	/M031
	SMA CLA		/ABORT IS SET FOR FATAL ERROR			/M044
	JMP	PRSTL5	/NOT NEGATIVE, CONTINUE
	TAD	(13)	/SET PRINTER STATUS FOR FATAL ERROR		/M031
	DCA	PRSTTS	/   FATAL ERROR DISPLAYED AS MALFUNCTION	/M031
	TAD	LPONLN	/GET TYPE OF PRINTER				/A088
	AND	(LQPSE)	/SEE IF LQPSE
	CIA								/A143
	TAD	(LQPSE)							/A143
	SNA CLA		/SKIP IF NOT LQP01				/A088
	JMP	PRSTL5	/IS LQP01					/A088

/ MORE VALIDITY CHECKS DELETED HERE					/A121

	AC7776		/SEE IF THE USER SPECIFIED ACTION		/C088
	TAD	PRACTN	/IS ABORT					/C088
	SZA CLA
PRST4A,									/A103
	DCA	PRACTN	/NO--CLEAR THE USER ACTION AS IT IS INVALID

/AT THIS POINT, ANY INVALID USER ACTION HAS BEEN CLEARED.  WE NOW USE
/THE DISPATCH TABLE TO BRANCH TO THE ROUTINE WHICH HANDLES THE SPECIFIED
/ACTION.
PRSTL5,			/ PREPARE FOR DISPATCH				/C113
	TAD	PRSTTS	/ SAVE STATUS SO WE KNOW WHERE TO GO		/A113
	DCA	PRSTT3	/ AFTER PROCESSING AND POSSIBLY RESETTING PRSTTS/A113
	TAD	PRACTN	/ SAVE ACTION FOR LATER USE			/A094
	DCA	PRACTS	/ IN THIS TEMP LOCATION				/A094
	TAD	PRACTN							/A015
	SNA CLA		/ SKIP IF THERE HAS BEEN SOME ACTION	/A100	/C102
	JMP	PRSTL0	/ NO ACTION YET					/A100
			/ MUST GO BACK THIS FAR--SEE COMMENTS ABOVE	/A186

/D186		/CLEAR FLASHING AND BUZZING				/M103

/ CODE USED TO BE HERE TO DETECT LQPSE ASF ERROR			/A121
/ THIS CODE WAS DELETED REV121 AS A NEW ERROR CODE UNIQUE		/A121
/ TO THE LQPSE ASF ERROR HANDLES THIS (PRSTTS=24)			/A121

/ NOW WE ARE FINALLY READY TO DO THE DISPATCH				/A100

	TAD	PRACTN		/LOAD ACTION CODE			/A100
	CLL RAL			/TWO WORDS PER CONDITION		/A168
	TAD	(PRSTBL-2)	/READ THE OVERLAY DESTINATION TABLE	/C103
	DCA	T1							/A103
	TAD I	T1		/GET BLOCK OFFSET			/C168
	DCA	PRST5B		/SAVE IN CALL				/C168
	ISZ	T1		/BUMP TO ADDRESS OFFSET			/C168
	TAD I	T1		/GET ADDRESS OFFSET			/C168
	JMS	PROV		/CALL OVERLAY				/C168
PRST5B,		XX		/BLOCK OFFSET				/C168


/THESE ARE THE ROUTINES TO HANDLE THE STOP ACTIONS

PRSTBL,	OBSTN	;OVSTN	/1 - NEW PAGE					/C103
	OBSTS	;OVSTS	/2 - ABORT PRINTING THIS DOCUMENT		/C103
	OBSTP	;OVSTP	/3 - CONTINUE TILL END OF PAGE			/C103
	OBSTB	;OVSTB	/4 - RESTART FROM BEGINNING OF COPY		/C103
	OBSTT	;OVSTT	/5 - GO BACK N PAGES AND RESTART		/C103
	OBSTR	;OVSTR	/6 - CONTINUE (RESUME)				/C103
	OBSTC	;OVSTC	/7 - CHANGE DOCUMENT DESTINATION	/A095	/C103


PSCHSZ,	XX		/ RESET CHARACTER SIZE				/A186
			/ THIS ROUTINE HAS BEEN ADDED FOR THE LQPSE	/A186
			/ WHEN THE STOP OVERLAY IS ENTERED THE CHARACTER/A186
			/ SIZE IS ZERO DUE TO THE ALGORITHMS FOR THIS	/A186
			/ PRINTER.  THUS A PRINT SCREEN IN THE STOP	/A186
			/ PRINTER MENU WOULD PRINT ONLY BLOBS WITHOUT	/A186
			/ THIS ROUTINE					/A186
	JMS	SKIPIF
		LQPSE	/ SKIP IF LQPSE
	JMP I	PSCHSZ	/ NOT LQPSE, JUST RETURN

	TAD	PLNRCS
	JMS	PRESCS	/ SET CHARACTER SPACE SIZE TO CURRENT PITCH
		PCCSIZ

	JMS	PRESCS	/ SET WORD SPACE SIZE TO CURRENT PITCH
		PCWSIZ
	CLA
	JMP I	PSCHSZ	/ RETURN


/THIS SECTION HANDLES MOVING THE PAPER TO THE NEXT PAGE BOUNDARY.

OVSTN=.-OVRLCA	/ N HIT IN STOP MENU					/A103
OBSTN=OVTYPE+OVNUM
	JMS	PRSTNP	/MOVE TO THE TOP OF THE NEXT PAGE
	DCA	PRACTN	/CLEAR ACTION FLAG
	TAD	LPONLN	/LOAD CODE TO FEED ANOTHER PAGE			/A175
	AND	(ASFMSK)/ONLY IF THERE IS A SHEET FEEDER ATTACHED	/A175
	SNA CLA								/A175
	AC7777		/LOAD CODE TO FEED ANOTHER PAGE 		/A109
	DCA	T3	/IF R OR P IS STRUCK NEXT			/A109
	JMP	PRSTL1	/JUMP TO AWAIT ANOTHER ACTION


/THIS ROUTINE MOVES THE PAPER TO THE NEXT PAGE BOUNDARY, REGARDLESS OF WHETHER
/THE PAPER IS CURRENTLY POSITIONED AT A BOUNDARY.

PRSTNP,
	XX

/EVEN IF PRINTING IS CURRENTLY INHIBITED, WE WANT THE MOTION TO OCCUR.  SAVE
/THE PRINT INHIBIT FLAG SO THAT IT CAN BE RESTORED AT THE END OF THE ROUTINE,
/AND THEN CLEAR THE FLAG TO PERMIT THE MOTION.

	TAD	PRYES	/GET PRINT INHIBIT FLAG
	DCA	PRSTTB	/SAVE IT
	DCA	PRYES	/CLEAR PRINT INHIBIT FLAG

/IF PRINTING IS INHIBITED, THE POSITION IN WHICH THE PRINTER THINKS THE PAPER
/IS BEARS NO RELATION TO THE ACTUAL POSITION, WHICH MUST BE AT A PAGE BOUNDARY
/SINCE NO MOTION CAN OCCUR WHEN PRINTING IS INHIBITED.  HENCE, USE ZERO AS THE
/ABSOLUTE VERTICAL POSITION IF PRINTING IS CURRENTLY INHIBITED.

	TAD	PRSTTB	/GET BACK PRINT INHIBIT FLAG
	SNA CLA		/USE ZERO AS LOCATION IF NOT PRINTING
	TAD	PRGSAP	/GET ABSOLUTE VERTICAL POSITION
	CIA		/NEGATE IT

/THIS LOOP FINDS THE DISTANCE TO THE NEXT PAGE BOUNDARY.

PRSTN1,
	TAD	PRQPSZ	/ADD ON THE PAGE SIZE
	SPA SNA		/LEAVE LOOP WHEN IT GOES POSITIVE
	JMP	PRSTN1	/CONTINUE THE LOOP

/WE NOW MAKE THE MOVE.

	DCA	PRSTTA	/SAVE THE AMOUNT TO MOVE
	TAD	PRSTTA	/RECOVER THE MOVE
	JMS	PRMOVE	/MAKE THE MOVE
	JMS	PRFMOV	/FORCE THE MOVE

/THE MOTION ROUTINE UPDATES BOTH THE ABSOLUTE AND RELATIVE VERTICAL POSITIONS.
/HOWEVER, MOTION CAUSED BY STOP ACTION IS NOT ALLOWED TO AFFECT PAGE LAYOUT;
/HENCE, THE RELATIVE VERTICAL POSITION IS READJUSTED TO WHAT IT WAS BEFORE
/THE MOVE.

	TAD	PRSTTA	/SUBTRACT THE AMOUNT WE MOVED
	CIA
	TAD	PRGSVP	/FROM THE RELATIVE VERTICAL POSITION
	DCA	PRGSVP

/FINALLY, IF WE ARE PRINTING TO A CUT SHEET FEEDER, AN EJECT MUST BE
/TRANSMITTED TO SPIT THE CURRENT SHEET OUT.

	TAD	LPONLN	/						/A143
	AND	(ASFMSK)/ SEE IF CUT SHEET FEEDER ATTACHED		/A143
	SNA CLA		/ SKIP IF ONE IS PRESENT
	JMP	PRSTN2	/ NO--SKIP THE EJECT

/D109	AC7777		/LOAD MINUS N PAGE COMMAND			/A093
/D109	TAD	PRACTS	/GET SAVED ACTION CODE				/A093
/D109	SNA CLA		/SKIP FEED IF NOT AN N COMMAND			/A093
/D109	AC0001		/LOAD CODE TO FEED NEW SHEET AS WELL AS		/A091
	JMS	PRESCS	/SEND AN EJECT TO THE CUT SHEET FEEDER
		PCTRAY

/THE PRINT INHIBIT FLAG IS RESTORED TO ITS FORMER VALUE AND WE RETURN.

PRSTN2,	
	TAD	PRSTTB	/GET THE PRINT INHIBIT FLAG BACK
	DCA	PRYES	/RESTORE IT
	JMP I	PRSTNP	/AND RETURN


PRSTTA,	0	/A TEMPORARY WHICH CONTAINS THE AMOUNT OF MOTION PERFORMED
PRSTTB,	0	/A TEMPORARY WHICH SAVES THE VALUE OF THE PRINT INHIBIT FLAG
/----------------------
	PAGE

/THIS SECTION HANDLES CONTINUING UNTIL THE END OF THE PAGE.

OVSTP=.-OVRLCA	/ P HIT IN STOP MENU					/A103
OBSTP=OVTYPE+OVNUM
	AC7777		/SET THE STOP AFTER THE END OF THE PAGE FLAG
	DCA	PRSTNX


/THIS SECTION HANDLES CONTINUING PRINTING WHERE WE LEFT OFF.  HOWEVER, WHERE
/WE LEFT OFF DEPENDS ON WHAT SORT OF STOP WE JUST PROCESSED.

OVSTR=.-OVRLCA	/ R HIT FROM STOP MENU					/A103
OBSTR=OVTYPE+OVNUM

	DCA	PRACTN	/RESET USER ACTION

	TAD	PABORT	/SEE IF HANDLER HAS ABORTED			/A108
	SZA CLA								/A108
	JMP	PRST6B	/ YES, DON'T CLEAR STOP OR STATUS		/A108

	DCA	PRSTOP	/RESET STOP FLAG

/***************************************************************/A154
/								/A154
/ HERE WE USED TO (REV056 TO REV153) SEE IF THERE WAS ANOTHER ERROR
/ AS FOUND IN PRSTT2.  IF SO, WE WOULD COPY THAT TO PRSTTS AND
/ RE-DO THE STOP.

/ THE NEW WAY THAT 2ND ERRORS ARE HANDLED IS AS FOLLOWS.  THE OPERATOR
/ MAKES A DECISION ON HOW TO HANDLE AN ERROR WHEN HE/SHE IS IN THE STOP
/ MENU.  THE PRRSST ROUTINE DECIDES ON WHETHER THE USER OR PRINTER WILL
/ RESET THAT STATUS ERROR.  WHEN IT IS RESET, A SECOND ERROR WILL BE
/ COPIED UP AND ANOTHER PRINTER STOPPED MESSAGE WILL BE RECEIVED, AND
/ THAT ERROR WILL BE HANDLED ON ITS OWN MERITS.

/ CAUTION: WPCUT SENDS TO THE STOP MENU A BIT MASK WHICH SELECTIVELY
/ ENABLES THE OPTIONS THAT THE OPERATOR SEES.
/								/A154
/***************************************************************/A154

	JMS	PRRSST		/ CONDITIONALLY RESET STATUS		/A147
				/ THIS WILL RESET ERRORS DECLARED BY	/A176
				/ THE SPOOLER				/A176

/ IF WE ARE NOT STOPPED FOR NONEXITENT PRINTER REQUEST A STATUS REPORT	/A265
/ IF IT IS A NON EXISTENT PRINTER DUE TO WRONG BAUD RATE, SENDING	/A265
/ MORE CHARACTERS AT THE WRONG BAUD RATE FOR THE PRINTER IS MEANINGLESS	/A265
/ AND HAS BEEN SHOWN TO CAUSE HANGS (WPSV2-334).  WE DON'T CARE ABOUT	/A265
/ STATUS UNTIL WE IDENTIFY THE PRINTER ANYWAY				/A265

	TAD	PRSTT3		/ GET STOP REASON			/A265
	TAD	(-7)		/ IS IT NON EXISTENT PRINTER?		/A265
	SNA CLA			/					/A265
	JMP	PRST6B		/ YES, SKIP THE STATUS REQUEST		/A265

	JMS	SKIPIF		/ IF NOT				/A191
		LA34		/ AN LA34				/A191
	JMS	PRESCS		/ ALSO REQUEST A STATUS REPORT		/A176
		PCSTAT		/ THIS WILL RESET STATUS IF POWER WAS	/A176
				/ TURNED OFF, THE ERROR FIXED, AND	/A176
				/ POWER TO PRINTER HAS BEEN TURNED ON 	/A176

PRST6B,				/					/A131

/ WE SEE IF THE STOP WAS INVOKED VIA PTSTST.  IF SO WE RETURN THERE.	/A182
/ ELSE IT IS A NORMAL STOP AND WE PROCEED THE WAY WE ALWAYS HAVE.	/A182

	TAD	PRSTPF		/ SEE IF THIS LOCATION IS NONZERO	/A182
	SZA CLA			/ 					/A182
	JMP	PTSTSX		/ YES, GO RETURN FROM PTSTST		/A182

/WE RETURN TO DIFFERING PLACES DEPENDING ON THE TYPE OF STOP.  THIS IS
/DETERMINED FROM PRSTTS SAVED IN PRSTT3:

	TAD	PRSTT3		/ GET THE STOP REASON			/A131
	CLL RAL			/ TWO WORDS PER CONDITON		/A168
	TAD	(PSTRES		/ ADD TABLE BASE			/A131	
	DCA	T2							/A131
	TAD I	T2		/GET BLOCK OFFSET			/C168
	DCA	PRST6C		/SAVE IN CALL				/C168
	ISZ	T2		/BUMP TO ADDRESS OFFSET			/C168
	TAD I	T2		/GET ADDRESS OFFSET			/C168
	JMS	PROV		/CALL OVERLAY				/C168
PRST6C,		XX		/BLOCK OFFSET				/C168


PSTRES,		/ RESUME DESTINATION TABLE				/A131
	OBSHLT;	OVSHLT	/ 00 -- PRINTER NOT IN USE			/A131
	OBPRLP;	OVPRLP	/ 01 -- PRINTER BUSY				/A131
	OBPRLP;	OVPRLP	/ 02 -- USER STOP				/A131
	OBTOPP;	OVRSEF	/ 03 -- SE FIRST	/A131	/C168	/C177	/C181
	OBTOPP;	OVRSEY	/ 04 -- SE YES			/A131	/C168	/C180
	OBBPL3;	OVBPL3	/ 05 -- BOTTOM OF PAGE				/A131
	OBRTW;	OVRTW	/ 06 -- TWO WHEEL			/A131	/C140
	OBGTCN;	OVGTCN	/ 07 -- NON EXISTENT PRINTER			/A131
	OBGTCN;	OVGTCN	/ 10 -- WRONG DOC DESTINATION			/A131
	OBSHLT;	OVSHLT	/ 11 -- PAUSED AT BOOT				/A131
	OBBUSY;	OVBUSY	/ 12 -- COMM BUSY				/A131
	OBSHLT;	OVSHLT	/ 13 -- MALFUNCTION				/A131
	OBSHLT;	OVSHLT	/ 14 -- MALFUNCTION				/A131
	OBPRLP;	OVPRLP	/ 15 -- PAUSE SWITCH				/A131
	OBPRLP;	OVPRLP	/ 16 -- RIBBON					/A131
	OBPRLP;	OVPRLP	/ 17 -- LQP02 ASF ERROR				/A131
	OBPRLP;	OVPRLP	/ 20 -- COVER OPEN				/A131
	OBPRLP;	OVPRLP	/ 21 -- PAPER OUT				/A131
	OBSDRE;	OVSDRE	/ 22 -- DOCUMENT READ ERROR		/A131	/C146
	OBSHLT;	OVSHLT	/ 23 -- SYSTEM DISK READ ERROR			/A131
	OBSHLT;	OVSHLT	/ 24 -- LQPSE SHEET FEEDER ERROR		/A131
	OBSHLT;	OVSHLT	/ 25 -- LQPSE CANCEL (FATAL) ERROR		/A131
	OBSHLT;	OVSHLT	/ 26 -- PRINTER COMMUNICATIONS ERROR		/A155
	OBSHLT;	OVSHLT	/ 27 -- MISMATCHED CONTROLS			/A193

	OVSTP9=.-OVRLCA		/COME BACK HERE FROM PRSTL9		/A103
	OBSTP9=OVTYPE+OVNUM
				/B,T, AND S CONTINUED			/A103

	JMS	SKIPIF		/ IF NOT				/A191
		LA34		/ AN LA34				/A191
	JMS	PRESCS		/ ALSO REQUEST A STATUS REPORT		/A176
		PCSTAT		/ THIS WILL RESET STATUS IF POWER WAS	/A176
				/ TURNED OFF, THE ERROR FIXED, AND	/A176
				/ POWER TO PRINTER HAS BEEN TURNED ON 	/A176

	OVST9A=.-OVRLCA		/COME BACK HERE FROM PRSTL9		/A193
				/IF LQPSE SHEET FEEDER ERROR SKIP PCSTAT

/WE MUST MOVE TO THE NEXT PAGE BOUNDARY AND THEN JUMP TO PRINT THE NEXT COPY

	JMS	PRSTNP	/MOVE TO THE NEXT PAGE BOUNDARY

	AC7776		/ SEE IF PRACTN WAS 2 (CANCEL DOCUMENT)		/C093
	TAD	PRACTS							/C093
	SNA CLA		/ SKIP IF YES				/A058	/C099
	JMP	PRST9B	/	WAS ABORT, GO SOMEPLACE ELSE		/A099


/ WE ARE DOING B OR T							/A140

/ IF TWO WHEEL PRINTING IS IN EFFECT AND B WAS TYPED			/A140
/ WE RETURN TO THE BEGINNING OF PASS ONE				/A140
/ THIS MEANS REDOING THE ENTIRE JOB (ALL COPIES) SINCE ALL COPIES	/A140
/ OF PASS ONE ARE DONE BEFORE THE PRINT WHEEL CHANGE			/A140

/ IF TWO WHEEL PRINTING IS IN EFFECT AND T WAS TYPED			/A140
/ WE WILL USE THE NUMERIC ARGUMENT TO SPECIFY THE NUMBER OF COPIES	/A140
/ TO BE REPRINTED							/A140

			/GET THE TWO WHEEL FLAG				/A140
	TAD	PRQ2W	/THIS IS EITHER MINUS THE NUMBER OF		/A140
			/OF COPIES, OR PLUS THE NUMBER OF COPIES	/A140
	SNA CLA		/SKIP IF TWO WHEEL				/A140
	JMP	PRST9E	/NOT, GO TO NEXT COPY OVERLAY NOW		/A140
	TAD	PRACTS	/SEE IF ACTION WAS T				/A140
	TAD	(-5)							/A140
	SZA CLA		/SKIP IF ACTION WAS T				/A140
	JMP	PRST9C	/NOT T, MUST BE B				/A140
	TAD	PRACTV	/GET THE VALUE FROM THE MENU			/A140
	JMP	PRST9D	/GO SET IT UP					/A140
PRST9C, TAD	PRQ2W	/GET TWO WHEEL FLAG AGAIN			/A140
	SPA		/SKIP IF ALREADY POSITIVE			/A140
	CIA		/MAKE POSITIVE BECAUSE IT WASN'T		/A140
PRST9D,	DCA	PRQCPY	/SET UP NUMBER OF COPIES			/A140
	TAD	PRQCPY	/						/A140
	CIA		/						/A140
	DCA	PRQ2W	/AND TWO WHEEL FLAG				/A140
PRST9E,	TAD   (OVNCPY)		/GO PRINT THIS COPY AGAIN	/C265	/C267
	JMS	PROV		/TRIED DOING PRINTER ID BUT SOME PRINT	/C267
		OBNCPY		/SETTINGS GOT MESSED UP BECAUSE THEY ARE/A267
				/MODIFIED AND REPLACED IN THE SAME K	/A267
				/LOCATION AND REUSED. TM,BM,PM ETC	/A267
				/IF WE GO BACK THAT FAR BUT DO NOT RE
				/THOSE PRINTER SETTTINGS THAT GET CHANGED GET
				/CHANGED AGAIN AND WE HAVE A DISASTER!


/ THIS IS THE FINAL LAUNCHING POINT FOR STOP-STOP (ABORT) PROCESSING	/A099

PRST9B,

/ THE USER MAY WISH TO LEAVE THE PRINTER IN THE CONDITION THAT CAUSED	/A105
/ THE ERROR.  IF SO, HE SHOULD BE ALLOWED TO DO SO.  WHEN PRTID IS	/A105
/ CALLED AGAIN, A NEW ERROR REPORT WILL BE ISSUED AND THE ERROR		/A105
/ WILL BE REPORTED AGAIN IF IT HAS NOT BEEN CORRECTED BY THEN		/A105

/ STATUS IS NOW RESET AT PRSTSS BECAUSE NOT ALL ABORTS EXIT HERE	/A126

/ COMMENT:  SOME OF WHAT HAPPENS HERE MAY NOT MAKE STRICT SENSE.	/A139
/ WE ALLOW THE USER TO IGNORE ERRORS AND ABORT.  WE RESET THE LPQSE	/A139
/ BUT NOT THE LQP02.  WE TRY TO SEND MORE CHARACTERS DOWN THE PIPE	/A139
/ TO DO AN EJECT AND RESET THE HIT COUNT BUT THE ACTUAL ERROR MAY	/A139
/ NOT BE CORRECTED, AND THEREFORE THE LQP02 CANNOT SEE THE		/A139
/ CHARACTERS WHICH ARE SENT.  THIS IS FOOD FOR THOUGHT.     HLP		/A139

/ WE NOW RESET THE HIT COUNT TO ONE.  SEE ALSO CODE NEAR DONCL1		/A139
/ WHICH IS EXECUTED IF A DOCUMENT IS PRINTED WITHOUT INTERRUPTION	/A139
/D175	AC0001		/MUST SET BACK TO NORMAL HIT COUNT	/A139	/C175
	JMS	PRESCS	/IN CASE THE NEXT PRINTER ACTIVITY IS 		/A139
		PCBOLD	/FROM ANOTHER SOURCE, SUCH AS CX, PRINT SCREEN	/A139
			/OR LIST PROCESSING
/D175	CLA		/USED TO BE AC0001 ABOVE BUT THAT WAS WRONG


/D149	JMS	PRSTNP	/MOVE TO THE NEXT PAGE BOUNDARY			/A140

	TAD	(OVDON1)	/ STOP-STOP.  GO TO DEQUEUE		/A099
	JMS	PROV
	OBDON1

/----------------------
	PAGE

OVTYPE=OLC
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM


	/ THIS IS ANOTHER STOP PRINTER OVERLAY PAGE			/A094

OVSTC=.-OVRLCA		/ CHANGE DOCUMENT DESTINATION		/A095	/C103
OBSTC=OVTYPE+OVNUM

		/ RIGHT NOW THE ONLY CHANGE ALLOWED IS FROM LQP TO DP
		/ AND VISA VERSA.  THIS IS DONE BY COMPLEMENTING BIT 8
		/ IN PRQPNT AS FOLLOWS

	TAD	PRQPNT
	TAD	(10)
	AND	(17)
	DCA	PRQPNT

	TAD	(OVSTR)	/GO JOIN RESUME CODE
	JMS	PROV
		OBSTR


OVPRLP=.-OVRLCA		/ GO TO PRLOOP					/A131
OBPRLP=OVTYPE+OVNUM
	JMP	PRLOOP	/ GO TO PRLOOP					/A131

OVSHLT=.-OVRLCA		/ ILLEGAL RESUME				/A131
OBSHLT=OVTYPE+OVNUM
	TAD	(OVSTS)	/ DO AN AUTOMATIC KILL				/A131
	JMS	PROV							/A131
		OBSTS

OVSDRE=.-OVRLCA		/ DOCUMENT READ ERROR RESUME			/A146
OBSDRE=OVTYPE+OVNUM
	JMP	RDFIOQ	/ GO RETRY					/A207

/THIS SECTION HANDLES ABORTING THE CURRENT DOCUMENT

OVSTS=.-OVRLCA	/ S HIT IN STOP MENU					/A103
OBSTS=OVTYPE+OVNUM
	DCA	PRQ2W		/CLEAR THE TWO WHEEL FLAG
	DCA	PRQCPY		/CLEAR SO THAT NO MORE COPIES PRINT	/A098
	TAD	PABORT		/SEE IF HANDLER ABORTED			/A108
	SZA CLA								/A108
	JMP	PRST8A		/YES, GO FORCE RELOAD			/A108

	JMP	PRSTL7


/THIS SECTION HANDLES MOVING BACK N PAGES AND RESTARTING.

OVSTT=.-OVRLCA	/ T HIT IN STOP MENU					/A103
OBSTT=OVTYPE+OVNUM
	TAD	PRACTV		/GET THE NUMBER OF PAGES TO MOVE BACK
	CIA CLL								/C156
	TAD	PRPCNT		/SUBTRACT FROM THE CURRENT PAGE COUNT
	SNL			/SKIP IF VALUE LESS THAN COUNT		/A156
	CLA			/ELSE RESTART AT ZERO			/A156
	DCA	PRRSRT		/SET THE RESTART PAGE COUNT


/THIS SECTION HANDLES STARTING AGAIN FROM THE BEGINNING OF DOCUMENT (TOP)

OVSTB=.-OVRLCA	/ B HIT IN STOP MENU					/A103
OBSTB=OVTYPE+OVNUM
		/ T CODE JOINS HERE					/A111
	ISZ	PRQCPY		/ INCREMENT THE COPY COUNT
PRSTL7=.
/AT THIS POINT, WE ARE PROCESSING THE FOLLOWING RESPONSES		/A099
/	S	ABORT							/A099
/	B	GO BACK TO BEGINNING					/A099
/	T	GO BACK N PAGES						/A099

/THIS SECTION HANDLES JUMPING TO PRINT THE NEXT COPY (OR DEQUEUING IF THERE
/ARE NO MORE COPIES).  THE EXACT ACTION AND JUMP DESTINATION DEPENDS ON THE
/TYPE OF STOP WE JUST PROCESSED.

PRSTL7,
	DCA	PRSTPF		/ CLEAR THE SPECIAL STOP FLAG		/A182
	DCA	PRACTN		/CLEAR ACTION FLAG
/D140	DCA	PRACTV		/CLEAR THE ARGUMENT
	DCA	PRSTOP		/CLEAR STOP FLAG
/ CLEAR THE ABORT FLAG.  IN ORDER TO RECOVER FROM AN ASF ERROR THE LQPSE
/ MUST SEE THE STOP FLAG.  IN ORDER TO SEE THE STOP FLAG THE WAITPR ROUTINE
/ WILL SET THE ABORT FLAG WHEN IT SEES THAT NOTHING IS HAPPENING.  THAT GETS
/ US TO THE STOP OVERLAYS TO LET THE RECOVERY PROCESS, AND THUS HERE.  ABORT
/ MUST NOW BE CLEARED SO THAT THE CHARACTERS WE NOW OUTPUT WON'T BE LOST.
	DCA	PABORT	/CLEAR THE ABORT FLAG			/D108	/A129

/NOW, IF WE ARE STOPPED FOR A NON-EXISTENT PRINTER OR A BUSY COMM LINE
/OR A PAUSED LQP02 THAT IS BEING ABORTED,				/A107
/RETURN TO THE DONE OVERLAY IMMEDIATELY.

	TAD	PRSTT3	/GET THE STOP REASON
	TAD	(-7)	/IS IT A NON-EXISTENT PRINTER STOP?
	SZA
	TAD	(7-12)	/OR A BUSY COMM LINE STOP?
	SZA
	IAC		/OR A PAUSED LQP02 (11)				/A107
	SZA CLA							/C107	/C182
	JMP	PRSTL8	/NO--SKIP THE DONE RETURN

	TAD   (OVDON1)	/YES--RETURN TO THE DONE OVERLAY
	JMS	PROV
		OBDON1


/IF WE ARE STOPPED FOR A FATAL ERROR, WE RELOAD THE HANDLER.

PRSTL8,
	TAD	(12-13)	/ARE WE STOPPED FOR A FATAL ERROR?
	SZA CLA
	JMP	PRSTL9	/NO--SKIP THE DONE RETURN

PRST8A,			/ENTRY POINT IF PABORT<>0 AND S WAS HIT		/A108
			/USED TO RELOAD HANDLER HERE			/A168

	DCA	PABORT	/CLEAR ABORT FLAG				/A108
	AC7777		/RESET THE HANDLER				/A168
	CIFSYS		/CHANGE TO THE SYSTEM FIELD			/A168
	LPTOU		/CALL THE HANDLER				/A168

	TAD	(OVDONE)						/C168
	JMS	PROV							/C168
		OBDONE							/A168


PRSTL9,	
/ NOW CLEAR THE HANDLER'S BUFFER AS A MATTER OF PRACTICE		/A106
/ MOVED HERE FROM BELOW REV193						/A193
	AC7777			/RESET THE HANDLER			/A168
	CIFSYS			/CHANGE TO THE SYSTEM FIELD		/A168
	LPTOU			/CALL THE HANDLER			/A168
	JMS	PRRSST		/ CONDITIONALLY RESET STATUS		/A170
				/ THIS WILL RESET ERRORS DECLARED BY	/A176
				/ THE SPOOLER				/A176

/ IF THE ERROR WAS DUE TO AN LQPSE SHEET FEEDER ERROR
/ THEN IN ORDER TO PROCEDE WE MUST RESTORE THE LQPSE
/ WHEN WE RESTORE THE LQPSE WE WILL AUTOMATICALLY GET A STATUS REPORT,
/ SO WE DON'T  NEED TO ASK FOR ANOTHER.  IN FACT, IF WE DO WE WILL
/ RECEIVE THE CANCEL, CAUSE A MALFUNTION, AND HAVE TO CANCEL THE DOCUMENT
/ INSTEAD OF HAVING THE B AND T OPTIONS

	TAD	PRSTT3		/SEE IF MUST RESE LQPSE		/C121	/C126
	TAD	(-25)		/WAS IT LQPSE CANCEL (FATAL) ERROR	/A126
	SZA								/C193
	IAC			/WAS IT LQPSE SHEET FEEDER ERROR (24)	/A126
	SZA CLA			/					/A126
	JMP	PRST9A		/NO					/A126

	AC0006			/ISSUE THE RESET SEQUENCE		/A088
	CIFSYS								/A088
	JMS I	(SQREST							/A088
	TAD	(OVST9A-OVSTP9)	/ GO TO OVERLAY PAST POINT OF PCSTAT	/A193

PRST9A,									/A103
	TAD	(OVSTP9)						/A103
	JMS	PROV		/ GO OVERLAY PAGE WHICH CONTAINS PRSTNP	/A103
		OBSTP9		/					/A168
/_-----------------------
	PAGE

/***********************************************************************/
/									/
/	OVRULR--PART OF PRRULE FOR PROCESSING RULERS			/
/		AS OF V1.2.N IT WAS FOUND THAT THIS ROUTINE NEEDS	/
/		TO BE A TYPE C OVERLAY.   OTHER USES OF TYPE C OVERLAYS	/
/		ARE FOR THE STOP PROCESSING AND IFICATION.  RULERS	/
/		ARE BY DEFINITION PROCESSED BETWEEN LINES SO WE NEED	/
/		NOT WORRY ABOUT THEM.  IN GENERAL, STOP PROCESSING OCCURS
/		BETWEEN LINES.						/
/									/
/		THE IMPORTANT THING TO NOT IS THAT WE MUST NOT ALLOW	/
/		OURSELVES TO GO FROM HERE INTO THE STOP MENU DIRECTLY	/
/		WHATEVER CALLS PRRULE MUST THEN TAKE US TO THE STOP MENU/
/		ELSE WE WILL LOSE TRACK OF WHERE WE WERE		/
/									/
/***********************************************************************/

OVRULR=.-OVRLCA
OBRULR=OVTYPE+OVNUM


/THIS SECTION LOOPS UNTIL THE PERTINENT SECOND HALF OF THE RULER IS FOUND.

	DCA	RULRCM	/CLEAR CENTERING COLUMN				/A243
PRO2L1,
	JMS	READCH	/GET NEXT CHARACTER
	SNA
	JMP	PRRUL3	/END OF COMMAND/END OF FILE FOUND IN MIDDLE OF
			/RULER--TREAT LIKE EOC/EOF
	TAD	(-100)	/SECOND HALF OF RULER?
	SZA CLA
	JMP	PRO2L1	/NO--KEEP LOOKING

/WE ARE NOW DEALING WITH THE SECOND HALF OF THE RULER.  AS NUMBERS ARE
/ENCOUNTERED, THEY ARE RECORDED IN RULRT1.  THE NUMBER WHICH PRECEEDS THE
/RIGHT MARGIN IS THE VALUE OF THE RIGHT MARGIN.

PRO2L2,
	DCA	RULRT1	/CLEAR THE VALUE TEMPORARY
	JMS	READCH	/GET NEXT CHARACTER
	SNA
	JMP	PRRUL3	/END OF COMMAND/END OF FILE FOUND IN MIDDLE OF
			/RULER--TREAT LIKE EOC/EOF
	TAD	(-17)	/END OF RULER?
	SNA
	JMP	PRRUL1	/YES--RETURN TO GET NEXT CHARACTER
	TAD   (17-100)	/NUMBER?
	SMA
	JMP	PRO2L3	/NO - MUST BE SETTING

/THE CHARACTER IS A NUMBER.  ADD TO THE SUM AND CONTINUE.

	TAD   (100-60)	/MAKE A NUMBER
	DCA	T1	/SAVE IN TEMPORARY
	TAD	RULRT1	/MULTIPLY SUM BY 16
	RTL
	RTL
	AND	(3760)
	TAD	T1	/ADD NEW DIGIT
	JMP	PRO2L2	/SAVE NEW VALUE AND GET NEXT DIGIT

/THE RULER IS A SETTING.  PROCESS IT.

PRO2L3,
	TAD  (100-104)	/LEFT MARGIN?
	SNA
	JMP	PRO2LM	/YES
	TAD  (104-105)	/RIGHT MARGIN?
	SNA
	JMP	PRO2RM	/YES
	TAD  (105-106)	/DOUBLE SPACED LEFT MARGIN?
	SNA
	JMP	PRO2DM	/YES
	TAD  (106-107)	/JUSTIFIED RIGHT MARGIN?
	SNA
	JMP	PRO2JM	/YES
	TAD  (107-112)	/CENTERING MARK?				/A243
	SNA		/						/A243
	JMP	PRO2CM	/YES						/A243
	TAD  (112-113)	/ONE AND ONE-HALF SPACED LEFT MARGIN?		/C243
	SNA
	JMP	PRO2OM	/YES
	TAD  (113-115)	/HALF-SPACED LEFT MARGIN?
	SNA CLA
	JMP	PRO2FM	/YES
	JMP	PRO2L2	/NOT A RIGHT MARGIN--CLEAR THE VALUE

PRO2DM,
	TAD 	(PRNHL)	/DOUBLE SPACING
PRO2OM,
	TAD	(PRNHL)	/1.5 SPACING
PRO2LM,
	TAD	(PRNHL)	/SINGLE SPACING
PRO2FM,
	TAD	(PRNHL)	/HALF SPACING

	DCA	PRRLSZ	/SAVE AS LINE SIZE DEFINED BY RULER
/D193	JMS	PRTRNC	/GET TOTAL LINE SIZE (TRUNCATED IF NECESSARY)

/THE FOLLOWING IS EQUIVALENT TO PRTRNC, XX AND IS COPIED INLINE HERE	/A193
/TO AVOID OVERLAY THRASHING AND OVERLAY TYPE CONFLICTS			/A193

/THIS ROUTINE SETS THE CURRENT VALUE OF VERTICAL SPACING (PRLLSZ)
/BY ADDING THE LINE SPACING AS DEFINED BY THE RULER (PRRLSZ)
/AND THE NUMBER OF EXTRA HALF LINES DEFINED IN THE PRINT MENU (PRQLSZ)
/IF PRINTING A HEADER OR FOOTER, PRQLSZ IS IGNORED

/MADE FUNCTIONAL FOR ALL TYPES OF PRINTERS				/A212

	TAD	PRFLAG	/ARE WE PRINTING A HEADER/FOOTER?		
	SNA CLA								
	TAD	PRQLSZ	/ADD THE EXTRA LINE SPACING FROM THE PRINT MENU
			/ONLY IF PRINTING REGULAR TEXT			
	TAD	PRRLSZ	/ADD THE LINE SIZE DEFINED BY THE RULER

	DCA	PRLLSZ	/SAVE AS THE LINE SIZE
	TAD	RULRT1	/GET COLUMN OF LEFT MARGIN			/A243
	DCA	RULRLM	/SAVE FOR CENTERING LOGIC			/A243
	JMP	PRO2L2	/DO NEXT ELEMENT IN RULER

PRO2JM,		/JUSTIFIED RIGHT MARGIN--CALCULATE PRRM IN PRINT UNITS

	TAD	RULRT1	/GET THE VALUE WHICH PRECEEDED THE RIGHT MARGIN
	JMS	PRMULT	/MULTIPLY BY CHARACTER SIZE
		PLNRCS

PRO2RM,	DCA	PRRM	/SAVE AS THE RIGHT MARGIN

/CALCULATE THE LARGEST RIGHT MARGIN TO DATE IN THIS COLUMN

	TAD	RULRT1	/GET THE RIGHT MARGIN
	DCA	RULRRM	/SAVE AS THE RIGHT MARGIN

	TAD	RULRRM	/GET CURRENT RIGHT MARGIN SIZE
	CIA
	TAD	PRMCLL	/COMPARE WITH LARGEST LINE TO DATE
	SMA CLA
	JMP	PRO2L2	/NO NEED TO UPDATE

	TAD	RULRRM	/UPDATE NEW LARGEST LINE
	DCA	PRMCLL
	JMP	PRO2L2

PRO2CM,		/-C- CENTERING MARK IN RULER				/A243
	TAD	RULRT1	/GET COLUMN OF CENTERING MARK			/A243
	DCA	RULRCM	/SAVE FOR FUTURE USE				/A243
	JMP	PRO2L2	/LOOK FOR NEXT ELEMENT IN RULER			/A243

RULRT1,	0
/-----------------
	PAGE

OVTYPE=OLC
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM


/THIS SECTION IS INVOKED AT THE BEGINNING OF EACH PAGE.  IT FIRST DETERMINES
/WHETHER THE PAGE IS IN THE RANGE TO BE PRINTED.  IT THEN DETERMINES WHETHER
/ANY TOP OF PAGE STOP IS NECESSARY, OR IF A PARTICULAR PAGE SHOULD	/C177
/BE SKIPPED OVER DUE TO THE ENVELOPE OPTION STRATEGY			/C177

OVTOPP=.-OVRLCA
OBTOPP=OVTYPE+OVNUM

	DCA	PRGSVP	/CLEAR RELATIVE VERTICAL POSITION
	DCA	PRGSAP	/CLEAR ABSOLUTE VERTICAL POSITION
	DCA	PRGSVS	/CLEAR ACCUMULATED VERTICAL SPACING

/IF WE ARE AT THE END OF THE FILE, JUMP TO THE NEW COPY CODE.

/D169	TAD	PRGCBK	/ARE WE AT THE END OF THE FILE?
	TAD	RDCHAR	/ARE WE AT THE END OF THE FILE?			/A169
	SZA CLA
	JMP	TOPPL0	/NO--CONTINUE WITH TOP PROCESSING

	AC0001		/ SET E-O-F FLAG.				/M087
	DCA	PREOF	/  ...						/M087

/SEE IF THE PAGE COUNT IS IN THE RANGE OF THE RESTART PAGE VALUE.

TOPPL0,
	TAD	PRRSRT	/GET THE RESTART PAGE COUNT
	CIA CLL								/C156
	TAD	PRPCNT	/COMPARE WITH THE PAGE COUNT
	SNL CLA		/USE 13 BIT ARITHMETIC				/C156
	JMP	TOPPL1	/JUMP TO INHIBIT PRINTING

	DCA	PRRSRT	/CLEAR THE RESTART COUNT

/SEE IF THE PAGE NUMBER IS IN THE PROPER RANGE.  IF THE PAGE NUMBER IS TOO
/LOW, SET PRYES TO INHIBIT PRINTING.  IF THE PAGE NUMBER IS TOO HIGH, JUMP
/TO TERMINATE THE CURRENT COPY.

	TAD	PRQBOT	/GET THE LOW BOUND PAGE NUMBER
	CIA CLL		/ADDED CLL					/C156
	TAD	PRPGNM	/SUBTRACT FROM THE CURRENT PAGE NUMBER
	SNL CLA		/USE 13 BIT ARITHMETIC				/C156
	JMP	TOPPL1	/CURRENT PAGE IS TOO SMALL--JUMP TO TURN OFF PRINTING

	TAD	PRQTOP	/GET THE HIGH BOUND PAGE NUMBER
	SNA
	JMP	TOPTEO	/THERE IS NO HIGH BOUND--JUMP TO TEST EVEN/ODD
	CMA CLL		/						/C156
	TAD	PRPGNM	/SUBTRACT FROM THE CURRENT PAGE NUMBER
	SZL CLA		/USE 13 BIT ARITHMETIC				/C156
	JMP	TOPPL1	/SKIP TO TURN ON PRINTING

/ THE NEXT SECTION DETERMINES WHETHER OR NOT WE ARE PRINTING		/A240
/ ALL THE PAGES, ONLY THE ODD PAGES, OR ONLY THE EVEN PAGES		/A240
/ PEOPLE WISHING TO PRINT ON BOTH SIDES OF THE PAPER USE THIS FEATURE	/A240

TOPTEO,	TAD	PRQSP		/GET WORD SPECIFYING ODD/EVEN		/A240
	AND	(0006)		/MASK OUT OTHER BITS (SHADOW)		/A240
	SNA			/SEE IF ODD/EVEN			/A240
	JMP	TOPPL2		/NO, GO ENABLE PRINTING			/A240
	RTR			/PUT EVEN BIT IN LSBIT PSN		/A240
	TAD	PRPGNM		/ADD PAGE CURRENT PAGE NUMBER		/A240
				/BIT 11 WILL COMPLEMENT IF THE PAGE	/A240
				/NUMBER IS ODD				/A240
	RAR			/PUT RESULT IN LINK			/A240
	SZL CLA			/SEE WHETHER TO PRINT			/A240
	JMP	TOPPL2		/ENABLE PRINTING			/A240


/ IF WE HAVE BEEN INSTRUCTED TO OUTPUT TWO CONSECUTIVE ODD OR EVEN	/A260
/ PAGES DUE TO RESET COMMANDS IN THE DOCUMENT, WE WANT TO OUTPUT	/A260
/ A BLANK PAGE WITH NO HEADER OR FOOTER.  THE OTHER SIDE OF THIS PAGE	/A260
/ WILL HAVE PRINTING ON IT.  THIS IS SO WE KEEP THE PAGES IN THE	/A260
/ PROPER ORDER.								/A260

	TAD	PNRSVL		/GET FLAG WHICH TELLS IF THIS IS CASE	/A260
	SNA CLA			/SKIP IF THIS IS SO			/A260
	JMP	TOPPL1		/NO, JUST DISABLE THIS PAGE		/A260

/ WE WANT TO CAUSE A BLANK SHEET					/A260
	DCA	PRYES		/FIRST ENABLE PRINTING			/A260
	TAD	(FF)		/LOAD A FORM FEED			/A260
	JMS	PRCHAR		/OUTPUT IT				/A260
/	JMP	TOPPL1		/DISABLE PRINTING			/A240


TOPPL1,	AC7777			/HERE TO TURN OFF PRINTING
TOPPL2,	DCA	PRYES		/HERE TO TURN ON PRINTING
	DCA	PNRSVL		/RESET THE ODD-ODD/EVEN-EVEN FLAG	/A260

	TAD	PRYES	/SEE IF PRINTING IS ENABLED
	SZA CLA
	JMP	TOPPL6	/NO--CONTINUE WITH TOP OF HEADER CODE

/OTHERWISE, DO THE STOP PROCESSING FOR THE TOP OF PAGE.
	JMP	TOPSE							/A177
/--------------------
	PAGE

/***********************************************************************/
/									/
/	TOP OF PAGE STOP PROCESSING -- TOTALLY REWRITTEN REV 177	/
/									/
/	HERE WE LOOK AT THE ORIGINAL PRINT MENU SETTING FOR SE		/
/	AND THE CURRENT SETTING, WHICH MAY HAVE CHANGED IF THE		/
/	DOCUMENT CONTAINS "PRINTER SELECT ..." CONTROLS.		/
/	WE MAY HAVE TO STOP, TELL THE USER WHY OR WHAT TO FEED		/
/	DEPENDING ON THE SE MENU SETTING AND WHETHER OR NOT THERE	/
/	IS AN ASF02 ATTACHED.  SEE EACH SECTION FOR MORE COMMENTS	/
/									/
/	IF AN ASF02 IS ATTACHED WE WILL FED EVERYTHING IN SEQUENCE	/
/	AND NOT DO ANY SPECIAL SKIPPING OR STOPPING. IF NOT WE		/
/	WILL DO AS FOLLOWS:						/
/									/
/	SE NO		PRINT ALL PAGES		DO NOT STOP		/
/	SE FIRST	PRINT ALL PAGES		STOP ON FIRST PAGE	/
/	SE YES		PRINT ALL PAGES		STOP ON ALL PAGES	/
/						(USER HAND FEEDS)	/
/	SE LETTERHEAD	PRINT ONLY SHEETS	DO NOT STOP		/
/	SE FRONT	PRINT ONLY SHEETS	DO NOT STOP		/
/	SE REAR		PRINT ONLY SHEETS	DO NOT STOP		/
/	SE ENVELOPE	PRINT ONLY ENVELOPES	STOP FOR EACH ENVELOPE	/
/									/
/***********************************************************************/

/	PRQSSM IS ORIGINAL SE SETTING FROM THE PRINT MENU
/	PRQSSS IS THE CURRENT SE SETTING AS MODIFIED BY
/		ANY PRINTER SELECT ... CONTROLS

TOPSE,	TAD	PRQSSM		/GET THE SE ORIGINAL MENU SETTING
	TAD	(TOPSET		/ADD IN A TABLE BASE
TOPSE1,	DCA	TOPPTM		/SAVE IN A TEMP
	TAD I	TOPPTM		/GET CONTENTS OF TABLE--ADDRESS TO GOTO
	DCA	TOPPTM		/STUFF IT
	JMP I	TOPPTM		/GO TO IT

TOPPTM,	0			/TEMP FOR THIS ROUTINE

TOPSET,			/ SE DISPATCH TABLE BASED ON MENU VALUE

/D180	TOPSL1			/0--SE NO--ALWAYS SELECT FRONT TRAY
/D180				/ON SE NO.  MIGHT BE USEFUL IN THE FUTURE
/D180				/SO CAN MAKE DRAFT COPIES ON CHEAP PAPER
/D180				/WITH ASF ATTACHED.

	TOPPL7			/0--SE NO--SELECT APPROPRIATE TRAY	/A180
	TOPSFI			/1--SE FIRST
	TOPSEY			/2--SE YES
	TOPSLE			/3--SE LETTERHEAD
	TOPSFR			/4--SE FRONT
	TOPSFR			/5--SE REAR
	TOPSEN			/6--SE ENVELOPE
				/SE NEXT IS PRQSSS=7.  THIS CANNOT OCCUR
				/ON THE PRINT MENU


/WE ARE IN LETTERHEAD MENU MODE (PRQSSM=3).  IF THE MENU SETTING	/C181
/IS STILL SE LETTERHEAD FEED THE FIRST PAGE FROM THE FRONT TRAY		/A181
/AND OTHER PAGES FROM THE REAR.  IF THE SETTING HAS CHANGED		/A181
/SELECT ANY TRAY (EXCEPT ENVELOPE)					/A181

TOPSLE,				/ SE LETTERHEAD IS THE MENU SETTING

/ IF THE FOLLOWING SECTION IS OMITTED THEN ANY PRINTER SELECT CONTROLS	/A181
/ WHICH ARE IN THE DOCUMENT WILL BE IGNORED (BUG)			/A181
	TAD	PRQSSS		/ GET CURRENT SETTING			/A181
	CIA			/					/A181
	TAD	PRQSSM		/ SEE IF SAME AS MENU			/A181
	SZA CLA			/					/A181
	JMP	TOPSFR		/ NO, SELECT CURRENTLY DESIRED TRAY	/A181

		/ SE LETTERHEAD STILL IN EFFECT				/A181

	JMS	TOPSHT		/ GOTO TOPPL1 IF AN ENVELOPE PAGE
	DCA	PRYES		/ ELSE ENABLE PRINTING
	TAD	PRQPGO		/ SUBTRACT THE FIRST PAGE NUMBER
	CIA
	TAD	PRPGNM		/ FROM THE CURRENT PAGE NUMBER
	SZA CLA			/ IF ZERO WE WANT 1
	JMP	TOPSL2		/ GO SELECT TRAY 2
	JMP	TOPSL1		/ GO SELECT TRAY 1


TOPSFR,	JMS	TOPSHT		/ GOTO TOPPL1 IF AN ENVELOPE PAGE
	DCA	PRYES		/ ELSE ENABLE PRINTING
	JMP	TOPPL7		/ AND GO FEED FROM CORRECT TRAY

TOPSFI,			/ SE FIRST IS THE MENU SETTING				
			/ STOP IF THIS IS THE FIRST PAGE
	TAD	PRQBOT		/ GET RELATIVE FIRST PAGE
	CIA			/ NEGATE IT
	TAD	PRPCNT		/ SUBTRACT FROM THE PAGE COUNT
	SZA CLA			/ ARE WE ON THE FIRST PAGE?
/D181	JMP	TOPPL6		/ NO--CONTINUE WITH TOP OF HEADER PROCESSING
	JMP	TOPPL7		/ NO, GO SELECT APPROPRIATE TRAY	/A181
				/ YES, FALL THROUGH TO TOPSEY


/ WE ARE IN SE YES OR SE FIRST AND ARE ON THE FIRST PAGE TO BE PRINTED.
/ INVOKE STOP PROCESSING

TOPSEY,
	AC0002			/ SET PRINTER STATUS TO 3 FOR SE FIRST,
	TAD	PRQSSM		/ SET PRINTER STATUS TO 4 FOR SE YES

TOPSTP,		/ SET STOP STATUS & GO TO STOP MENU
	JMS	STSTTS		/ SET PRINTER STOP STATUS.
	TAD	LPONLN
	AND	(ASFMSK		/ ONLY DO THE EJECT IF AN ASF IS ATTACHED
	SNA CLA			/ ELSE WE GET A BLANK SHEET BETWEEN EVERY
	JMP	TOPP5A		/ SHEET IF CONTINUOUS PAPER IS USED ON LQP'S
	JMS	PRESCS		/ DO AN EJECT BEFORE STOP SO RESET
		PCTRAY		/   LINE COUNTER IN LQP02 (BUG #270)
TOPP5A,	TAD   (OVSTP1)
	JMS	PROV		/ GO TO THE STOP OVERLAY TO HANDLE THIS
		OBSTP1

/ THE FOLLOWING SECTION IS NECESSARY BECAUSE THE LQPSE FEEDS FROM THE	
/ REAR TRAY WITH A TRAY SELECT CODE OF 3 (ENVELOPE) WHILE THE LQP02 FEEDS
/ FROM THE FRONT.  THIS CODE THAT THE LQPSE FEEDS ENVELOPES FROM THE FRONT.

TOPSNV,	TAD	LPONLN		/ GET PRINTER & ASF TYPE		/A189
	AND	(ASF02)		/ SEE IF HANDLES ENVELOPES		/A189
	SNA CLA			/					/A189
	JMP	TOPSL1		/ NO, GO SELECT FRONT TRAY		/A189
				/ YES, FALL THROUGH TO SELECT ENV TRAY	/A189

	IAC			/ SELECT ENVELOPE TRAY
TOPSL2,	IAC			/ SELECT REAR TRAY	
TOPSL1,	IAC			/ SELECT FRONT TRAY	

/ AC=1 IS FRONT, AC=2 IS REAR, AC=3 IS ENVELOPE

	MQL			/ SAVE IN MQ AND CLA
	TAD	LPONLN		
	AND	(ASFMSK)	/ SEE IF ANY ASF ATTACHED
	SNA CLA			/
	JMP	TOPPL6		/ NO ASF, BARGE THRU
	ACL			/ RESTORE THE TRAY SELECT CODE
	JMS	PRESCS		/ SEND THE COMMAND TO THE CUT SHEET FEEDER
		PCTRAY
	CLA

/THIS LINK CONTINUES WITH TOP OF HEADER PROCESSING.
OVRSEY=.-OVRLCA			/ RESUME AFTER STOP FOR SE YES


TOPPL6,	TAD	PRQSSS		/ SEE IF CURRENT SETTING IS NEXT
	TAD	(-7)		/
	SZA CLA			/
	JMP	TOPP6A		/ NO, SKIP
	TAD	(5)		/ YES, SET TO REAR
	DCA	PRQSSS		/
TOPP6A,	TAD	(OVTOPH	/ GO TO TOP OF HEADER
	JMS	PROV		
		OBTOPH		




TOPSEN,			/ MENU SE ENVELOPE
	TAD	LPONLN		/ SEE IF ASF02 ATTACHED
	AND	(ASF02)		/
	SNA CLA			/
	JMP	TOPNEF		/ NO ENVELOPE FEEDER
	JMP	TOPPL7		/ ASF02, GO DISPATCH
	JMP	TOPSL1		/ GO SELECT FRONT TRAY

TOPNEF,		/ THERE IS NO ENVELOPE FEEDER

	TAD	PRQSSM		/ WE KNOW THIS SAYS ENVELOPE
	CIA
	TAD	PRQSSS		/ IS CURRENT SETTING ALSO ENV?
	SZA CLA
	JMP	TOPPL1		/ GO INHIBIT PRINTING

TOPENS,		/ ENVELOPE STOP
	DCA	PRYES		/ TURN ON PRINTING
	AC0004			/ CODE FOR SE YES STOP FOR NOW
	JMP	TOPSTP		/ GO SET CODE & DO STOP



OVRSEF=.-OVRLCA		/ COME HERE AFTER RESUME SE FIRST		/A181

TOPPL7,	TAD	PRQSSS		/GET CURRENT SE SETTING
	TAD	(TOPSRT		/ADD IN A TABLE BASE
	JMP	TOPSE1		/GO DISPATCH USING TOPSRT

TOPSRT,	TOPSL1			/ 0--PRINTER SELECT NO
	TOPSL1			/ 1--PRINTER SELECT FIRST
	TOPSL1			/ 2--PRINTER SELECT YES
	TOPSL1			/ 3--PRINTER SELECT LETTERHEAD
	TOPSL1			/ 4--PRINTER SELECT FRONT
	TOPSL2			/ 5--PRINTER SELECT REAR
	TOPSNV			/ 6--PRINTER SELECT ENVELOPE		/C189
	TOPSL1			/ 7--PRINTER SELECT NEXT	/C180	/C181

TOPSHT,	XX		/ GOTO TOPPL1 IF AN ENVELOPE PAGE
	TAD	LPONLN		/ SEE IF ASF02
	AND	(ASF02)
	SZA CLA
	JMP I	TOPSHT		/ IF SO WE CAN FEED ANYTHING
	TAD	PRQSSS		/ SEE IF AN ENVELOPE PAGE
	TAD	(-6)		/
	SZA CLA
	JMP I	TOPSHT		/ NO, RETURN SO WE WILL PRINT
	JMP	TOPPL1		/ YES, GO INHIBIT PRINTING
/---------------------
PAGE

OVTYPE=OLB
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM



OVHAN2=.-OVRLCA
OBHAN2=OVTYPE+OVNUM

/DETERMINE IF WE ARE PRINTING TO THE PRINTER PORT OR THE HOST		/A214
/PORT AND SET UP THE PROPER HANDLER CALLS HERE				/A214

	TAD	PRQPNT		/ GET DOCUMENT DESTINATION		/A214
	TAD	(-DHOST)	/ SEE IF HPRT				/A214
	SZA			/					/A214
	TAD	(DHOST-DHOST2)	/ OR TRUE HOST				/A214
	SNA CLA			/					/A214
	JMP	CHKHST		/GO CHECK FOR HOST HARDWARE		/A214


	JMS I	PRTID		/DO PRINTER ID ONLY FOR REAL PRINTER	/C231
				/PRINTER ID WILL RETURN HERE IF		/A214
				/SOME KIND OF DEC PRINTER IS RECOGNIZED	/A214
				/ON THE PRINTER PORT			/A214

/WE ARE TALKING TO THE PRINTER PORT.  WE MUST VALIDATE TO DETERMINE	/A214
/THAT THE ATTACHED PRINTER IS OF THE CORRECT TYPE (DP OR LQP)		/A214

	AC0002			/SPECIFY CHECK DOC DESTINATION		/A166
	JMS I	PRTID		/CALL THE ROUTINE			/C231
	  JMP	PRSET4		/DD OK					/C214
	  /PRINTER SWITCH IN WRONG PSN, NOT LA50/LA100			/A166
	TAD	(10)		/ LOAD CODE FOR "connected to wrong printer"
	JMP	PSXIT		/ GO TO STOP PRINTER MENU

CHKHST,
	DCA	LPONLN		/ CLEAR LPONLN;SIGNAL NOT SEND ESC SEQS	/A178
	CDFSYS			/ COMM FLAG WORD IN SYSTEM FLD		/A143
	TAD I	(CMONLN)	/ NEW LOGO!				/A143
	CDFMYF			/					/A143
	SZA CLA			/ SKIP IF COMM HARDWARE NOT PRESENT	/A166
	JMP	PRSETH		/ SET UP HOST HANDLER
TYPENO,	TAD (7)			/ SET NON EXISTENT PRINTER STATUS
	JMP PSXIT




/THIS SECTION CHECKS FOR AVAILABILITY AND SETS THE PORTS FOR SERIAL
/LINES.  THERE ARE TWO SECTIONS.  THE FIRST SETS THE LINES FOR THE HOST
/HANDLER AND THE SECOND FOR THE SERIAL HANDLER.  THE BREAKDOWN IS:

/SYSTEM		DOCUMENT DESTINATION		LINE USED

/WS80		      HOST		    KL8A USER SELECTED
/		  DP2,SQ1,SQ2			KL8A LINE 3

/WS78		      HOST		 	   SLU2
/		  DP2,SQ1,SQ2			   SLU3

/WS278		      HOST		       PORT0 OR PORT1
/		  DP2,SQ1,SQ2		       PORT0 OR PORT1

/NOTE THAT FOR A WS278, THE COMMUNICATIONS PORT IS ASSEMBLED INTO THE
/SYSTEM AS OF THIS WRITING.  THIS WILL PROBABLY BECOME A USER SELECTABLE
/OPTION ONCE THE WS78 BECOMES A SUPPORTED PRODUCT.

/THERE ARE TWO SECTIONS BELOW.  THE FIRST IS INVOKED TO SET UP FOR A HOST
/HANDLER, THE SECOND IS INVOKED TO SET UP FOR A SERIAL HANDLER.

/***********************************************************************/

/THIS SECTION TREATS DOCUMENTS WHICH WILL BE GOING OUT THROUGH THE HOST
/HANDLER.  FIRST, CHECK IF THE LINE IS IN USE BY THE COMMUNICATIONS CODE.
/IF IT IS, INVOKE THE STOP MENU TO NOTIFY THE USER.  WHEN THE USER TYPES
/RESUME, INDICATING THAT THE LINE IS FREE, CONTROL WILL RETURN HERE.
/

PRSETH,
OVBUSY=.-OVRLCA		/CONTROL RETURNS HERE FROM THE STOP MENU IF THE LINE
OBBUSY=OVTYPE+OVNUM
			/IS BUSY

	CDFSYS		/CHANGE TO THE SYSTEM FIELD
	TAD I (CMADSX)	/SEE IF THE LINE IS IN USE BY OTHER THAN THE PRINTER
	CDFMYF		/CHANGE BACK TO THIS FIELD
	
	SZA		/IS THE LINE FREE?
	TAD	(-3)	/OR IN USE BY THE PRINTER?
	SNA CLA
	JMP	PRSET2	/THE LINE IS NOT BUSY

/THE LINE IS IN USE.  STOP THE PRINTER AND JUMP TO THE STOP MENU OVERLAY TO
/NOTIFY THE USER.

	TAD	(12)	/SET THE PRINTER STATUS TO COMM LINE BUSY
PSXIT,
/D104	JMS	STSTTS	/SET THE PRINTER STATUS.			/A056
	DCA	PRSTTS	/SET THE PRINTER STATUS				/A104
	TAD   (OVSTP1)	/CONTINUE WITH THE STOP OVERLAY
	JMS	PROV
		OBSTP1

/THE LINE IS NOT IN USE.  RESERVE THE LINE, PATCH THE HOST HANDLER, AND
/SET UP THE LINE CHARACTERISTICS.

PRSET2,
	AC0003		/SET TO PRINTER USING THE LINE
	CDFSYS		/CHANGE TO THE SYSTEM FIELD
	DCA I (CMADSX)	/WRITE THE LOCK WORD
	CDFMYF		/CHANGE BACK TO THIS FIELD

	CIFSYS								/A035
	H2INIT			/INITIALIZE COM SETTINGS		/A035

/SET UP THE CALLS FOR THE HOST HANDLERS					/A214

	TAD	(HS2OU		/SET UP CALL TO SEND			/A214
	DCA	PRCHR3		/IN PRCHAR CALLING LOCATION		/A214
	TAD	(HS2IN		/SET UP CALL TO RECEIVE			/A214
	DCA	SQPNXT+1	/IN SQPINP CALLING LOCATION		/A214

PRSET4,	TAD	(OVNDOC		/
	JMS	PROV		/
		OBNDOC		/
/--------------
	PAGE



OVREMAP=.-OVRLCA		/ Moved from GETDC1 to make room in	/A086
OBREMAP=OVTYPE+OVNUM
				/  that overlay.			/A086
/THIS SECTION PRINTS THE DOCUMENT WHOSE FLINK IS THE AC UPON CALL.

	TAD	(PRNLSZ)/ SET DEFAULT LINE WIDTH TO SINGLE SPACING.	/A057
	DCA	PRLLSZ	/  ...						/A057
	CDFQUE
	TAD I	T1	/GET THE FILE NUMBER
	CDFMYF
	DCA	PRFNO	/SET THE FILE NUMBER

/NOW, WE READ THE PRINTER SETTINGS PROVIDED IN THE PRINT MENU.  THESE SETTINGS
/ARE CONTAINED IN THE HEADER BLOCK OF THE DOCUMENT.  THE HEADER BLOCK IS
/READ INTO THE RDBUF AREA AND THE CRUCIAL SETTINGS ARE TRANSFERRED
/TO A BUFFER IN RESIDENT CODE.


	TAD	PRFNO
	BSW
	RTR
	AND	(17)		/GET THE DRIVE FOR THE HEADER BLOCK
	DCA	RDFDRV		/SET IT					/C206

	TAD	PRFNO
	AND	P377		/GET THE HEADER BLOCK NUMBER
	DCA	PRQB+RXQFNO	/FOR THIS FILE NUMBER
	JMS	RDFIO		/PUT THE HEADER BLOCK NUMBER		/C146
		RXEGF+4000	/IN THE Q BLOCK				/C167

	TAD	PRQB+RXQBLK	/GET THE HEADER BLOCK #			/A146
	SNA			/IF HEADER BLOCK # IS ZERO THEN		/A171
	JMP	RDFIO4		/DECLARE IT A DOC RD ERROR		/A171
				/THIS CAN HAPPEN IF USER SWITCHES	/A171
				/DISKS AFTER QUE'NG BUT BEFORE		/A171
				/THIS DOC BUBBLES TO TOP OF QUEUE	/A171
	JMS	RDFIO		/READ THE HEADER BLOCK			/C146
		RXERD+4000					/C146	/C167

/NOW MOVE THE SETTINGS FROM THE RDBUF AREA TO THE PRVALB BUFFER.

	TAD  (RDBUF+23)							/C146
	DCA	X0
	TAD (PRVALB-1)
	DCA	X1
	TAD  (-PRSETZ)
	DCA	T1

	TAD	PRQPSZ		/ Save last doc's page size.		/A074
	MQL			/  ...					/A074

GETDC1,
	TAD I	X0
	DCA I	X1
	ISZ	T1
	JMP	GETDC1

	TAD	PRQPSZ		/ Save new doc's page size in new temp	/A074
	DCA	PRQTMP		/ this is done incase printer is non-	/A074
	MQA			/   existant so we don't destroy PRQPSZ./A074
	DCA	PRQPSZ		/ set PRQPSZ to size of last printed doc/A074

/
/We must now map the settings which are possible on the RL based systems
/to more appropriate settings

	AC3777			/GET DOCUMENT DESTINATION AND MASK OUT	/A006
	AND	PRQPNT		/  SIGN BIT TO ASSURE IT IS POSITIVE	/A006
	TAD	(DDTABL-DDEND)	/USE IT AS CHECK IF OUT OF RANGE OF TABL/A006
	SPA CLA			/IS PRQPNT OUT OF RANGE?		/A006
	JMP	DDLDTB		/  NO-- JUMP TO LOAD VALUE FROM TABLE	/A006
	TAD	DDEFAU		/  YES-- SO GET DEFAULT DESTINATION	/A006
	DCA	PRQPNT		/        AND PUT IN PLACE		/A006
	JMP	GETCON		/        CONTINUE			/A006

/JUMP HERE IF PRQPNT IS IN THE RANGE OF OUR TABLE
DDLDTB,	TAD	(DDTABL)	/GET ADDRESS OF TABLE OF DOCUMENT DEST'S/A006
	TAD	PRQPNT		/USE CURRENT DESTINATION AS OFFSET	/A006
	DCA	T2		/STORE ADDRESS OF NEW DESTINATION	/A006
	TAD I 	T2		/PUT NEW DESTINATION INTO AC		/A006
	DCA	PRQPNT		/AND LOAD INTO PRQPNT			/A006



/WE CONTINUE BY SETTING UP THE COMMUNICATIONS LINE (IF ANY) AND LOADING
/THE PROPER HANDLER.

	OVGTCN=.-OVRLCA							/A090
	OBGTCN=OVTYPE+OVNUM

GETCON,	TAD   (OVHAN2)
	JMS	PROV
		OBHAN2


/THIS IS THE TABLE OF DOCUMENT DESTINATIONS POSSIBLE ON THE RL BASED SYSTEMS
/WHICH WE ARE MAINTAINING COMPATABILITY WITH, IF NEW PRINTERS ARE PUT
/ONTO A SYSTEM THEN THIS TABLE CAN BE EASILY BE CHANGED OR CONDITIONALIZED

/CHOICES ARE: DLPQ (PARALLEL LETTER QUALITY PRINTER)
/	      DSQ1 (SERIAL LETTER QUALITY PRINTER)
/	      DSQ2  (TWO HEADED SERIAL LETTER QUALITY PRINTER)
/	      DDP   (PARALLEL DRAFT PRINTER)
/	      DDP2   (SERIAL DRAFT PRINTER)
/	      DHPRT (SERIAL COMMUNICATIONS PORT)			/C214
/	      DHOST (STRIP UL,BOLD,EOL LF)				/C214

DDTABL,	DSQ1	/ 0 (LQP1  ON RL SYSTEMS)				/A006
	DDP2	/ 1 (DP1   ON RL SYSTEMS)				/A006
	DHOST	/ 2 (HOST1 ON RL SYSTEMS, HPRT ON DECMATE)		/C214
	DDP2	/ 3 (DP2   ON RL SYSTEMS)				/A006
	DSQ1	/ 4 (LQP2  ON RL SYSTEMS)				/A006
	DSQ1	/ 5 (LQP3  ON RL SYSTEMS)				/A006
	DSQ1	/ 6 (LPQ4  ON RL SYSTEMS)				/A006
	DHOST2	/ 7 (HOST2 ON RL SYSTEMS, HOST ON DECMATE)		/C214
	DHOST	/10 (HOST3 ON RL SYSTEMS)				/A006
	DHOST	/11 (HOST4 ON RL SYSTEMS)				/A006
	DSQ1	/12 (NULL DEVICE ON RL SYSTEMS)				/A006

DDEFAU,		/THIS IS THE DEFAULT. IF THE ORIGINAL DOCUMENT DESTINATION IS
		/OUT OF RANGE THEN THIS DESTINATION IS USED
DDEND,	DSQ1	/13 (LQP5 ON RL SYSTEMS)
		/14, 15 AND 16 ALSO MAP TO DSQ1 BUT SINCE THEY FALL OUT OF
		/  RANGE OF THE TABLE THEY GET MAPPED TO THE DEFAULT (DDEFAU)
		/  WHICH HAPPENS TO BE DSQ1 ALSO			/A006

/---------------------
	PAGE

OVTYPE=OLC
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM


/ HERE BECAUSE PRINTER DOESN'T RESPOND (XON) AND WE ASSUME THERE IS NO PRINTER
/ ON LINE

IDERR,	AC7777		/ RESET HANDLER FOR GOOD MEASURE		/C232
	CIFSYS		/						/C232
	LPTOU		/						/C232
	TAD IDCAL	/ GET ID CALL FLAG				/A046
	SNA CLA		/ SEE IF SET (NON ZERO)				/A046
	JMP ERCON	/ NOT SET SO CONTINUE				/A046
	ISZ PRTRID	/ SET SO GET READY FOR SKIP RETURN		/A046
	JMP IDRTN	/ RETURN					/C097
ERCON,									/M097
	TAD (7)		/ LOAD NON EXISTENT ERROR CODE			/M232
	DCA PRSTTS	/ OVERRIDE PRINTER STATUS			/M232
	TAD	(OVSTP1)	/ MESSAGE ON STOP PRINTER MENU		/A032
	JMS	PROV
		OBSTP1


DFTXT,
IDXT,
	JMP	IDRTN	/RETURN TO CALLER


OBCKTM=OVNUM+OVTYPE		/ADD BLOCK NUMBER SYMBOL		/A209
				/SO CAN BE CALLED FROM ANYPLACE		/A209

IDCKTM,	XX		/ ROUTINE TO CHECK THE SYS FIELD "TIMOUT" VARIABLE/A059
			/ JUST SEE IF TIMOUT IN SYS HAS ADVANCED	/A120
			/ BEYOND THE VALUE WE HAVE ESTABLISHED		/A120
			/ IF SO, DO A SKIP RETURN			/A120
			/ IF NOT, JWAIT AND RETURN W/O ISZ		/A120

	TAD	IDTMC	/ GET VALUE TO COMPARE AGAINST			/A120
	CMA		/ NEGATE AND SUBTRACT ONE SECOND OF UNCERTAINTY	/A120
	CDFSYS		/ 						/A120
	TAD I	(TIMOUT	/ ADD CURRENT VALUE OF THE 12BIT SECOND COUNTER	/A120
	CDFMYF		/						/A120
	SMA CLA		/ SKIP IF STILL TIMING OUT			/A120
	ISZ	IDCKTM	/ BUMP RETURN ADDRESS--TIMED OUT		/A120
	JMS	SQPINP	/ HANDLE CHRS COMING BACK			/A142
	CIFSYS		/						/A120
	JWAIT		/						/A120
	JMP I	IDCKTM	/ RETURN					/A120


REST01,	XX		/ CALLS SQREST IN SYS 				/A071
			/ AC CONTAINS ARGUMENT FOR SQREST		/A061
	CIFSYS		/ WITH AC=0 WE REQUEST AN LQPSE STATUS REPORT	/A061
			/ WITH AC=066 WE RESET THE LQPSE		/A061
	JMS I	(SQREST)/ WITH AC=143 WE RESET THE LQP02		/A061
	TAD	(12)	/ SET TIMER FOR 10 SECONDS			/A120
/D198	JMS	IDSTTM	/ CALL THE SET TIMER ROUTINE			/A120
	JMS	IDSTT2		/ SET PIDTMR				/A266
IDHNTST,CDFSYS		/ SET DATA FIELD TO SYSTEM
	TAD I	(D2CTQF	/ GET XON/ XOFF VARIABLE
	CDFMYF		/ SET DATA FIELD BACK TO MINE
	SNA CLA		/ IF 0 THEN PRINTER HAS XON'D ASK AGAIN
	JMP I	REST01	/ TAKE "ANSWERED" RETURN.			/M071
	JMS	IDCKT2	/ CHECK TIME OUT TIME.				/A059
	JMP	IDHNTST	/ JMP IF NOT TIME-ED OUT YET.			/A059
	ISZ	REST01	/ TAKE THE SKIP RETURN FOR "NO-ANSWER"		/M071
	JMP I	REST01	/  ...						/A071

PIDTMR,	0		/ PRINTER ID TIMER				/A198


IDSTT2,	XX		/ ROUTINE TO ADD CURRENT (TIMOUT) VALUE		/A266
			/ TO AC AND SAVE IN PIDTMR			/A266
	CDFSYS			/ GET RIGHT DATA FIELD FOR TIMEOUT	/A266
	TAD I	(TIMOUT)/	  ADD IT				/A266
	CDFMYF		/						/A198
	DCA	PIDTMR		/ SET PRINTER ID TIMER			/A266
	JMP I	IDSTT2		/ RETURN				/A266

/***********************************************************************/
/									/
/	PIDW--PRINTER ID & WAIT				/A130		/
/		THIS ROUTINE ISSUES A WHO-ARE-YOU TO THE PRINTER	/
/		BEFORE THE DOCUMENT IS DEQUEUED.  THE LQPSE, LA50	/
/		AND LA100 WILL						/
/		NOT RESPOND UNTIL FINISHED WITH THE DOCUMENT.		/
/		IF AN ERROR OCCURS BEFORE THE TIME OUT WE ASSOCIATE	/
/		IT WITH THE DOCUMENT WHICH HAS NOT YET BEEN DEQUEUED	/
/									/
/		IF THE TIMER EXPIRES WE DECLARE A MALFUNCTION		/
/									/
/		IF WE WERE TALKING TO AN LQP02 OR DP WE WILL CONTINUE	/A138
/		TO WAIT FOR THE SPECIFIED DELAY BECAUSE WE HAVE NO	/A138
/		WAY OF TELLING WHEN THEY ARE THROUGH WITH THE DOCUMENT	/A138
/									/
/***********************************************************************/

/***********************************************************************/
/									/
/	XSTMID AS AN EXCAPE SEQUENCE CAN EXIST ONLY IN THIS OVERLAY	/A210
/	THERE MUST BE NO OTHER CALLS					/
/		JMS	PRESCS						/
/			PCTMID						/
/	EXCEPT IN THIS OVERLAY UNLESS XSTMID IS MOVED TO RESIDENT	/
/	...THE SAME GOES FOR XSTMRS...					/
XSTMRS,	ESC
XSTMID,	"c&177+4000
/									/
/***********************************************************************/


OVPIDW=.-OVRLCA
OBPIDW=OVTYPE+OVNUM

	DCA	IDANSW		/ RESET ANSWERED FLAG			/A160
				/ CAN'T USE LPONLN BECAUSE IF PRINTER	/A160
				/ REPORTS ERROR WE MAY NEED LPONLN	/A160
				/ FOR STOP OVERLAY PROCESSING, ETC	/A160
	CDFSYS			/ IN SYSTEM FIELD			/A210
	AC0001			/					/A210
	DCA I	(D2XONF		/ SET DOUBLE XON FLAG			/A210
	CDFMYF			/ BACK TO US				/A210
	AC4000			/ FAKE ESC02 INTO SENDING THIS SEQUENCE	/A217
	DCA	LPONLN		/ SO ESC02 IS USED EVEN FOR LQPSE	/A217
	JMS	PRESCS		/ SEND REQUEST TERMINAL ID TO PRINTER	/A210
		PCTMID		/					/A210
PIDW0,	JMS	SQPINP		/ HANDLE CHRS COMING BACK		/A142
	CIFSYS
	JWAIT
	TAD	PRSTOP		/ SEE IF THE USER WANTS TO STOP
	SZA CLA
	JMP	PIDW4		/ YES
	AC7776			/ NO, SEE IF WE HAVE AN ERROR
	TAD	PRSTTS
	SPA CLA
	JMP	PIDW2		/ NO, GO SEE IF ANSWERED
	AC0001			/ YES, LETS WAIT ONE-TWO SECONDS	/A187
	JMS	IDSTTM
	JMS	IDCKTM		/					/A187
	JMP 	.-1		/ (WAIT LOOP)				/A187
	TAD	(OVDON0		/ AND GO BACK AND SET TIMER
	JMS	PROV
		OBDON0
PIDW2,
	TAD	IDANSW		/ SEE IF HAS ANSWERED			/A160
	SNA CLA			/					/C268
	JMP	PIDW3		/ NOT YET, CHECK TIMER

/THE TERMINAL ID SEQUENCE AT THE END OF THE DOCUMENT HAS BEEN SEEN

	JMS	SKIPIF		/ IF NOT AN LQP02/03/WIDE		/A268
		LQP02		/ THEN DON'T ISSUE RESET ETC.		/A268
	JMP	PIDW2A		/ BUT GO DIRECTLY BACK TO DONE OVLY	/A268

/ LQP02; IDANSW IS NON ZERO; HAVE WE ISSUED RESET YET?			/A268
	TAD	IDANSW		/ LOOK AT ANSWERED FLAG			/A268
	SMA CLA			/ SKIP IF NEED TO SEND RESET		/C269
	JMP	PIDW5		/ RESET ALREADY SENT, KEEP WAITING	/C269
	AC0001			/ SET ANSWERED FLAG SO WON'T SEND RESET	/A226
	DCA	IDANSW		/ AGAIN					/A226
	JMS	PRESCS		/ SEND RESET COMMAND			/A210
		PCTMRS		/					/A210
	JMS	PRESCS		/ ENABLE ERROR REPORTS AS RIS		/A257
		PCSTAT		/ DISABLED THEM				/A257
	JMP	PIDW5		/ GO CHECK TIMER 			/C176


PIDW2A,	TAD	(OVDON1		/ IS DONE, GO DEQUEUE
	JMS	PROV
		OBDON1
/---------------------
	PAGE								/A198

PIDW3,	JMS	IDCKTM		/ CHECK THE TIMER
	JMP	PIDW0		/ NOT TIMED OUT, CHECK STATUS AGAIN
PIDW3A,	TAD	(13)		/ TIMED OUT, LOAD MALFUNCTION CODE
	DCA	PRSTTS		/ OVERRIDE PRINTER STATUS
PIDW4,	TAD	(OVSTP1		/ GO TO STOP OVERLAY			/C150
	JMS	PROV
		OBSTP1

PIDW5,			/ LQP02 HAS ANSWERED, WAIT FOR 2ND XON		/C210
	JMS	IDCKTM		/ SEE IF TIMER HAS EXPIRED		/C210
	SKP			/ NO, SKIP				/C210
	JMP	PIDW3A		/ YES, GO REPORT MALFUNCTION		/A210
	CDFSYS			/ CHECK FLAG IN SYS			/A210
	TAD I	(D2XONF)	/					/A210
	CDFMYF			/					/A210
	SZA CLA			/ SEE IF CLEARED YET			/A210
	JMP	PIDW0		/ NO, KEEP CHECKING FOR STOP		/A210

	AC0001			/ NOW WAIT ONE MORE SECOND		/A237
	JMS	IDSTTM		/ THIS IS BECAUSE LQP02 CANNOT HANDLE	/A237
	JMS	IDCKTM		/ THE SUBSEQUENT SET PAGE SIZE COMMAND	/A237
	JMP	.-1		/ IT IS APT TO DECLARE A FALSE SHEET	/A237
				/ FEEDER ERROR WHICH CAN ONLY BE CLEARED/A237
/ BY POWER CYCLING THE PRINTER.  SEE WPSV2-66 BUG REPORT		/A237

	JMP	PIDW2A		/ YES, GO TO DONE OVERLAY		/A210

IDANSW,	0			/ FLAG INDICATES WHEN ANSWERED		/A160
				/ 0000 = AWAITING AN ANSWER
				/ 7777 = ANSWERED, NEED TO SEND RESET
				/ 0001 = ANSWERED, RESET HAS BEEN SENT,
				/	 AWAITING DOUBLE XON FLAG IF LQP02

/+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++/
/									/
/	PRINTER ID--ROUTINE CALLED FROM OVERLAYS AT WAIT1A, GETDOC	/
/	AND OVNCPY TO POLL FOR PRINTER ID.  THE CALLS ARE TO A		/
/	ROUTINE THAT IS PRINTE RESIDENT AND THAT ROUTINE BRINGS		/
/	IN THIS OVERLAY.  RETURN TO THE CALLER IS BY JUMPING TO		/
/	TO THE ROUTINE THAT BROUGHT IN THIS OVERLAY.			/
/									/
/	THIS ROUTINE IS ALSO CALLED BY CX AND LP			/
/	TWO EXITS ARE POSSIBLE IF THE ID IS UNSUCESSFUL:		/
/		A NON SKIP ERROR RETURN IF IDVAL=1			/
/		A RETURN TO THE STOP OVERLAY IF IDVAL=0			/
/	PRSTTS ON EXIT:		7 IF NO PRINTER ANSWERS			/A112
/			       11 IF PRINTER ANSWERS BUT NO XON		/A112
/D112				1 IF ALL OK FIRST TIME DELETED		/A112
/									/
/+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++/

OVPID=.-OVRLCA
OBPID=OVTYPE+OVNUM

PIDW,

/SET UP THE PROPER HANDLER CALLS FOR A REAL PRINTER			/A214
	TAD	(LPTOU		/SET UP CALL TO SEND			/A214
	DCA	PRCHR3		/IN PRCHAR CALLING LOCATION		/A214
	TAD	(LPTIN		/SET UP CALL TO RECEIVE			/A214
	DCA	SQPNXT+1	/IN SQPINP CALLING LOCATION		/A214

/FLUSH THE INPUT BUFFER INCASE STUFF WAS THERE WHILE WE WERE TALKING	/A214
/TO THE HOST								/A214

PIDW1,	CIFSYS			/ LET'S FLUSH THE INPUT BUFFER		/A143
	LPTIN			/ BY READING CHRS AND IGNORING THEM	/A143
	SKP CLA			/ NOTHING LEFT				/A143
	JMP	PIDW1		/ SOMETHING, GO GET ANOTHER		/A143

	DCA 	REST01		/ SET POLL FLAG TO 0 FIRST TIME THROUGH
IDSTR1,
	CDFMNU			/ CHANGE TO THE MENU FIELD		/M026
	TAD I (MUBUF+MNPRTB)	/ GET THE BAUD RATE			
	CDFMYF			/ CHANGE BACK TO THIS FIELD		/M030
	AND 	(17)							/D030
		TSB2		/ SET THE BAUD RATE
/	CLA			/ TSB2 DOESNT CLEAR THE AC.		/A059
	AC4000			/ FAKE ESC02 INTO PASSING THIS SEQ	/A210
	DCA	LPONLN		/ RESET PRINTER INFORMATION		/A143
	DCA	IDANSW		/ CLEAR ANSWERED FLAG			/A210
	JMS	PRESCS		/ REQUEST TERMINAL ID			/A210
		PCTMID		/					/A210
	AC0004			/ SET FOR 4 SECONDS		/A130	/C154
/D198	JMS	IDSTTM		/ SET THE TIMER				/A130
	JMS	IDSTT2		/ SET OUR PERSONAL TIMER PIDTMR		/C266

IDLOOP,	TAD	IDANSW		/ SEE IF ANSWERED YET			/C210
	SZA CLA			/ SKIP IF HASN'T			/A032
	JMP	IDTST		/ HAS, GO TEST MORE			/A032
	TAD	PRSTOP		/ SEE IF USER WANTS TO STOP		/A156
	SZA CLA			/					/A156
	JMP	IDERR		/ YES, TREAT AS NON EXISTENT		/A156
/D198	JMS	IDCKTM		/ SEE IF TIMER HAS EXPIRED		/A032
	JMS	IDCKT2		/ SEE IF TIMER HAS EXPIRED		/A198
	JMP	IDLOOP		/ JMP IF NO.				/A059
	TAD	REST01		/ YES, SEE IF FIRST TIME THROUGH
	SZA CLA
	JMP	IDERR		/ IF NOT 0 THIS IS SECOND FAILURE
				/ SO DISPLAY ERROR MESSAGE

	/ THE FIRST TIME THROUGH WE ASSUME AN LQPSE MAY BE CONNECTED
	/ AND IN NEED OF A RESET, SO IF THE TIMER EXPIRES (IT HAS
	/ AT THIS POINT), WE RESET THE LQPSE AND WAIT SOME MORE
	AC0006			/ LOAD CODE FOR LQP01			/A089
	JMS	REST01		/ DO AN LQP RESTORE			/M071
	   JMP	IDSTR1		/  THIS RETURN WHEN XON COMES BACK	/A071
	   JMP	IDERR		/  THIS RETURN WHEN TIME-OUT		/A071
				/ XON NEVER HAPPENS

IDTST,		/ THE PRINTER ID IS ESTABLISHED

/ RESET TO PRINTER'S DEFAULT CHARACTER SETS AND FONT			/A226

	JMS	PROV		/ LOAD OVERLAY CONTAINING SUBROUTINE	/A226
		OBCFRS		/					/A226
	JMS	CHFNRS		/ RESET CHARACTER SETS AND FONTS	/A226

/ ENABLE EXTENDED UNSOLICITED STATUS REPORTS
/ FOR THOSE PRINTER WHICH CAN SEND THEM

	JMS	SKIPIF							/C226
		XRPMSK							/C226
	JMP	IDRTN		/ CAN'T, JUST RETURN			/C226
	JMS	PRESCS		/ REQUEST A STATUS REPORT		/C191
		PCSTAT		/					/C191
	JMP	IDRTN		/ RETURN NORMALLY (NO ERROR)

/**********************************************************************/
/									/
/	IDCKT2--SUBROUTINE TO CHECK THE "TIMEOUT" LOCATION IN WPSYS	/
/		THIS SUBROUTINE IS FOR USE ONLY BY PRTRID, SINCE	/
/		PRINTER ID (THE SUBROUTINE PRTRID DEFINED FOR THE WORLD	/
/		CAN BE CALLED BY THE USER JOB (LIST PROCESSING TO PRINTR/
/		OR CX), AS WELL AS THE PRINTER ITSELF.  THEREFORE ANY	/
/		JWAITS IT CONTAINS MAY NOT BE SHARED WITH OTHER JOBS	/
/		THUS WE CANNOT USE THE SAME SUBROUTINE THE PRINTER JOB	/
/		USES AS IT MAY BE IN USE BY THE PRINTER JOB		/
/									/
/		(IT USED TO AND DID CAUSE A SYSTEM HANG)	/A198	/
/									/
/***********************************************************************/

IDCKT2,	XX		/ ROUTINE TO CHECK THE SYS FIELD "TIMOUT" VARIABLE/A198
			/ JUST SEE IF TIMOUT IN SYS HAS ADVANCED	/A198
			/ BEYOND THE VALUE WE HAVE ESTABLISHED		/A198
			/ IF SO, DO A SKIP RETURN			/A198
			/ IF NOT, JWAIT AND RETURN W/O ISZ		/A198

	TAD	PIDTMR	/ GET VALUE TO COMPARE AGAINST			/A198
	CMA		/ NEGATE AND SUBTRACT ONE SECOND OF UNCERTAINTY	/A198
	CDFSYS		/ 						/A198
	TAD I	(TIMOUT	/ ADD CURRENT VALUE OF THE 12BIT SECOND COUNTER	/A198
	CDFMYF		/						/A198
	SMA CLA		/ SKIP IF STILL TIMING OUT			/A198
	ISZ	IDCKT2	/ BUMP RETURN ADDRESS--TIMED OUT		/A198
	JMS	SQPINP	/ HANDLE CHRS COMING BACK			/A198
	CIFSYS		/						/A198
	JWAIT		/						/A198
	JMP I	IDCKT2	/ RETURN					/A198
/-----------------------
	PAGE



