/PRINT DM-II V2.0 PRINTER RESIDENT CODE
/
/239	EMcD	24-Sep-85	Dutch and Spanish Xlations (conditional)
/238	EMcD	14-SEp-85	Nordic translations
/237	MART	2 JUL  85	ALLOW PLWIDE TO WORK IN BOTH DIRECTIONS
/236	Mart	28 Jun 85	Get rid of some LQPSE (not supported 3.0)
/				to make room for Tech Char Required Space
/235	Mart	25 June85	change location of OLDHIT to page zero
/234	mart	12 jun 85	change cross field call to prchar
/				and add an escape sequence to reset modes
/233	Mart 	5 june 85	initialise PLNRCS to 72 
/232	mart	25 may 85	Change location of PUM mode flag and initialise 
/231	Mart	15 May 85	Allow cross field access to PRCHAR from SYS	
/230	MART	3  MAY 85	add PUM mode flag		
/229	Mart	2  may 85	cross field call to prescs and more esc seqences
/228	MART	24 APR 85	OVERLAY STARTUP SECTION IN DSKHND
/				with 8 bit fallback code for LQPs
/227	Mart	26-mar-85	Allow 8 bit output and BLASTR hook
/226	rcme	18-MAR-85	Enable differentiation of LA100 and LA100PC
/				by VTWHO code.  Also reserve hole space in
/				read buffer.
/
/	------------------------All subsequent mods to V2.0 and earlier
/
/225	HLP	22-JAN-85	Fix hang caused by re-entering PROV when
/				  comm errors occur during disk reading
/224	HLP	10-JAN-85	Reset PRTABF at beginning of each line
/223	HLP	08-JAN-85	Fix ap bug induced when combined LSPACE
/				  by reinstating LSPAC2 etc.
/222	HLP	03-JAN-85	Combine LSPAC2 and LSPACE
/				Delete conversion of leading spc to tabspc
/				Rework PRPCHR again to handle tab spc and
/				  non tab spc separately
/				Add a space preceding HPA command to
/				  trigger underline!
/				Pick up attribute of leading spaces(#321)
/				Add variables for tab fixes
/				Delete NCONDOR condx & L4 support
/				Make BLKBOX not output nulls
/221	HLP	14-DEC-84	Fix parser so DCS does not write over
/				everything!
/220	HLP	08-DEC-84 192	Fix PCTMRS so no LQPSE
/219	HLP	03-DEC-84 191	Reimplement reset printer PCTMRS
/218	HLP	26-NOV-84	Fix parser so not confused by DDCHST
/217	HLP	06-NOV-84	Add PNRSVL page number reset value
/				Fix old TW justification bug also WPSV2-361
/216	HLP	16-OCT-84 19XZ	Fix indent tab bug 276
/215	HLP	12-OCT-84	Add PFS (Page Format Select) command to PRESCS
/				Expand mask to allow for 10 fonts
/				Move PRJSPC so new text processor can use TTYIN
/				Add PRFPFS PFS flag
/214	HLP	24-SEP-84 19W	Fix range check fix
/				LN03 Driver integration
/213	HLP	18-SEP-84 19V	Range Limit Error Codes
/				PLCHBS was not detecting BS correctly
/212	HLP	28-AUG-84	Add RULRCM, RULRLM, RULRRM for centering
/211	HLP	16-AUG-84	Changes for LN03 driver
/209	HLP	02-AUG-84	Fix ppnl tabs LQP02
/208	HLP	25-JUL-84	Changes for sixel graphics print controls
/207	HLP	24-JUL-84	Fix DD CHST blank line problem
/206	HLP	20-JUL-84	Change PLCHBS for tech characters
/205	LJJ	13-JUL-84	Fixes for \d\p\s expansion/contraction bug
/204	HLP	05-JUL-84	Move PLSPCX and PLREST from resident to overlay
/203	HLP	09-JUL-84	Delete PRQPMU
/202	HLP	06-JUL-84	Technical character justification fix PLCHBS
/201	HLP	02-JUL-84	Change AND P177 to AND (2177 in ESCST
/		29-JUN-84	Change IDANSW philosophy
/200	HLP	18-JUN-84	Add escape seqs for technical chrs
/199	LJJ	14-JUN-84	Delete PRYEAR and PRMTDY (new \d method)
/198	HLP	13-JUN-84	Increase multicolumns from 10 to 20
/197	HLP	12-JUN-84	Save 10 locations in BLKBOX
/196	HLP	10-JUN-84	Make ASCOUT add 4000 bit
/195	HLP	08-JUN-84	Add escape seq for absolute col posn PCCOLA
/				Add PRQPMU variable for print margin units
/194	HLP	31-MAY-84	Move PRJL5A to overlay
/				Fix vertical motion to LQPSE broken on 189
/193	HLP	30-MAY-84	Add code for required space
/				Add escape sequence to set quality mode
/				Move CSTRNG, reenable L4 for DECmate-I
/				Bugfix calling OBJUSL on LQPs (critical hang)
/192	HLP	29-MAY-84	Recognize LN03 as an LA100
/191	HLP	25-MAY-84	Fix problem clearing VSTACK; multiple errors
/				  (cover,pause,ribbon caused program hlt)
/190	HLP	15-MAY-84	More changes for DD HOST1
/189	HLP	14-MAY-84	Initial Changes for adding DD HOST1
/188	HLP	11-MAY-84	F and N rulers, EX in print menu DP changes
/				ESMVV vertical move routine used by ALL printers
/187	HLP	10-MAY-84	Change XXSTGN names to match G0 and G1 properly
/186	HLP	30-APR-84	Restructure justificationn overlays
/				Eliminate thrashing when DD HOST
/185	HLP	25-APR-84	Change end of document scheme to
/				  detect LQP02 done with D2XONF
/				  ... delete SNDCHR routine--ADD PCTMID
/				FOUND BUG near VMALF--MISSING CDF
/				  would clobber 11600,11601 if
/				  LQP02 reported error 21,23, or 29
/184	HLP	24-APR-84	Free up HS2IN
/183	HLP	20-APR-84	Changes for RDFIO to use PRQRX
/				Concatenate R2FILP to this module
/182	HLP	16-APR-84	Fixups due to common QBLK
/				Add British-US date flag PRDTFG
/181	HLP	13-APR-84	Move document header storage to R2FILP
/180	HLP	10-APR-84	Add JEXIT code so print field can be used by other jobs
/179	HLP	05-APR-84	Replace RPSTX by STSTTS in all places
/178	HLP	28-MAR-84	Do not include overlay areas in binary
/177	HLP	27-MAR-84	Fix bold interpretation initialization bug
/176	HLP	14-MAR-84	Move justification variables to page zero
/				Add comments about system initialization code
/				moved to overlay area (runs at boot time)
/175	HLP	09-MAR-84	Move TSTFUL to WPSYS
/------------------SDC Submission DECmate-II V1.5----------------------
/174	HLP	29-FEB-84	Change LPIND to function only for LA50
/				Use GDH's new TSTFUL etc.
/				Fix extra CSI in table select esc seq
/173	HLP	10-FEB-84	Add label MISCT1 for R2FILP
/				Add table select escape sequence PCTABL
/				Make PCDPIT and PCTABL work if printing inh'd
/				Delete L4 functions in FLABUZ for space rsns DM-I
/172	HLP	05-FEB-84	Change LPONLN for 13;2 and 13;3 to ASF01
/171	WCE	16-JAN-84	Rework FLASH-BUZZ to correct status line bug
/170	HLP	16-JAN-84	Rework get character routines for better
/				  processing of controls
/169	HLP	11-JAN-84	Generalize ID code logic so use secondary
/				attributes only where we need more info
/168	HLP	04-JAN-84	Fix ASF detection for LQPSE (DECII-156)
/167	HLP	27-DEC-83	Call PRSTUP in PRESET (ref DECII-121)
/				Modify STSTTS not to report duplicate errors
/				Delete PFLASH and PBUZZ and refs
/166	HLP	20-DEC-83	Move overlay area to beginning of printer so can
/				  save 3 blocks on system disk
/165	HLP	16-DEC-83	Save some space in PRESCS so can make PROV
/				   detect illegal returns
/				Modify PRESCS not to send certain escape
/				   sequences to LQPSE
/164	HLP	13-DEC-83	Modify ESC02 again so only CHRSET and FONT
/				  esc seqs go out when printing inhibited
/163	HLP	08-DEC-83	Detect EOF within Control block indicating
/				   missing end print control
/162	HLP	06-DEC-83	Allow ESC02 to work if printing inhibited
/				Make PROV more general
/				Add PTSTST to test for user stop
/161	HLP	22-NOV-83	Fix DD HOST hang caused in edit 158
/160	HLP	21-NOV-83	Allow String Finals for CHRSET
/159	HLP	21-NOV-83	Make LPIND work for DD=HOST
/158	HLP	17-NOV-83	Move all overlays to WPRTOV module
/				Send no escape seqs to HOST
/157	HLP	14-NOV-83	Move READCH to R2FILP
/156	HLP	11-NOV-83	Reorganize FLABUZ
/155	HLP	04-NOV-83	Patch PRRSST to disable status report request
/154	HLP	01-NOV-83	Bugfix FONT selection in LPBI
/153	HLP	29-OCT-83	Bugfixes:
/				Restore prefetch of next chr at top of page
/				   necessary for proper function of RESET in
/				   To/From
/				LA34 PM bug
/				LQP02 OLC overlay loading problem
/				DP overlay thrashing fixed
/152	HLP	22-OCT-83	Installing Bold Interpretation code into
/				LPLINE code
/151	HLP	21-OCT-83	Add escape sequences for G1 and G2
/150	HLP	12-OCT-83	Put Overlay Areas on Block Boundaries
/				 so we can soon save 3 blocks on disk
/				Add PRBIF etc. to page zero
/149	HLP	09-OCT-83	Fix Draft Printer Overlay load
/148	HLP	04-OCT-83	Fix Adjacent super/sub in justified text bug
/147	HLP	29-SEP-83	Fix DECII-7; enable extended reports
/				  after any visit to printer stop code
/146	HLP	28-SEP-83	Fix DECII-9 LQPSE not working
/				  LQPSE replacement chr routine not loaded when called
/				  Make another OLC overlay for LQPSE
/145	HLP	17-AUG-83	Reword ESC02 routines
/144	HLP	11-AUG-83	Changed order of processing so SE stop
/				  processing takes place before reading anything
/143	HLP	23-JUN-83	Restructure overlays so there can be
/				  up to 16 overlay areas and
/				  up to 256 overlays which can load into given area
/				Delete loading of printer handler--serial
/				  handler always resident in WPSYS, loaded
/				  at boot time
/				General cleanup
/142	WCE	17-AUG-83	Delete redefinition of "RXE??" handler commands
/141	WCE	17-AUG-83	Reworte FLABUZ for better use of IOA calls
/140	HLP	10-AUG-83	Modify PRTRID so if call with AC=0002 we
/				  check doc dest and set quality mode on
/				  LA50/LA100
/139	HLP	02-AUG-83	Add ID for LQP02 emulating printer
/135	HLP	22-JUN-83	Fix induced bug where pause became sheet feeder error
/134	HLP	21-JUN-83	Further fix Bug #140 so won't print on platen
/133	HLP	17-JUN-83	Fix bug in FLABUZ TIME routine which
/				   was causing excessive system overhead,
/				   slowing down to/from and possibly having
/				   other effects
/132	HLP	10-JUN-83	Make SQPINP ignore pause if there are
/				   other errors in the same report
/131	HLP	07-JUN-83	Add IDANSW flag
/130	HLP	06-JUN-83	LQPSE ASF error sets PRSTOP
/129	HLP	26-MAY-83	Delete old FLABUZ routine, deconditionalize
/				   new FLABUZ routine on NEWFLABUZ
/128	HLP	25-MAY-83	Delete MAXMOV and simplify PRMOVE routine
/127	HLP	23-MAY-83	Spooler to reset status if comm error
/				Comm error to stop printer
/126	HLP	12-MAY-83	Improve processing of the CANCEL chr (SQPINP)
/				Change communications error to code 26 in VERRTB
/125	HLP	10-MAY-83	Delete superfluous RABORT routine
/				Fix PRSTUP routine (missing CLA)
/124	GDH	03-MAY-83	Corrected TSTFUL HOST INPUT BUFFER size reference
/123	HLP	29-APR-83	Fix justification on draft printers
/122	HLP	28-APR-83	Make PRRSST resident
/				PRRSST resets to 1 if something in queue, else 0
/				Reorganize PRSTTS and PRSTT2, and their
/				  setting and resetting.  See comments at PRSTTS
/				Delete WS102 conditionals
/121	HLP	14-APR-83	Move UNDERL to resident so PCBOLD call near
/				  DONCL1 in overlay will work
/				(if a variable is referenced in more than
/				one overlay it should not be in an overlay)
/				Add PCSTAT status report command for LQPSE
/120	HLP	08-APR-83	Make NEWFLABUZ routine light L4 on CONDOR,
/				display printer status messages once/second
/119	HLP	04-APR-83	Moved STSTTS to be in parser section
/				Added AND P177 to SQPINP for LA120, LA34
/118	HLP	01-APR-83	Fix new parser LQPSE status reports
/117	HLP	26-MAR-83	Fix draft printer dead key seq underline bug
/116	HLP	13-MAR-83	Speed up TW printing
/115	HLP	04-MAR-83	Rewrite to report all disk errors
/114	HLP	25-FEB-83	Rewrite printer parser
/113	HLP	15-FEB-83	Rework to incorporate printer parser
/				  and LPONLN (deleting PRASF and IDFLAG)
/112	HLP	14-FEB-83	Conditionalize FLABUZ on NEWFLABUZ (was CONDOR)
/111	HLP	24-JAN-83	Change LQP02 right margin from 158 to 330 rel units
/110	HLP	14-JAN-83	Fix FLABUZ to display once in editor (it used to)
/-------------19-JAN-83-------SDC SUBMISSTION DECmate-II V1.0.0 thru rev 109
/109	HLP	28-DEC-82	Move IDSTTM near PRTRID, etc.
/108	HLP	14-DEC-82	Move PRSTT2 to PRSTTS+1 (see also WPF1.058)
/107	HLP	07-DEC-82	Add IDTMC timout compare variable on page 0
/106	HLP	28-NOV-82	Change sheet feeder error code to 24 for LQPSE only
/105	HLP	18-NOV-82	Fix for AP-no giving extra pages at end of doc
/104	HLP	15-NOV-82	Add PRSTT3 to page zero
/103	HLP	12-NOV-82	Change to a calculated slack constant
/				(LQP02 ignores rollbacks beyond top of page)
/102	HLP	15-OCT-82	Move DCA PREVST and hold interrupts in FLABUZ
/				 (Occasionally messages not seen or not cleared)
/101	HLP	13-OCT-82	Put PRACTS on page zero so can use in mult ovs
/100	GDH	11-OCT-82	Changed FLABUZ to display only once per second.
/099	HLP	22-SEP-82	Fixed LQP02 super/subsrcipts at end of lines
/D169	DELETED PREVIOUS EDIT HISTORY (PRIOR TO HLP)

/THESE ARE SOME OF THE PRINTER TYPES					/A143
	LA12=DPMSK							/A143
	LA34=DPMSK+03							/C169
	LA50=DPMSK+MCMSK+XRPMSK+MNMSK+1				/m226	/C188
	LA100=DPMSK+MCMSK+XRPMSK+2					/m226
	LN03=DPMSK+MCMSK+XRPMSK+MNMSK				/m226	/A214
	LQP03=LQP02+MNMSK					/a226
	LA120=DPMSK+MCMSK						/A188


/THESE ARE COMMONLY USED CHARACTERS.

BS=10		/BACKSPACE
TAB=11		/TAB
LF=12		/LINE FEED
HLF=2412	/HYPHENATED LINE FEED
SRET=2012	/SOFT RETURN						/A143
GNL=55		/SIXEL GRAPHICS NEW LINE CODE				/A208
FF=14		/FORM FEED
BPC=1014	/BEGIN PRINT CONTROL
EPC=1414	/END PRINT CONTROL
PM=2014		/PAGE MARKER
CR=15		/CARRIAGE RETURN AND END DEAD KEY SEQUENCE
SO=16		/SHIFT OUT ASCII CODE					/A152
SI=17		/SHIFT IN ASCII CODE					/A200
RSTRT=16	/RULER START
REND=17		/RULER END
ESC=33		/ESCAPE

SPC=40		/SPACE
TSPC=2040	/TAB SPACE
RQSP=177	/REQUIRED SPACE (USED BY PRINTER ONLY)			/A193
BSLH=134	/BACK SLASH
UNDL=137	/UNDERLINE


/THESE ARE THE TERMINATORS OF THE ESCAPE SEQUENCES USED BY THE PRINTER.

NLQPSE=4000	/IF THIS CODE IS SET NO OUTPUT WILL OCCUR TO THE LQPSE	/A165
		/FOR THIS SEQUENCE					/A165

PCSTAT="0&177	/LQPSE REQUEST STATUS--OTHERS ENABLE REPORTS & SEND STATUS/A121
PCSTG0="1&177+NLQPSE	/ENABLE G0					/C165
PCSTG1="2&177+NLQPSE	/ENABLE G1					/C165
PCSTFN="3&177+NLQPSE	/ENABLE FONTS (ACTUALLY ANY ATTRIBUTE)	/A151	/C165
PCDPIT="4&177+NLQPSE	/DRAFT PRINTER PITCH			/A151	/C165
PCTABL="5&177		/LQP02 TABLE SELECT				/A173

/ NOTE:  THE FOLLOWING 2 CODES ARE IDENTICAL BUT HAVE DIFFERENT		/A195
/	USES AS EXPLAINED IN THE COMMENTS				/A195
PCREST="6&177		/LQPSE RESTORE
PCTMRS="6&177+NLQPSE	/RESET PRINTER					/C219

PCTMID="7&177		/REQUEST TERMINAL IDENTIFICATION		/A185
PCCOLA="8&177		/NOT LQPSE--COLUMN POSITION ABSOLUTE
PCMPUP="9&177		/TRANSMIT BUT DO NOT FORCE VERTICAL MOTION
PCSQM=":&177+NLQPSE	/SET QUALITY MODE (ONLY FROM OVLAY WITH XSTQM)	/A193
PCMRT=";&177		/TRANSMIT BUT DO NOT FORCE HORIZONTAL MOTION
PCSS=74&177+NLQPSE	/SEND SS2 OR SS3				/A200
PCPROP=75		/ENABLE PROPORTIONAL PRINTING (LQP02 ONLY)	/A040
PCMFV=">&177		/FORCE ACCUMULATED VERTICAL MOTION
PCSUB1="?&177		/USE PRINT POSITION 177--THE FIRST SUBSTITUTE CHARACTER
PCSUB2="@&177		/USE PRINT POSITION 40--THE SECOND SUBSTITUTE CHARACTER
PCCSIZ="A&177		/SET CHARACTER SIZE
PCSPUM="B&177		/SET PUM MODE
PCRPUM="C&177		/RESET PUM MODE
PCBOLD="D&177		/SET HIT COUNT
PCIND="E&177		/SET INDENTATION
PCWSIZ="F&177		/SET SPACE SIZE
PCPLU="G&177		/HALF LINE REVERSE				/A193
PCPSIZ="H&177		/SET PAGE SIZE
PCPLD="I&177		/HALF LINE FORWARD				/A193
PCTRAY="J&177		/SELECT TRAY FOR CUT SHEET FEEDER
PCTCSI="K&177+NLQPSE	/TECHNICAL CHARACTER SET INIT			/A200
PCGR="L&177+NLQPSE	/BEGIN SIXEL GRAPHICS				/A208
PCGREX="M&177+NLQPSE	/EXIT SIXEL GRAPHICS				/A208
PCSGR="N&177		/SELECT GRAPHICS RENDITION (BOLD, UNDERLINE, FONT)/A211
			/MUST *** NOT *** HAVE NLQPSE ATTRIBUTE AS IS	/A211
			/SOMETIMES EXECUTED AS A HARMLESS AND INSTRUCTION/A211
PCPFS="O&177		/PAGE FORMAT SELECT				/A215
PCIVPR="P&177		/increment vertical position relative		/a230
PCDVPR="Q&177		/decrement vertical position relative		/a230
PCIHPR="R&177		/increment horizontal position relative		/a230
PCDHPR="S&177		/decrement horizontal position relative		/a230
PCRSET="T&177		/reset MODES					/a234

/THESE ARE FREQUENTLY USED CONSTANTS

PRMSLK=60	/THE MAXIMUM AMOUNT TO MOVE WHEN GOING IN A REVERSE DIRECTION TO
		/CORRECT SLACK IN PAPER. USED IN SUPER SCRIPT AND MULTI COLUMN
/D128	DELETE MAXMOV SINCE IT IS A REMNANT FROM THE PARALLEL INTERFACE
PRNLSZ=10	/NORMAL LINE SIZE (1/6 INCH)
PRNHL=4		/NORMAL HALF LINE SIZE (1/12) INCH


/THESE ARE THE CIF AND CDF INSTRUCTIONS USED IN THE CODE.

CIFMYF=CIFPRT	/CHANGE INSTRUCTION FIELD TO THIS FIELD
CDFMYF=CDFPRT	/CHANGE DATA FIELD TO THIS FIELD
CDFQUE=CDFMNU	/QUEUE FIELD IS FIELD 2					/A069

FIELD 0

/THIS IS THE PRINTER JOB CONTROL BLOCK.

*PRJOB
	0
	CDFPRT&70^2
	0
	FLD3R			/PRINTER JOB STARTS HERE (ONCE ONLY CODE)
	0


FIELD CDFPRT&70%10		/CHOOSE THE PROPER FIELD

/VALUES ON PAGE ZERO ARE INITIALIZED BY ONCE ONLY CODE NEAR FLD3R	/A166
/THEY ARE *** NOT *** WRITTEN OUT					/A166

/********************************************************************
/
/ THE FOLLOWING LOCATIONS ARE THE LOCATIONS ON THE LOWER HALF
/ OF PAGE ZERO THAT THE PRINTER CODE DOES NOT USE.  WE NOW
/ REV176 BEGIN TO USE THEM
/
* 0
GRALNC,	0		/ NUMBER OF GRAPHIC NEW LINES ENCOUNTERED
* 1
PRFPFS,	0		/ PFS SELECTION FLAG				/A215
* 2
PNRSVL,	0		/ PAGE NUMBER RESET VALUE			/A217
* 3
* 4
* 5
* 6
* 7
		/ TTYIN IS CLOBBERED BY NEW TEXT PROCESSOR		/A215
* XLTIN&177
PRJPOS, 0    / THE NUMBER OF JUSTIFIABLE INTER POSITION SPACES
* HLTFLG&177
PRJSPC, 0    / THE NUMBER OF JUSTIFIABLE SPACES
* UDKOPS&177
PRLBCT, 0    / USED TO SAVE PLCNT THROUGH VARIOUS PASSES
* DEQUE&177
PRRCH,  0    / THE VALUE IN PRINT UNITS OF THE RIGHT END OF LINE
* FRKINT&177
PLPFLG, 0    / ZERO IFF PROPORTIONAL PRINTING IN EFFECT
* FRKXIT&177
PLPS,   0    / THE NUMBER OF EXTRA PRINT UNITS TO ADD TO EACH
             / JUSTIFIABLE SPACE
* FRKCHN&177
PLSS,   0    / THE NUMBER OF EXTRA PRINT UNITS TO ADD TO EACH
             / JUSTIFIABLE INTERPOSITION SPACE
* 44
PLBOLD, 0    / SET TO 400 IF SP YES AND PROPORTONAL PRINTING LQP02
* 45
PRJRET, 0    / THE TYPE OF RETURN IN THE LINE--ZERO IF HARD RET,
             / NON ZERO IF SOFT (WORD WRAPPED)
* 46
RULRCM,	0	/COLUMN OF A CENTERING MARK IN A RULER			/A210
* 47
RULRLM,	0	/COLUMN OF AN F,L,N, OR D IN RULER (LEFT MARGIN)	/A212
* PRPUMM
PRPUMM,	0	/ the PUM mode flag					/a230
* 51
OLDHIT,	0	/ oldhit flag for LQP's					/a235
* 52
* 53
* 54
* 55
* 56
* 57
* 60
RULRRM,	0	/COLUMN OF AN R OR J IN RULER (RIGHT MARGIN)		/A212
* MNUCAL&177
PRMCMG,	0	/COLUMN OF MULTICOLUMN MARGIN				/A212
* MUBASE&177
PRJENB, 0    / COUNT ENABLE FLAG--IS SET UNTIL THE RIGHTMOST TAB
             / IS FOUND, WHEREUPON IT IS CLEARED
             / ALSO DOUBLES AS THE DEFICIENCY VARIABLE USED IN
             / JUSTIFICATION AND IN THE DIVISION ROUTINE
* TIMCAL&177
* OLAYCL&177
* FILEIO&177
/ IOACAL IS DONE BY FLABUZ
* INACAL
* NXACAL
* STCCAL
* CVDCAL
* DIGCAL
* PGSWAP&177
	
*PRSTOP
PRSTOP,	0	/THE STOP FLAG
PRACTN,	0	/THE USER SUPPLIED STOP ACTION
PRACTV,	0	/THE ARGUMENT ASSOCIATED WITH THE STOP ACTION

/***********************************************************************/
/									/
	PRSTTS,	0	/THE CURRENT PRINTER STATUS			/
/		THIS LOCATION IS SET AS FOLLOWS:			/
/	1.	IF 0000 IT MAY BE SET TO 0001 (BUSY)(GETDC)		/
/	2.	IF 0000 OR 0001 IT MAY BE SET TO AN ERROR CODE (PRSTUP)	/
/	3.	IF AN ERROR DECLARED BY THE SPOOLER IT MAY BE RESET	/
/		TO 0000 (IF QUEUE IS EMPTY) ELSE 0001 (PRRSST)		/
/	4.	IF AN ERROR FROM PRINTER THEN IT MAY BE RESET IF THE	/
/		PRINTER REPORTS NO ERROR ANYMORE (PRESET)		/
/									/
/***********************************************************************/
/									/
	PRSTT2,	0	/SECOND PRINTER ERROR STATUS CODE		/
/		THIS LOCATION IS SET AND CLEARED AS FOLLOWS:		/
/	1.	IF 0000 IT MAY BE SET TO AN ERROR CODE (STSTTS)		/
/	2.	RESET TO 0000 WHEN ROLLUP OCCURS (PRSTUP)		/
/	3.	RESET TO 0000 OR 0001 IF PRINTER REPORTS NO ERROR	/
/									/
/***********************************************************************/

PRFNO,	0	/THE FILE NUMBER OF THE PRINTER JOB
PRIRFD,	0	/THE FIELD TO READ FROM IN LIST PROCESSING
PRIRAD,	0	/THE ROUTINE TO USE IN READING IN LIST PROCESSING
PABORT,	0	/THE ABORT FLAG

LPONLN,	0	/ IDENTIFIES TYPE OF PRINTER, FEEDER, ETC		/A113
PRTID,	0	/PRINTER ID ROUTINE ENTRY POINT				/A054
		/THIS LOCATION IS INITIALIZED BY ONCE ONLY CODE		/A166
		/TO CONTAIN PRTRID					/A166

/THESE ARE COMMONLY USED GLOBAL VARIABLES.

PREST1,	0	/ TEMPORARY USED BY PRESCS				/
PROVT1,	0	/ TEMPORARY USED BY PROV AND PRESCS
PROVT2,	0	/ TEMPORARY USED BY PROV AND PRESCS

RDCHAR,	0	/THE LINK TO THE READ ROUTINE WHICH SHOULD BE USED.  THE
		/POSSIBILITIES ARE THE FILE READER (FOR NON-LIST PROCESSING),
		/THE EDITOR READER (FOR LIST PROCESSING WITHOUT HEADERS OR
		/FOOTERS), AND THE DISK BUFFER READER (FOR LIST PROCESSING
		/HEADERS AND FOOTERS).  THE VALUE IS ZEROED WHEN THE END OF
		/THE FILE BEING READ IS FOUND.

PRRM,	0	/RIGHT MARGIN POSITION SPECIFIED BY RULER IF JUSTIFICATION IS
		/IN EFFECT; OTHERWISE, IS ZERO

PRGCBK,	0	/BACKUP LOCATION FOR THE GET CHARACTER ROUTINE

PRCCH,	0	/POSITION WHERE PRINT HEAD WILL STOP AFTER LINE

PLNRCS,	12	/NUMBER OF PRINT UNITS PER CHARACTER			/a233
		/ initialised by once only code				/a233

PRGSVP,	0	/VERTICAL POSITION ON PAGE RELATIVE TO THE TOP
PRGSAP,	0	/ABSOLUTE VERTICAL POSITION ON PAGE RELATIVE TO TOP OF
		/PHYSICAL PAGE.  PRGSVP AND PRGSAP DIFFER ONLY WHEN THE USER
		/STOPS PRINTING, DOES A NEW PAGE, AND CONTINUES.  EVEN THEN,
		/THEY ONLY DIFFER UNTIL THE NEXT PAGE IS STARTED.
PRGSMX,	0	/MAXIMUM VERTICAL POSITION FOR CURRENT TYPE OF PRINTING

PRRLSZ,	0	/SIZE OF THE LINE AS DEFINED BY THE RULER
PRLLSZ,	0	/SIZE OF THE LINE AS DEFINED BY RULER PLUS EXTRA SPACING
		/SET BY PRINT MENU; TRUNCATED TO NEAREST WHOLE LINE IF
		/PRINTING TO DRAFT PRINTER.  THE EXTRA SPACING IS NOT
		/ADDED IF A HEADER OR FOOTER IS BEING PRINTED.

PRSCNM,	0	/SECTION NUMBER
PRPGNM,	0	/PAGE NUMBER
PRPCNT,	0	/PAGE COUNT--IS NOT SUBJECT TO BEING RESET

PRRSRT,	0	/THE RESTART PAGE COUNT--USED WHEN INSTRUCTED TO GO BACK N
		/PAGES AND RESTART

PRYES,	0	/PRINT INHIBIT (0=PRINT ENABLED, NON-ZERO=PRINT DISABLED)

PRSTNX,	0	/STOP AFTER NEXT DONE FLAG

PLPTR,	0	/POINTER INTO THE LINE BUFFER
PLCNT,	0	/COUNTER OF CHARACTERS IN THE BUFFER
PLDIR,	0	/THE DIRECTION OF PRINTING MOTION
PLPOS,	0	/THE SIZE OF THE POSITION CURRENTLY BEING PRINTED

PRFLAG,	0	/HEADER (POSITIVE)/FOOTER (NEGATIVE)/TEXT (ZERO) FLAG

PRMCLM,	0	/LEFT MARGIN OF THE COLUMN IN PRINT UNITS
PRMCTM,	0	/TOP MARGIN OF THE COLUMN IN VERTICAL PRINT UNITS
PRMCBM,	0	/BOTTOM MARGIN OF THE COLUMN IN VERTICAL PRINT UNITS
PRMCPC,	0	/NUMBER OF THE COLUMN PRESENTLY PRINTING
PRMCLL,	0	/MAXIMUM VALUE WHICH RULRRM ATTAINS IN A GIVEN COLUMN; I.E.,
		/THE LONGEST LINE IN A COLUMN
PRMCRF,	0	/THE MULTI-COLUMN REQUEST FLAG

PRHSIZ,	0	/VERTICAL SPACE OCCUPIED BY HEADER; ZERO IF NO HEADER
PRFSIZ,	0	/VERTICAL SPACE OCCUPIED BY FOOTER; ZERO IF NO FOOTER

LPFLAG,	0	/NON-ZERO IF LIST PROCESSING IS IN PROGRESS, ZERO OTHERWISE


PRPASS,	0	/The pass number
PLASPC,	0		/ ACCUMULATED HORIZONTAL MOTION		/M039
PLOLNC,	0		/HORIZONTAL SPACING LAST CHARACTER	/M039
PRJDEF,	0		/ USABLE BY LQPSE AND LQP02		/M067
PRACTS,	0	/ SAVED STOP ACTION					/A101
PRSTT3,	0	/ SAVED PRSTTS WHEN DISPATCH THROUGH STOP OVERLAY	/A104
PLWMUL,	0	/ proportional printing multinational char flag		/a227
IDTMC,	0	/ VALUE TO COMPARE TIMOUT AGAINST			/A107
PRTMOV,	0	/THE TOTAL MOTION WHICH HAS BEEN TRANSMITTED TO THE HANDLER
		/BUT NOT YET FORCED.  IT IS CLEARED EACH TIME PRTMOV
		/IS INVOKED TO FORCE THE MOTION.
VPTR,	0	/A POINTER USED BY THE PARSER				/A114
NUMPTR,	0	/A POINTER USED BY CSISTR
PRBIF,	0	/BOLD INTERPRETATION FLAG				/A150
PRBIFN,	0	/FONT FINAL FOR NONBOLDED TEXT				/A150
PRBIFB,	0	/FONT FINAL FOR BOLDED TEXT				/A150
PRDTFG,	0	/US (ZERO) BRITISH (NONZERO) DATE FLAG			/A182
EXPCNT,	0	/ COUNT OF EXPANSION WHEN PROCESSING BACKSLASH STUFF	/A205
BSLCNT,	0	/ COUNT OF BACKSLASHES IN HEADER/FOOTER LINE		/A205
SOFTPT,	0	/ POSITION OF RIGHTMOST SOFT SPACE IN BUFFER		/A205
XSADX,	0	/ POINTER USED BY ESCST ROUTINE
MNCFLG,	0	/ print a multinational char next if -1			/a227
	PAGE

/***********************************************************************/
/									/
/	OVERLAY AREAS							/
/		THE OVERLAY AREAS AND PAGE ZERO ARE DESIGNED SO THAT	/
/		THEY NEED NOT BE WRITTEN OUT, THUS SAVING SOME		/
/		BLOCKS ON THE SYSTEM DISK.  SEE DSKHND AND WP2CMF	/
/		IF OVERLAYS ARE EXPANDED				/
	PROVA,
	*PROVA+1400							/A178




/***********************************************************************/
/									/
/	/A176	NOTE	NOTE	NOTE	NOTE	NOTE	NOTE	A176	/
/									/
/	Some system initialization code resides in field one at boot
/	time in this overlay area.  That code is assembled with WPSYSA,
/	but resides here.  The writeout code in WP2CMF and the read in
/	table in DSKHND specify that this initialization code get
/	loaded as though it were contiguous with the WPRINT resident
/	code.
/
/	See label PRBOTM defined in WPF1 which defines the bottom
/	of the printer field writeout/read-in code

	X=PRBOTM	/PRINTS VALUE OF PRBOTM IN LISTING

/THIS IS THE RESIDENT ENTRY FOR THE TOP OF PAGE PROCESSING ROUTINE.  IT
/MUST BE RESIDENT BECAUSE THE CALL TO PRGCHR CAN SOMETIMES REQUIRE THE
/USE OF BOTH OVERLAY AREAS.  THIS ONE CHARACTER LOOK-AHEAD IS PERFORMED SO
/THAT ANY HEADER DEFINITIONS WHICH ARE AT THE BEGINNING OF THE PAGE CAN BE
/FOUND.  THE CHARACTER IS SAVED, AND THE OVERLAY CODE WHICH HANDLES THE TOP
/OF THE PAGE IS PROCESSED.  AS WITH ANY FORMATTING ROUTINE, THE EVENTUAL
/RETURN IS TO PRGSL1 IN THE SPACING ROUTINE.

/NOTE THAT THIS POINT IS THE ENTRY INTO THE COPY INITIALIZATION SECTION INTO
/THE COPY PRINTING SECTION.  THUS, THE BASIC PRINTING LOOP IS ENTERED FROM
/THE OUTSIDE VIA THE RETURN FROM THE SPACING ROUTINE--WHICH JUMPS TO PRLOOP.

/DURING DEVELOPMENT OF PRINTER SEND (SENDING ESCAPE SEQUENCES TO PRINTER)
/ IT WAS FOUND THAT IT MAY NOT BE DESIREABLE NOT TO DO ALL OF THE THINGS
/ THAT TAKE PLACE AT THE TOP OF THE PAGE, BEFORE PROCESSING ESCAPE SEQUENCES.
/ FOR INSTANCE, THE HEADER FUNCTIONS OCCURRED
/ BEFORE ANY ESCAPE SEQUENCES THAT WERE TO BE TRANSMITTED.  THIS IS BECAUSE
/ THERE IS NO WAY TO BE ABLE TO INSERT CONTROLS BOTH AT THE TOP OF THE
/ PAGE AND THE TOP OF THE HEADER.  THE LOOKAHEAD GUARANTEES THAT THE CONTROLS
/ WILL BE PROCESSED BEFORE ANY TOP OF PAGE PROCESSING.  THIS IS NECESSARY FOR
/ THE PROPER OPERATION OF RESET.

PRTOPP,
	JMS	PRGCHR	/GET THE NEXT CHARACTER
	DCA	PRGCBK	/AND SAVE IT IN THE BACKUP BUFFER
	TAD   (OVTOPP)	/INVOKE THE TOP OF PAGE PROCESSING OVERLAY
	JMS	PROV
		OBTOPP

PREOF,	0		/ SET TO 1 WHEN E-O-F IS SEEN. BOTP LOOKS AT THIS/A096

/THIS IS THE BASIC LOOP WHICH DOES THE PRINTING.  THERE ARE TWO WAYS
/TO LEAVE THE LOOP:  1)  THE USER STOPS THE PRINTING, AND 2) THE SPACING
/ROUTINE FINDS THE END OF THE DOCUMENT.

/WHEN EVERYTHING IS INITIALIZED FOR A COPY, THE COPY INITIALIZATION
/SECTION INVOKES THE TOP OF PAGE FORMATTING ROUTINE, WHICH RETURNS VIA
/THE SPACING ROUTINE TO PRLOOP.  THIS EFFECTIVELY TRANSFERS CONTROL TO
/THE LOOP.

PRLOOP,

/IF THE STOP FLAG IS SET, THE STOP OVERLAY IS INVOKED.  WHEN THE STOP
/OVERLAY COMPLETES, CONTROL RETURNS TO PRLOOP IF PRINTING IS TO CONTINUE.
/OTHERWISE, CONTROL REMAINS ELSEWHERE AND THE LOOP IS TERMINATED.

	TAD	PRSTOP	/TIME TO STOP?
	SZA CLA
	JMP	PRLOO1	/YES--INVOKE STOP OVERLAY

	TAD	PRMCLL	/ IF NO COLUMN WIDTH YET SET TO CURRENT RULER.	/A091
	SZA CLA		/ SKIP IF NO MAX COL WIDTH YET.			/A091
	JMP	PRLO1A	/ JMP BECAUSE THERE IS A COLUMN WIDTH.		/A091
	TAD	RULRRM	/ GET CURRENT RULER WIDTH.			/A091
	DCA	PRMCLL	/  AND SET MAX COL WIDTH TO IT.			/A091
PRLO1A,									/A091

/PRGTLN READS A LINE FROM THE FILE AND PUTS INTO THE PRINT BUFFER.  IT
/QUITS READING WHEN IT ENCOUNTERS AN EOL CHARACTER.

	DCA	BSLCNT		/ CLEAR COUNTERS FOR HEADER/FOOTER	/A205
	DCA	EXPCNT		/ PROCESSING OF BACKSLASHES		/A205
	DCA	SOFTPT							/A205

	JMS	PRGTLN	

	TAD	SOFTPT		/ GET POINTER TO LAST SOFT SPACE	/A205
	SZA CLA			/ IF THERE ARE NO SOFT SPACES...	/A205
	TAD	BSLCNT		/ GET BACKSLASH CHARACTER COUNTER	/A205
	SNA			/ IF THERE WERE NONE...			/A205
	JMP	PRINHB		/ ...WE DON'T NEED TO DO ANYTHING	/A205
	CIA			/ MAKE NEGATIVE FOR COMPARE		/A205
	TAD	EXPCNT		/ ADD IN EXPANSION COUNT		/A205
	SNA			/ IF NO BIGGER THAN AT FIRST...		/A205
	JMP	PRINHB		/ ...THEN DO NOTHING			/A205
	DCA	EXPCNT		/ ELSE SAVE ADJUSTED VALUE		/A205

	JMS	PROV		/ LOAD OVERLAY				/A205
		OBCLUP							/A205

	JMS	PRCLUP		/ GO CLEAN UP				/A205

/THE PRINT LINE ROUTINE JUSTIFIES (IF NECESSARY) AND PRINTS THE LINE.  IT
/RETURNS TO ONE OF THE TWO ENTRY POINTS INTO THE SPACING ROUTINE, DEPENDING
/ON WHETHER IT HAS PRINTED ANYTHING OR NOT.  IF PRYES IS SET TO INHIBIT
/PRINTING, THERE IS NO REASON TO INVOKE THE PRINT OVERLAY AND THE SPACING
/ROUTINE IS INVOKED DIRECTLY.  THE SPACING ROUTINE RETURNS TO PRLOOP TO
/CONTINUE THE LOOP, UNLESS THE END OF THE FILE IS FOUND, IN WHICH CASE IT
/INVOKES THE END OF COPY OVERLAY.

PRINHB,	TAD	PRYES	/GET THE PRINT INHIBIT FLAG			/C205
	SZA CLA
	JMP	PRGSL1	/GO DIRECTLY TO SPACING ROUTINE

/ DETERMINE WHETHER WE ARE PRINTING TO AN LQP OR A DP/HOST		/C186
/ CALL THE APPROPRIATE JUSTIFICATION OVERLAY				/A186

	JMS	SKIPIF		/					/A186
		LQPMSK		/					/A186
	JMP	PRLLDP		/ GO SEE IF LN03 OR NOT			/A214

	TAD	(OVJUSL		/ LQP, LOAD OVJUSL			/A186
	JMS	PROV		/					/A186
		OBJUSL		/					/C193

PRLLDP,			/ LN03, DP, OR HOST				/A214
	JMS	SKIPIF		/ SEE IF LN03				/A214
		LN03		/					/A214
	JMP	PRLOPD		/ NO, DP OR HOST			/A214

	TAD	(OVLN3A		/ IS LN03, DISPATCH TO OVERLAY		/A214
	JMS	PROV		/					/A214
		OBLN3A		/					/A214

PRLOPD,	TAD	(OVJUSD		/ DP OR HOST				/A186
	JMS	PROV		/					/A186
		OBJUSD		/					/A186

PRLOO1,	TAD    (OVSTP2)		/INVOKE THE STOP OVERLAY
	JMS	PROV
		OBSTP2

/***********************************************************************/
/									/
/	PROV----OVERLAY LOADER						/
/		LOADS OVERLAYS INTO ONE OF THREE OVERLAY AREAS		/
/		EACH OVERLAY IS ONE BLOCK (256 LOCS) IN SIZE		/
/		THE LOCATION FOLLOWING THE JMS PROV			/
/		CONTAINS A VALUE, FOUR BITS OF WHICH DESIGNATE		/
/		WHERE THE OVERLAY IS TO RESIDE, AND 8 BITS OF		/
/		WHICH DESIGNATE THE OVERLAY NUMBER OVNUM		/
/									/
/	CALLING SEQUENCE:						/
/		TAD	(OVENTR		/ADDRESS OFFSET			/
/		JMS	PROV						/
/			OBENTR		/BLOCK OFFSET AND TYPE		/
/									/
/	IF THE ADDRESS OFFSET IS ZERO (PROV CALLED WITH CLEAR AC)/A162	/
/	THEN THE OVERLAY IS LOADED BUT CONTROL IS RETURNED 	/A162	/
/	INLINE.  IN THIS MANNER WE HAVE AN OVERLAY LOAD		/A162	/
/	WITHOUT A CORRESPONDING JUMP TO THAT OVERLAY		/A162	/
/	THIS CAN BE USED TO LOAD AN OVERLAY THAT CONTAINS ONLY TABLES	/
/	OR TO MAKE SURE AN OVERLAY IS LOADED WHEN WE WANT TO CALL	/
/									/
/	A SUBROUTINE IN A **** DIFFERENT **** !!!! OVTYPE OVERLAY, CF:	/
/		CLA							/
/		JMS	PROV						/
/			OBXYZQ		/BLOCK # OF OV OF SUB		/
/		JMS	SUB						/
/									/
/	IF THE LOADED OVERLAY IS OF THE SAME TYPE AS THE OVERLAY/A165	/
/	THAT CALLED PROV, WE HAVE A CONFLICT.  PROV CONTAINS CODE TO	/
/	DETECT THIS ERROR CONDITION AND HALT.				/
/									/
/***********************************************************************/



PROV,	XX
	DCA	PROVT1		/SAVE THE ADDRESS

	TAD I	PROV		/GET BLOCK OFFSET/TYPE
	AND	(7400		/MASK OFF BLOCK BITS
	TAD	(PROVA)		/FORM ADDRESS OF ID LOCATION IN OVERLAY
	DCA	PROVT2		/SAVE THE ADDRESS OF THE FIRST WORD

	TAD I	PROVT2		/ADD THE NEGATIVE OF THE ALREADY LOADED OVERLAY
				/ID NUMBER
	TAD I	PROV		/TO THE DESIRED OVERLAY NUMBER
	AND	P377		/LOOK ONLY AT OVERLAY NUMBER BITS
	SNA CLA
	JMP	PROVL1		/THE RIGHT OVERLAY IS ALREADY LOADED

	TAD	PROVT2		/GET THE ADDRESS OF THE FIRST WORD OF THE AREA
	DCA	PROVQ+3		/SAVE ADDRESS TO LOAD THE OVERLAY IN CALL/C183
	TAD I	PROV		/GET THE BLOCK/TYPE OFFSET
	AND	P377		/MASK TYPE BITS OFF
	TAD	(DLOPRO		/ADD OVERLAY BASE BLOCK
PROVQ,	JMS	PRQRX		/LOAD THE OVERLAY
		RXERD+4000	/READ					/A183
		0		/SYSTEM DRIVE				/A183
		0		/BUFFER ADDRESS				/A183
	JMP	PRQSDE		/IF ERROR, REPORT IT			/A183

/AT THIS POINT, THE PROPER OVERLAY IS LOADED.  JUMP TO THE REQUESTED ADDRESS.

PROVL1,
	TAD	PROVT1		/GET THE ARGUMENT
	SNA			/IF ORIGINAL ARGUMENT WAS ZERO		/A162
	JMP	PROVL2		/GO VALIDATE RETURN ADDRESS	/A162	/C165
	TAD	PROVT2		/ADD THE ADDRESS OF THE FIRST WORD
	DCA	PROVT1		/SAVE TO JUMP THROUGH
	JMP I	PROVT1		/JUMP THERE

PROVL2,			/VALIDATE THE RETURN ADDRESS			/A165
			/IF IT IS TO THE SAME OVERLAY AREA WE LOADED	/A165
			/THEN OUR RETURN IS INVALID			/A165
IFDEF DEVEL1 <		/THIS CODE IS FOR DEVELOPMENT 		/A214
	TAD	PROVT2		/GET ID WORD ADDRESS			/A165
	CIA			/COMPLEMENT IT				/A165
	TAD	PROV		/COMPARE TO  RETURN ADDRESS		/A165
	AND	(7400		/LOOK AT 4 TOP BITS			/A165
	SNA CLA			/SKIP IF DIFFERENT			/A165
	HLT			/THIS IS AN OVERLAY ADDRESS CONFLICT	/A165
	>			/ END IFDEF DEVEL1			/A214
	ISZ	PROV		/BUMP RETURN ADDRESS			/A162
	JMP I	PROV		/RETURN TO OVERLAY THAT CALLED US	/A162

/***********************************************************************/
/									/
/	PRGTLN--PRINTER GET LINE ROUTINE.  GETS A LINE OF TEXT INTO THE	/
/		LINE BUFFER.  HANDLES DEAD KEY SEQUENCES, TECHNICAL	/
/		CHARACTERS, AND LEADING SPACES IN SPECIAL WAYS		/
/									/
/***********************************************************************/


PRGTLN,	XX

/THERE ARE SEVERAL VARIABLES ASSOCIATED WITH READING CHARACTERS AND WRITING
/THEM INTO THE BUFFER WHICH MUST BE INITIALIZED.

	AC0001
	DCA	PLDIR	/MOVE TO THE RIGHT THROUGH THE LINE BUFFER

	TAD   (PRLBUF)	/GET ADDRESS OF BEGINNING OF BUFFER
	DCA	PLPTR	/INITIALIZE THE BUFFER POINTER

	TAD  (-MAXLIN)	/GET THE NEGATIVE OF THE SIZE OF THE BUFFER
	DCA	PLCNT	/SAVE AS A COUNT OF SPACE REMAINING

	DCA	PRTABF	/CLEAR TAB FLAG					/A224

/WE NOW ENTER A LOOP WHICH GETS A CHARACTER AND PUTS INTO THE BUFFER.  WHEN
/AN EOL IS PUT INTO THE BUFFER, THE ROUTINE RETURNS.  PRPCHR MAKES A NORMAL
/RETURN FOR UNLESS EOL IS FOUND, WHEN IT MAKES A SKIP RETURN.

PRGLI1,
	JMS	PRGCHR	/GET NEXT CHARACTER
	JMS	PRPCHR	/STORE IT IN THE BUFFER
	JMP	PRGLI1	/EOL NOT FOUND--CONTINUE THE LOOP

/THE EOL HAS BEEN FOUND.  RECOVER THE EOL TO SAVE IN THE BACKUP BUFFER AND
/THEN RETURN.

	TAD I	PLPTR	/GET THE EOL CHARACTER
	DCA	PRGCBK	/SAVE IN THE BACKUP BUFFER LOCATION
	JMP I	PRGTLN	/AND RETURN

/PART OF PRPCHR SUBROUTINE WHICH HAS OVERFLOWED ITS PAGE!		/A222
/THIS SECTION TREATS BACKSLASHES.  IF A HEADER OR FOOTER IS BEING
/PROCESSED, AN OVERLAY IS INVOKED TO CHECK FOR A DATE OR PAGE INSERTION
/COMMAND.  OTHERWISE, THE BACKSLASH IS TREATED AS A NORMAL CHARACTER.

	BSLASH="=&177 							/A238


PRGLO7,
	TAD   (40-BSLASH)/IS THE TEXT A BACKSLASH?			/mrcm
	SZA CLA
	JMP	PRGL7A	/NO--TREAT AS NORMAL CHARACTER

	TAD	PRFLAG	/IS A HEADER OR FOOTER BEING PRINTED?
	SNA CLA
	JMP	PRGL7A	/NO--TREAT BACKSLASH AS NORMAL CHARACTER

	DCA	PRTABF	/CLEAR TAB FLAG					/A222
	TAD   (OVBSLH)	/TREAT IN AN OVERLAY
	JMS	PROV
		OBBSLH
/-------------------
	PAGE

/PRGSPC HANDLES VERTICAL SPACING AND FORMATTING ON THE PAGE.  THERE ARE TWO
/ENTRY POINTS.  THE ENTRY POINT PRGSPC IS USED BY THE LQP LINE PRINTING
/ROUTINE IF IT HAS ACTUALLY PRINTED A LINE (AS OPPOSED TO STRIPPING THE
/WHOLE THING) IN WHICH CASE IT HAS ALREADY PERFORMED TWO HALF-SPACING
/OPERATIONS WHICH ARE COMPENSATED FOR BY INITIALIZING PRGSVS TO NEGATIVE
/THE LINE SIZE.  PRGSL1 IS THE ENTRY POINT USED IN ALL OTHER CASES (LINE
/PRINTER PRINTING, LQP PRINTING BUT ENTIRE LINE STRIPPED, PRINTING SUPPRESSED
/DUE TO PRINT INHIBIT FLAG.

/PRGSL1 IS ALSO THE RETURN POINT FOR THE FORMATTING ROUTINES WHICH ARE INVOKED
/DURING THIS ROUTINE.  PRGSPC RETURNS TO PRLOOP AT THE TOP OF THE BASIC
/PRINTING LOOP.

PRGSPC,
	TAD  (-PRNLSZ)	/SET PRGSVS TO COMPENSATE FOR SPACING ALREADY
			/PERFORMED IN LQP LINE PRINTIG ROUTINE

/THIS IS THE POINT TO WHICH ANY FORMATTING ROUTINES PERFORM.  NOTE THAT
/ANY UNCOMPLETED VERTICAL SPACING IS FORGOTTEN UPON RETURN FROM A FORMATTING
/ROUTINE.  THIS IS A DESIRABLE SIDE EFFECT SINCE, FOR INSTANCE, SPACE
/ACCUMUATED AT THE END OF A PAGE HAS NO BUSINESS SPILLING OVER ONTO THE NEXT
/PAGE.

PRGSL1,
	DCA	PRGSVS	/CLEAR ACCUMULATED VERTICAL SPACING

/WE NOW ENTER A LOOP WHICH DOES SPACING AND DETERMINES WHAT FORMATTING IS
/NECESSARY.  THE CALL TO PRGCHR CAN RESULT IN ONE OF FIVE POSSIBLE RETURNS,
/AS WELL AS IN A FLAG'S BEING SET.  THE ACTION OF THE ROUTINE IS BASED ON
/THE TYPE OF RETURN.

PRGSL2,
	DCA	PRMCRF	/CLEAR THE MULTI-COLUMN REQUEST FLAG
	JMS	PRGCHR	/GET A CHARACTER
	DCA	T1	/AND SAVE IT

/AS MENTIONED ABOVE, WE ARE INTERESTED IN THE STATE OF THE MULTI-COLUMN
/REQUEST FLAG (PRMCRF) AND IN THE RETURN CHARACTER (T1).  THERE ARE TWO
/CASES BASED ON THE STATE OF THE FLAG.

/CASE ONE - THE MULTI-COLUMN REQUEST FLAG IS SET
/IN THIS CASE, A NEW SET OF COLUMNS MUST BE BEGUN.  EXACTLY WHAT HAPPENS
/DEPENDS ON WHETHER THE NEW COLUMNS CAN BEGIN ON THIS PAGE OR IF THEY MUST
/BE DEFERRED TO THE NEXT PAGE.

/1.  THE NEW COLUMNS MAY BEGIN ON THE CURRENT PAGE ONLY IF WE ARE CURRENTLY
/    PRINTING THE FIRST COLUMN, AND ONLY IF THE ACCUMLATED VERTICAL SPACING
/    ADDED TO THE CURRENT VERTICAL POSITION DOES NOT EXCEED THE BOTTOM
/    MARGIN (THE LATTER POINT A CONCERN ONLY UNDER AUTOMATIC PAGINATION).
/    IN THIS CASE, THE ACCUMULATED SPACING IS PERFORMED AND THE NEW COLUMN
/    FORMATTING ROUTINE IS EXECUTED.

/2.  IN ANY OTHER CASE, THE TOP OF FOOTER FORMATTING ROUTINE IS EXECUTED
/    SO THAT A NEW PAGE ON WHICH TO BEGIN THE COLUMNS WILL BE FORCED.


/CASE TWO - THE MULTI-COLUMN REQUEST FLAG IS NOT SET
/IN THIS CASE, WE ARE INTERESTED IN THE TYPE OF RETURNED CHARACTER.  THE
/POSSIBILITIES ARE:

/1.  LINE FEED - THE VARIABLE PRGSVS IS THE ACCUMULATED VERTICAL SPACING
/                SINCE THIS ROUTINE WAS ENTERED OR A FORMATTING ROUTINE
/        	 WAS EXECUTED.  WE MERELY UPDATE PRGSVS BY ADDING IN THE
/		 CURRENT SIZE OF A LINE AND CONTINUE THE LOOP.

/2.  PAGE MARKER - IF AUTOMATIC PAGINATION IS IN EFFECT, THIS CHARACTER IS
/                  IGNORED AND WE CONTINUE THE LOOP.  OTHERWISE, THIS
/    		   CHARACATER IS TREATED AS A NEW PAGE.

/3.  NEW PAGE - IF PRINTING A HEADER, BOTTOM OF HEADER FORMATTING IS DONE.
/	        IF PRINTING A FOOTER, BOTTOM OF FOOTER FORMATTING IS DONE.
/   	        IF PRINTING REGULAR TEXT, NEXT COLUMN FORMATTING IS DONE.

/4.  END OF FILE - IF PRINTING A HEADER, BOTTOM OF HEADER FORMATTING IS DONE.
/  		 - IF PRINTING A FOOTER, BOTTOM OF FOOTER FORMATTING IS DONE.
/		 - IF PRINTING REGUALR TEXT, TOP OF FOOTER FORMMTTING IS
/  		    DONE.

/      NOTE THAT IN THE CASE OF HEADERS OR FOOTERS, THE END OF FILE FLAG'S
/      BEING SET MEANS ONLY THE END OF THE HEADER OR FOOTER WAS FOUND.  IN
/      THE CASE OF REGULAR TEXT, IT MEANS THE END OF THE FILE WAS ACTUALLY
/      FOUND.  HENCE, ANOTHER COLUMN IS NOT ATTEMPTED AS IN A NEW PAGE BECAUSE
/      THERE CAN BE NO MORE TEXT FOR ANOTHER COLUMN.

/5.  NONE OF ABOVE - IF AUTOMATIC PAGINATION IS NOT IN EFFECT, THE ACCUMULATED
/      		     VERTICAL SPACING IS PERFORMED AND WE RETURN TO THE BASIC
/		     LOOP.  IF AUTOMATIC PAGINATION IS IN EFFECT, THE
/		     ACCUMULATED SPACING IS PERFORMED ONLY IF IT DOES NOT
/		     EXCEED THE LOWER MARGIN.  OTHERWISE, THE SITUATION IS
/		     TREATED AS A NEW PAGE.  IN ANY CASE, THE RETURNED
/		     CHARACTER IS SAVED IN THE BACKUP BUFFER.

/WE NOW BRANCH ACCORDING TO WHICH CASE IS IN EFFECT.

	TAD	PRMCRF	/IS THE MULTI-COLUMN REQUEST FLAG SET?
	SNA CLA
	JMP	PRGSL3	/NO--CONTINUE BY EXAMINING THE CHARACTER

/THE MULTI-COLUMN REQUEST FLAG IS SET.

	TAD	T1	/GET THE RETURNED CHARACTER
	DCA	PRGCBK	/SAVE IN THE BACKUP BUFFER

/IF THE ACCUMULATED SPACING WILL CAUSE A BOUNDARY OVERFLOW,	/A031
/LSPACE WILL MAKE A NORMAL RETURN.  OTHERWISE,
/IT WILL DO THE SPACING AND MAKE A SKIP RETURN.
	JMS	LSPACE	/SEE IF THE ACCUMULATED SPACING FITS ON THIS PAGE
	JMP	PRGSLA	/NO---JUMP TO FORCE A NEW PAGE

/BEGIN NEW COLUMNS ON THE CURRENT PAGE, IMMEDIATELY BELOW LONGEST OF
/PREVIOUS COLUMNS.

	TAD	PRGSVP	/YES--START NEW COLUMNS ON CURRENT PAGE
	CIA		/ADVANCE TO FOOT OF LONGEST COLUMN
	TAD	PRMCBM	/  AMOUNT = PRMCBM-PRGSVP
	SMA		/  CURRENT COLUMN IS LONGEST IF MINUS
	JMS	PRMOVE	/  GO DO IT
	CLA		/IN CASE WE SKIPPED PRMOVE
	TAD	PRQINU	/RETURN TO NORMAL INDENTION
	JMS	PRESCS	/  SEND INDENT TO HANDLER
		PCIND
	DCA	PRMCLM	/  RESET LEFT MARGIN VARIABLE
	TAD	PRQIND	/ GET INDENT FROM PRINT MENU IN COLUMNS		/A212	
	DCA	PRMCMG	/ RESET MULTICOLUMN LEFT COLUMN VALUE		/A212
	TAD	(CR)	/  SEND CARRIAGE RETURN TO FORCE INDENT
	JMS	PRCHAR
	JMP	PRGSL8	/THEN START NEW COLUMNS
/BEGIN NEW COLUMNS ON NEXT PAGE SINCE NO ROOM ON CURRENT PAGE.
PRGSLA,
	TAD	PRMCAY	/GET THE NUMBER OF COLUMNS
	DCA	PRMCPC	/SET THE CURRENT COLUMN TO THAT VALUE--A NEW PAGE
			/WILL NOW BE FORCED
	JMP	PRGSL6	/JUMP TO TREAT AS A FORM FEED

/THE MULTI-COLUMN REQUEST IS NOT SET, SO CASE TWO HOLDS.  SEE WHAT TYPE
/OF CHARACTER WAS RETURNED AND BRANCH ACCORDINGLY.

PRGSL3,
	TAD	T1	/RECOVER THE CHARACTER
	TAD	(-PM)	/IS IT A PAGE MARKER?
	SNA CLA
	JMP	PRGSL5	/YES--JUMP TO TREAT IT

	TAD	T1	/RECOVER THE CHARACTER
	AND	P177	/STRIP THE MODE BITS
	SZA		/IS IT THE END OF THE FILE?
	TAD	(-FF)	/OR A FORM FEED?
	SNA
	JMP	PRGSL6	/YES--JUMP TO TREAT IT

	TAD	(FF-LF)	/IS IT A LINE FEED?
	SNA CLA
	JMP	PRGSL4	/YES--JUMP TO TREAT IT

/WE HAVE FOUND A NON-SPECIAL CHARACTER.  IF THE ACCUMULATED VERTICAL
/SPACING FORCES A TRANSITION, TREAT AS A NEW PAGE.  OTHERWISE, DO THE
/SPACING AND RETURN.

	TAD	T1	/RECOVER THE CHARACTER
	DCA	PRGCBK	/SAVE IN THE BACKUP LOCATION

	JMS	LSPACE	/SEE IF THE SPACING FITS IN THIS COLUMN,
			/HEADER, OR FOOTER
	JMP	PRGSL6	/NO--EXECUTE THE NEXT COLUMN ROUTINE
	JMS	LSPAC2	/SEE IF NEXT(NEW/CURRENT) LINE FIXS ON THIS PAGE/A097
	JMP	PRGSL6	/NO--EXECUTE THE NEXT COLUMN ROUTINE.		/A097
	JMP	PRLOOP	/YES--THE SPACING IS NOW DONE SO RETURN
PRGSL4,		/WE HAVE FOUND THE LINE FEED

PRGSL4,		/WE HAVE FOUND THE LINE FEED
	TAD	PRLLSZ		/GET THE SIZE OF THE LINE
	TAD	PRGSVS	/ADD TO THE ACCUMULATED VERTICAL SPACING
	JMP	PRGSL1	/GO SAVE AS THE NEW ACCUMULATED VERTICAL SPACING
			/AND CONTINUE THE LOOP


/WE HAVE FOUND A PAGE MARKER.  IF AUTOMATIC PAGINATION IS IN EFFECT, IGNORE
/IT.  OTHERWISE, TREAT AS A NEW PAGE.

PRGSL5,
	TAD	PRQAPG	/IS AUTOMATIC PAGINATION IN EFFECT?
	SZA CLA
	JMP	PRGSL2	/YES--IGNORE THE CHARACTER


/WE HAVE FOUND A NEW PAGE, THE END OF THE FILE, A VALID PAGE MARKER, OR AN
/AUTOMATIC PAGINATION END OF COLUMN.  IF WE ARE CURRENTLY PRINTING A HEADER,
/WE CONTINUE WITH BOTTOM OF HEADER PROCESSING.  IF WE ARE CURRENTLY PRINTING
/A FOOTER, WE CONTINUE WITH BOTTOM OF FOOTER PROCESSING.   IF WE ARE CURRENTLY
/PRINTING REGULAR TEXT, WE CONTINUE WITH NEXT COLUMN PROCESSING.  IN THE
/OVERLAY, IT IS DETERMINED WHETHER OR NOT THE END OF FILE WAS REACHED.  IF
/IT WAS, A TRANSFER IS MADE TO TOP OF FOOTER PROCESSING.

/IN THIS WAY, THE ACTIONS SPECIFIED IN THE COMMENTS ABOVE ARE CARRIED OUT.

PRGSL6,
	TAD	PRFLAG	/GET THE TYPE OF PRINTING GOING ON
	SNA
	JMP	PRGSL7	/REGULAR TEXT--NEXT COLUMN PROCESSING
	SPA CLA

	TAD (OVBOTF-OVBOTH)	/END OF FOOTER PROCESSING
	TAD (OVBOTH-OVNXTC)	/END OF HEADER PROCESSING
PRGSL7,	TAD (OVNXTC-OVNEWC)	/NEXT COLUMN PROCESSING

PRGSL8,	TAD   (OVNEWC)		/NEW COLUMN PROCESSING
	JMS	PROV
		OBNEWC		/ALL OF THE ABOVE OFFSETS MUST BE IN THE SAME
				/OVERLAY ELSE WE WILL HAVE TO CHANGE THIS

PRGSVS,	0	/ACCUMULATED VERTICAL SPACING



/THIS ROUTINE IS A UTILITY ROUTINE FOR THE SPACING ROUTINE.  IF THE
/ACCUMULATED VERTICAL SPACING WILL FIT IN THE CURRENT COLUMN WITHOUT
/CAUSING AN AUTOMATIC PAGINATION OVERFLOW, THE MOVE IS MADE AND A SKIP
/RETURN EXECUTED.  OTHERWISE, A REGULAR RETURN IS MADE.

/AC=0
/JMS	LSPACE
/AC=0, NO ROOM
/AC=0, ROOM

LSPACE,
	XX

	TAD	PRFLAG	/ARE WE PRINTING A HEADER OR FOOTER?
	SNA
	TAD	PRQAPG	/OR IS AUTOMATIC PAGINATION IN EFFECT?
	SNA CLA
	JMP	LSPAC1	/NO--THE SPACING FITS BY DEFINITION

/AUTOMATIC PAGINATION IS IN EFFECT.  SEE IF THE SPACING WILL FIT INTO THE
/MAXIMUM ALLOWABLE.

	TAD	PRGSVS	/GET ACCUMULATED VERTICAL SPACING
	TAD	PRGSVP	/ADD TO THE CURRENT VERTICAL POSITION
	CIA
	TAD	PRGSMX	/SUBTRACT FROM THE MAXIMUM VERTICAL POSITION
	SPA SNA CLA
	JMP I	LSPACE	/IT DOESN'T FIT--MAKE A REGULAR RETURN

/THE SPACING FITS.  DO THE MOVE AND MAKE A SKIP RETURN.

LSPAC1,
	TAD	PRGSVS	/GET ACCUMULATED VERTICAL SPACE
	JMS	PRMOVE	/DO THE MOVE
	ISZ	LSPACE	/INCREMENT THE RETURN
	JMP I	LSPACE	/AND RETURN


/THIS ROUTINE IS A UTILITY ROUTINE FOR THE SPACING ROUTINE.  IF THE 	/A097
/VERTICAL SPACING FOR THE NEW LINE WILL FIT IN THE CURRENT COLUMN	/A097
/WITHOUT CAUSING AN AUTOMATIC PAGINATION OVERFLOW, A SKIP RETURN IS	/A097
/EXECUTED. OTHERWISE, A REGULAR RETURN IS MADE.				/A097
									/A097
/AC=0									/A097
/JMS	LSPAC2								/A097
/AC=0, NO ROOM								/A097
/AC=0, ROOM								/A097
									/A097
LSPAC2,									/A097
	XX								/A097
									/A097
	TAD	PRFLAG	/ARE WE PRINTING A HEADER OR FOOTER?		/A097
	SNA								/A097
	TAD	PRQAPG	/OR IS AUTOMATIC PAGINATION IN EFFECT?		/A097
	SNA CLA								/A097
	JMP	LSP2C1	/NO--THE SPACING FITS BY DEFINITION		/A097
									/A097
/AUTOMATIC PAGINATION IS IN EFFECT.  SEE IF THE SPACING WILL FIT INTO	/A097
/THE MAXIMUM ALLOWABLE.							/A097
									/A097
	TAD	PRLLSZ	/GET SIZE OF LINE TO BE PRINTED ON THIS PAGE.	/A097
	TAD	PRGSVP	/ADD TO THE CURRENT VERTICAL POSITION		/A097
	CIA								/A097
	TAD	PRGSMX	/SUBTRACT FROM THE MAXIMUM VERTICAL POSITION	/A097
	SMA CLA		/SKIP IF IT DOESN'T FIT. MAKE A REGULAR RETURN.	/A097
LSP2C1,	ISZ	LSPAC2	/THE SPACING FITS.  DO A SKIP RETURN.		/A097
	JMP I	LSPAC2	/AND RETURN					/A097

PRFBC,	0	/ contains fallback characters loaded from panel	/a227
	0	/ contains fallback characters loaded from panel	/a227

/------------------
	PAGE

/PRPCHR - INSERTS THE CHARACTER IN THE AC INTO THE LINE BUFFER (PRLBUF)

/AC=CHARACTER TO STORE
/JMS	PRPCHR
/REGULAR RETURN
/EOL RETURN

/THIS ROUTINE TREATS SIX DISTINCT TYPES OF CHARACTERS TO INSERT INTO
/THE BUFFER--TEXT CHARACTERS, SPACES, TABS, LINE TERMINATORS, BEGINNINGS
/OF DEAD KEY SEQUENCES, AND ENDS OF DEAD KEY SEQUENCES.  EACH IS TREATED
/SEPARATELY.


PRPCHR,	XX
	DCA I	PLPTR	/SAVE THE CHARACTER IN THE BUFFER
	TAD I	PLPTR	/AND RECOVER IT
	TAD	(-2040)		/SEE IF TAB SPACE			/A222
	SNA			/					/A222
	JMP	PRPTSP		/YES					/A222
	AND	P177		/MASK OUT THE MODE BITS

/WE NOW DETERMINE WHAT TYPE OF CHARACTER IT IS AND JUMP ACCORDINGLY.
/THE AC WILL BE ZERO IF IT IS A SPACE					/A222
	SNA CLA								/C222
	JMP	PRGLO1		/YES--JUMP TO HANDLE IT
	TAD I	PLPTR		/GET CHR AGAIN				/A216
	AND	P177		/MASK AGAIN				/A216
	TAD	(-SPC)		/SEE IF A CONTROL CHARACTER		/A216
	SMA			/OR A TEXT CHARACTER?
	JMP	PRGLO7		/TEXT--JUMP TO HANDLE IT
	TAD   (SPC-15)	/IS IT THE END OF A DEAD KEY SEQUENCE? (15)
	SNA
	JMP	PRGLO9	/YES--JUMP TO HANDLE IT
	TAD	(15-BS)	/IS IT THE BEGINNING OF A DEAD KEY SEQUENCE?
	SNA
	JMP	PRGLO8	/YES--JUMP TO HANDLE IT

/THREE THINGS CAN END A LINE--14 (FORM FEED), 12 (LINE FEED), 0 (END OF FILE)

	TAD	(BS)	/IS IT THE END OF THE FILE OR COMMAND BLOCK?
	SZA
	TAD    (-14)	/IS IT A FORM FEED?
	SZA
	TAD    (14-12)	/IS IT A LINE FEED?
	SNA
	JMP	PRGL10	/YES--JUMP TO HANDLE IT

	TAD   (12-TAB)	/IS IT A TAB?
	SZA CLA
	JMP I	PRPCHR	/NO--THE CHARACTER IS NOT RECOGNIZED SO RETURN

/FALL THROUGH TO HANDLE A TAB.


/THIS SECTION TREATS TABS.  ALL SPACES WHICH FOLLOW AND ARE PART OF THE TAB
/SPACE (BIT 1 IS SET) MUST HAVE THIS TAB CHARACTER'S MODE BITS ATTACHED.
/HENCE, WE CREATE A TAB SPACE (2040) COMBINED WITH THIS TAB'S MODE BITS.
/ALL TAB SPACES WHICH FOLLOW WILL BE REPLACED BY THIS CHARACTER.

PRPTAB,		/ALSO ENTER HERE IF A SPACE AND PRTABF NONZERO		/A222
	TAD I	PLPTR	/RECOVER THE TAB OR SPACE
	AND	(1600)	/GET THE MODE BITS
	TAD	(2040)	/ATTACH TO A TAB SPACE
	DCA	PRTABF	/SAVE IT AS THE REPLACEMENT CHARACTER
	JMP	PRPTSP	/CONTINUE BY REPLACING THE TAB ITSELF		/C222

PRGLO1,		/THIS SECTION TREATS NON TAB SPACES			/C193

/SPACES MAY OCCUR IN NORMAL TEXT OR IN DEAD KEY SEQEUCES.  SPACES WHICH	/A193
/ARE THE FIRST CHARACTER IN A DEAD KEY SEQUENCE HAVE SPECIAL MEANING.	/A193
/THERE ARE CURRENTLY TWO TYPE OF SPECIAL DEAD KEY SEQUENCES WHERE THE	/A193
/FIRST CHARACTER IS A SPACE:						/A193
/	1.	REQUIRED SPACE	SD-SP-SP-ED				/A193
/	2.	TECHNICAL CHR	SD-SP-DG-TC-ED				/A193
/		DG IS AN ASCII DIGIT INDICATING THE G SET THE TC IS IN	/A193
/		TC IS THE ASCII POSITION IN THAT G SET			/A193
/	3.	TECHNICAL CHR DEADED WITH NORMAL CHR			/A193
/				SD-SP-DG-TC-CH-CH .. ED			/A193
/		IN THIS CASE, CH'S ARE NORMAL CHARACTERS WHICH		/A193
/		HAVE BEEN DEADED IN TO THE TECHNICAL CHARACTER		/A193
/		CHARACTERS WHICH HAVE BEEN DEADED INTO THE TECH CHR	/A193

/FIRST WE MUST SEE WHETHER THIS SPACE IS THE FIRST CHARACTER		/A193
/OF A DEAD KEY SEQUENCE							/A193

	TAD	PRDKFG		/GET DEAD KEY FLAG			/A193
	IAC			/SEE IF WAS 7777			/C194
	SNA			/					/C194
	JMP	PRGL20		/YES, SPACE FIRST CHR IN DKS		/A193
	SPA CLA			/IF STILL MINUS MUST HAVE BEEN 7776	/A194
	JMP	PRGL21		/7776, HANDLE REQUIRED SPACE		/A193
	JMP	PRGL2A		/ELSE 					/A222

/TREAT TAB SPACES ONLY.  IF A SPACE					/C222
/IS PART OF A TAB, IT IS REPLACED BY THE VALUE STORED IN PRTABF.  (PROVIDED
/THERE IS A VALUE THERE.  IN THE CASE OF CENTERED LINES AND INDENTED
/WORDWRAP, FLAGGED SPACES ARE NOT PRECEEDED BY A TAB.  THESE ARE NOT
/REPLACED SINCE PRTABF WILL BE ZERO.

PRPTSP,	TAD	PLPTR		/ GET POINTER FOR THIS SOFT SPACE	/A205
	DCA	SOFTPT		/ PUT IT IN HERE FOR FUTURE REFERENCE	/A205
	TAD	PRTABF		/GET THE TAB OF WHICH THIS SPACE IS A PART
	SZA
PRGL2B,	DCA I	PLPTR		/REPLACE IT IN THE BUFFER
PRGL2A,	TAD	PRDKFG	/GET THE OVERSTRIKE FLAG
	SMA SZA		/IF FLAG IS POSITIVE, WE ARE IN OVERSTRIKE MODE
	JMP	PRGLO4	/JUMP TO INSERT BACKSPACE INTO BUFFER

/IF THE FLAG IS ZERO, WE WANT IT TO REMAIN ZERO.  IF THE FLAG IS NEGATIVE,
/WE SHOULD ENTER OVERSTRIKE MODE WITH THE NEXT CHARACTER, SO THE FLAG SHOULD
/BECOME POSITIVE.

	CIA		/IF FLAG IS NEGATIVE, IT BECOMES POSITIVE.  IF
			/FLAG IS ZERO, IT REMAINS ZERO
	DCA	PRDKFG	/UPDATE THE DEAD KEY FLAG
	JMP	PRGLO5	/SKIP DEAD KEY CODE


/THIS SECTION HANDLES TEXT CHARACTERS, SPACES, AND TABS ALIKE AFTER
/THEY HAVE RECEIVED MORE SPECIFIC TREATMENT.  THE BASIC IDEA IS TO INSURE
/A CHARACTER'S POSITION IN THE BUFFER BY CALLING PLNXT TO INCREMENT THE
/BUFFER VARIABLES.  HOWEVER, IF WE ARE PROCESSING A DEAD KEY SEQUENCE,
/WE MUST BE SURE TO INSERT A BACKSPACE BEFORE EACH CHARACTER IN THE
/SEQUENCE AFTER THE FIRST.

PRGL7A,	DCA	PRTABF		/CLEAR TAB FLAG				/A222
PRGLO3,	AC0002		/SEE IF WE ARE PROCESSING THE FIRST		/A194
	TAD	PRDKFG	/(TECHNICAL) CHARACTER				/A194
	SPA		/ if so skip					/a227
	JMP	PRGSCH	/ this must be the special char we have been 	/a227
			/ waiting for					/a227	
	SNA CLA		/						/A194
	JMP	PRGL22	/YES, GO PROCESS				/A194

	TAD I	PLPTR	/RECOVER THE CHARACTER				/A018
	AND	(1777)	/MASK OUT THE TWO HIGH BITS--THESE BITS ARE	/A018
			/USED FOR JUSTIFICATION PURPOSES AND ANY	/A018
			/GARBAGE WHICH MAY BE THERE MUST BE REMOVED	/A018
	JMP	PRGL2B		/GO SAVE BACK IN THE BUFFER		/C222


/THIS SECTION INSERTS A BACKSPACE INTO THE BUFFER BEFORE THE CURRENT
/CHARACTER SINCE IT IS IN A DEAD KEY SEQUENCE.

PRGLO4,
	CLA
	TAD I	PLPTR	/GET THE CHARACTER FROM THE BUFFER
	DCA	T1	/SAVE IT

	TAD	(BS)	/GET A BACKSPACE
	DCA I	PLPTR	/AND STORE IT IN THE BUFFER

	JMS	PLNXT	/UPDATE THE BUFFER
	NOP		/OVERWRITE IF THERE'S NO MORE ROOM
	TAD	T1	/GET THE CHARACTER BACK
PRGL4A,									/A193
	DCA I	PLPTR	/SAVE IT IN THE BUFFER


/THIS SECTION WRITES THE CHARACTER PERMANANTLY INTO THE BUFFER

PRGLO5,
	TAD I	PLPTR	/RECOVER THE CHARACTER
	AND	(1600)	/SAVE THE MODE BITS
	DCA	PRHMOD	/SAVE FOR MODE OF HYPHEN EOL FUTURE COMPARISON
									/D018
	JMS	PLNXT	/UPATE THE BUFFER POINTERS
		NOP	/OVERWRITE IF THERE'S NO MORE ROOM

/THIS IS ALSO THE RETURN POINT FOR THE OVERLAY WHICH HANDLES BACKSLASHES.

PRGLO6,
	JMP I	PRPCHR	/RETURN


PRGL20,		/SPACE IS FIRST CHR IN DEAD KEY SEQUENCE		/A193
	AC7776			/SET THE DEAD KEY FLAG TO -2		/A193
	JMP	PRGLO9		/GO SET DEAD KEY FLAG & EXIT		/C222

PRGL21,			/REQUIRED SPACE					/A193
	TAD I	PLPTR		/GET CHR WITH MODE BITS			/A193
	AND	(1600)		/ISOLATE MODE BITS			/A193
	TAD	(RQSP)		/ADD IN CODE FOR REQUIRED SPACE		/A193
	JMP	PRGL4A		/GO SAVE, BUMP, AND EXIT		/A193

/****************** NOTE ***********************************************/A194
/									/A194
/IF WE ARE PROCESSING THE FIRST NORMAL CHARACTER IN A SEQUENCE		/A194
/THAT BEGAN (START DEAD) (SPACE) THEN IT IS A TECHNICAL CHARACTER	/A194
/THIS CHARACTER IS AN ASCII DIGIT WHICH IDENTIFIES THE GX SET WHERE	/A194
/THE TECHNICAL CHARACTER WILL BE FOUND AS FOLLOWS:			/A194
/	G1	USASCII							/A194
/	G2	DEC SUPPLEMENTAL					/A194
/	G3	DEC TECHNICAL						/A194
/									/A194
/****************** NOTE ***********************************************/A194
/									/A194
/	THE ABOVE IMPLIES THAT NOT ALL THE TECHNICAL CHARACTERS ARE	/A194
/	FOUND IN THE DEC TECHNICAL CHARACTER SET.			/A194
/									/A194
/****************** NOTE ***********************************************/A194
/									/A194
/ IN ORDER TO IMPLEMENT TECHNICAL CHARACTERS WE WILL MULTIPLEX THE	/A194
/ USE OF G1 IN ORDER TO PRESERVE THE BOLD INTERPRETATION FUNCTIONALITY	/A194
/ INTRODUCED IN VERSION 1.5 OF DECMATE-II				/A194
/									/A194
/****************** NOTE ***********************************************/A194

PRGL22,			/TECHNICAL CHARACTER				/A194
/d227	ISZ	PRDKFG		/ENTER NORMAL DEAD KEY MODE (-2 TO -1)	/A194
	TAD I	PLPTR		/GET THE DIGIT				/A194
	AND	(7337)		/MASK ITS ATTRIBUTE BITS AND		/C211
				/MAKE IT A CONTROL CODE IN THE RANGE	/A194
				/OF 21-23				/A194
/d227	JMP	PRGL4A		/GO RESAVE IN BUFFER & DO NXT CHR	/A194
	DCA	PRGCCS		/save the control code			/a227		
	AC7775			/ set up tech/multinat char expected	/a227
	JMP	PRGLO9		/ go wait for the next char		/a227


/THIS SECTION TREATS DEAD KEY SEQUENCE DELIMITORS.  IF A DEAD KEY SEQUENCE
/IS BEGINNING, SET THE OVERSTRIKE NEGATIVE.  IF AT THE END, CLEAR IT.

PRGLO8,			/BEGINNING OF DEAD KEY SEQUENCE
	AC7777
PRGLO9,			/END OF DEAD KEY SEQUENCE
	DCA	PRDKFG
	JMP I	PRPCHR	/DON'T STORE BUT MAKE NORMAL RETURN


/THIS SECTION TREATS LINE TERMINATORS.  IF THE LINE TERMINATOR IS A WORD-
/WRAPPED (AC1=1) AND HYPHENATED (AC3=1) END OF LINE, A HYPHEN IS INSERTED
/INTO THE BUFFER.  IN ANY CASE, THE END OF LINE IS THEN INSERTED INTO THE
/BUFFER.

PRGL10,
	ISZ	PRPCHR	/PREPARE TO MAKE EOL RETURN

	TAD I	PLPTR	/RECOVER THE CHARACTER
	TAD 	(-2412)	/SEE IF IT'S A HYPHENATED END OF LINE (AC1=1, AC3=1)
	SZA CLA
	JMP I	PRPCHR	/RETURN IF NOT

/WE MUST INSERT A HYPHEN INTO THE BUFFER.  THIS IS DONE IN AN OVERLAY.

	TAD   (OVIHYP)	/RETURN IS MADE TO PRGLO6
	JMS	PROV
		OBIHYP

/ Deal with the special char						/a227
PRGSCH,	JMS	BHOOK	/ call the blaster				/a227	
	SPECEN		/ table entry					/a227
	ISZ	PRDKFG	/ enter normal dead key mode			/a227
	ISZ	PRDKFG	/ enter normal dead key mode			/a227
	JMP	PRGLO6	/ return 					/a227

PRGCCS,	0	/ holds the control code 21,22,23 for tech/multinat/line /a227
PRHMOD,	0	/RECORDS MODE BITS OF LAST CHARACATER INSERTED INTO BUFFER SO
		/THAT AN INSERTED HYPHEN CAN TAKE ITS MODE BITS

PRDKFG,	0	/DEAD KEY FLAG.  CAN TAKE VALUES:			/C194
		/7775 -- Tech/multinat/line char expected		/a227
		/7776 -- START DEAD, SPACE
		/7777 -- START DEAD
		/0000 -- NO DEAD KEY SEQUENCE IN PROCESS
		/0001 -- SUCCESSIVE CHR IN DEAD KEY SEQUENCE
		/0002 -- SUCCESSIVE ASCII CHR DEADED ON A TECH CHR


PRTABF,	0	/CONTAINS THE VALUE TO REPLACE TAB SPACES WITH


/-------------------------
	PAGE

/PRGCHR - GET A CHARACTER FROM THE INPUT STREAM
/	USED WHEN KNOWN TO BE OUTSIDE OF A CONTROL BLOCK...		/A170

/THIS ROUTINE RETURNS THE CONTENTS OF THE BACKUP LOCATION IF IT IS NOT
/CLEARED.  IT GETS THE NEXT CHARACTER AND TESTS IT FOR START CONTROL.
/IF IT IS A START CONTROL WE INVOKE AN OVERLAY TO PROCESS CONTROL BLOCKS.
/SOONER OR LATER WE RETURN THE FIRST CHARACTER WHICH IS NOT PART OF A
/A PRINT CONTROL BLOCK.

/AC=0
/JMS	PRGCHR
/AC=CHARACTER

PRGCHR,
	XX

PRGCH1,
	TAD	PRGCBK	/GET THE BACKUP LOCATION CHARACTER
	SNA		/USE IT IF NOT CLEAR

	JMS	PRRULE	/NO--READ ANOTHER CHARACTER

/A CHARACTER HAS BEEN FOUND.  IF THE CHARACTER IS A BEGIN PRINT CONTROL,
/THE PRINT CONTROL IS PROCESSED AND WE TRY FOR ANOTHER CHARACTER.  OTHERWISE,
/THE CHARACTER IS RETURNED.

	DCA	T2	/SAVE THE CHARACTER
	DCA	PRGCBK	/CLEAR THE BACKUP LOCATION

	TAD	T2	/RESTORE THE CHARACTER
	TAD   (-1014)	/IS IT THE BEGINNING OF A PRINT CONTROL?
	SNA CLA
	JMP	PRGCH2	/YES -- JUMP TO HANDLE IT

/RETURN THE CHARACTER.

	TAD	T2	/GET CHARACTER AGAIN INTO AC
	JMP I	PRGCHR	/AND RETURN


/THIS SECTION HANDLES PRINT CONTROL BLOCKS.  THE PRINT CONTROL CODE IS
/INVOKED.  WHEN IT COMPLETES, IT RETURNS TO PRGCH1, PRGCH2, OR PRGCH4.

PRGCH2,
	TAD   (OVCNTL)	/CONTROL BLOCK CODE MUST BE INVOKED
	JMS	PROV
		OBCNTL

/***********************************************************************/
/									/
/	PRGCHC--GET A CHARACTER WHILE IN A CONTROL BLOCK		/
/		THIS ROUTINE IS USED TO GET CHARACTERS WHILE IN CONTROL	/
/		BLOCKS.  IF AN END OF FILE IS FOUND BEFORE AN END 	/
/		CONTROL, WE REPORT MISMATCHED CONTROLS AND STOP		/
/		PROCESSING.						/
/									/
/	JMS	PRGCHC		/ CALL					/
/	JMP	EOC...		/ END OF CONTROL			/
/	..CONTINUE HERE WITH CHR IN AC IF NOT EOC OR EOF		/
/				/ ROUTINE GOESTO TO MISCTL IF EOF	/

PRGCHC,	XX							/A170
	JMS	PRRULE		/ GET A CHARACTER
	SZA			/ SKIP IF EOC OR EOF
	ISZ	PRGCHC		/ BUMP RETURN IF NOT EOF OR EOC
	SZA			/ SKIP IF EOC OR EOF
	JMP I	PRGCHC		/ NOT END CONTROL OR END FILE
	TAD	T1		/ SEE WHICH
	SZA CLA
	JMP I	PRGCHC		/ END OF CONTROL--RETURN SANS INCREMENT
	JMP	MISCTL		/ END OF FILE--BAD NEWS

/THIS ROUTINE GETS THE NEXT CHARACTER FROM THE FILE INTERFACE.  IF THE
/CHARACTER IS THE BEGINNING OF A RULER, THE RULER IS PROCESSED AND THE
/NEXT CHARACTER IS CONSIDERED.  THE FIRST NON-RULER CHARACTER ENCOUNTERED
/IS RETURNED.

PRRULE,
	XX

PRRUL1,
	JMS	READCH	/GET ANOTHER CHARACTER

			/WHEN RETURN CHR IS IN AC AND T1 EXCEPT IF END
			/PRINT CONTROL, IN WHICH CASE AC IS CLEAR BUT
			/T1 STILL CONTAINS EPC
	SNA		/SEE IF EPC OR EOF				/A163
	JMP I	PRRULE	/YES, RETURN					/A163

	TAD	(-16)	/IS IT A RULER START?
	SNA CLA
	JMP	PRRUL2	/YES--PROCESS THE RULER

/WE MERELY HAVE A NORMAL CHARACTER--RETURN IT

	TAD	T1	/RECOVER THE CHARACTER


PRRUL3,	/ IF END OF FILE IS FOUND IN A RULER RETURN HERE

	JMP I	PRRULE	/AND RETURN IT

/THE CHARACTER IS A RULER.  CONTINUE ON THE RULER OVERLAY.

PRRUL2,
	TAD   (OVRULR)	/GET THE OVERLAY ADDRESS
	JMS	PROV	/AND CONTINUE--CONTROL RETUNS TO PRRUL1
		OBRULR



/THIS ROUTINE MAINTAINS THE VERTICAL POSITION OF THE PRINTER.  IT EXPECTS
/AS AN ARGUMENT THE NUMBER OF VERTICAL UNITS TO MOVE.  AFTER UPDATING THE
/VERTICAL POSITION, IT DOES THE MOVE.

/TAD	MOVE	 (POSITIVE OR NEGATIVE)
/JMS	PRMOVE
/AC=0

PRMOVE,	XX
	DCA	PRMOVT	/SAVE THE MOVE

/WE WANT THE MOTION TO TAKE PLACE EVEN IF WE ARE PRINTING TO		/A189
/A HOST.  WE MUST MAKE LPONLN NONZER ONLY IF IT IS ZERO (HOST)	/C194
/SO THAT PRESCS THINKS WE HAVE A PRINTER ONLINE				/A189

	TAD	LPONLN		/GET TYPE OF PRINTER ONLINE		/A189
	SNA CLA			/SKIP IF A PRINTER IS ATTACHED		/C194
	ISZ	LPONLN		/IF LPONLN 0000 MAKE 0001		/C194

/UPDATE THE VERTICAL POSITION.

	TAD	PRGSVP	/GET THE CURRENT VERTICAL POSITION
	JMS	CKMOVE	/CHECK FOR BOUNDARY OVERFLOW			/A105
	DCA	PRGSVP	/SAVE AS THE NEW VERTICAL POSITION

	TAD	PRGSAP	/GET THE ABSOLUTE VERTICAL POSITION
	JMS	CKMOVE	/CHECK FOR BOUNDARY OVERFLOW			/A105
	DCA	PRGSAP	/SAVE AS THE NEW ABSOLUTE VERTICAL POSITION

/FORWARD AND BACKWARD MOTION ARE HANDLED DIFFERENTLY.

	TAD	PRMOVT	/GET THE REQUESTED MOVE
	SMA
	JMP	PRMOV3	/JUMP TO HANDLE A FORWARD MOVE

/OTHERWISE, CONTINUE TO HANDLE A BACKWARD MOVE


/WHEN PRINTING TO THE LQP, THE BOTTOMS OF THE HOLES IN THE FORM PAPER
/ARE TIGHT AGAINST THE SPROCKETS.  WHEN WE MOVE BACK AND BEGIN PRINTING,
/THOUGH, THE TOPS OF THE HOLES ARE TIGHT AGAINST THE SPROCKETS.  AS THE
/PAPER MOVES FORWARD AGAIN, THE PAPER SLIPS UNTIL THE BOTTOMS ARE TIGHT
/AGAIN, CAUSING MISALIGNMENT.

/TO REMEDY THIS, WE FORCE THE PAPER TO MOVE BACK A LITTLE BIT MORE THAN
/IS NECESSARY, AND THEN MOVE FORWARD AGAIN.  THE BOTTOMS OF THE HOLES ARE
/THEN TIGHT.

/REMOVED THE BREAKING UP OF THE MOVE INTO CHUNKS 			/A128
/ACCORDING TO MAXMOV LOGIC						/A128

	JMS	PRCALK	/CALCULATE THE SLACK KONSTANT			/A103
	TAD	PRSLCK	/LOAD THE SLACK KONSTANT			/A103
	CIA		/NEGATE						/A103
	TAD	PRMOVT	/ADD THE NEGATIVE AMOUNT TO MOVE		/A103

/WE NOW ENTER A LOOP TO FORCE THE BACKWARD MOTION.
	JMS	PRFMOV	/FORCE THE MOTION

/THE BACKWARD MOTION IS NOW COMPLETED, AND THE PAPER HAS BEEN FORCED BACK
/PRSLCK UNITS PAST THE ULTIMATE DESTINATION.  NOW MOVE FORWARD THAT AMOUNT
/AND RETURN.

	TAD	PRSLCK	/GET THE SLACK AMOUNT				/A103
	DCA	PRMOVT	/SAVE AS THE AMOUNT TO MOVE
	TAD	PRMOVT	/RECOVER THE NEW MOVE

/THE CODE FOR A REGULAR FORWARD MOVE JOINS HERE.  THIS SECTION MOVES FORWARD
/THE AMOUNT IN PRMOVT.

PRMOV3,

	JMS	PRESCS	/SEND BUT DO NOT FORCE THE REQUESTED MOTION
		PCMPUP

	TAD	PRTMOV	/ADD TOTAL UNFORCED MOTION TO REQUESTED MOTION
	DCA	PRTMOV	/SAVE AS NEW TOTAL UNFORCED MOTION

PRMOV6,		/MAKE LPONLN 0000 IF NOW 0001 (HOST) SEE TOP ROUTINE	/C194

	AC7777		/						/A194
	TAD	LPONLN							/A194
	SNA CLA								/A194
	DCA	LPONLN	/MAKE 0000 IF NOW 0001 (HOST)			/C194
	JMP I	PRMOVE	/RETURN


PRSLCK, 0		/THE CALCULATED SLACK KONSTANT			/A103

/THIS ROUTINE EXPECTS AN AMOUNT TO MOVE IN THE AC.  IT TRANSMITS THE
/MOTION AND THEN FORCES IT (AND ANY ACCUMULATED UNFORCED MOTION) TO
/TAKE PLACE.

/THE VALUE PRTMOV CONTAINS THE TOTAL MOTION WHICH HAS BEEN TRANSMITTED
/BUT NOT FORCED TO DATE.  IT IS CLEARED BY THIS ROUTINE (WHICH FORCES
/THE MOTION).

/THIS ROUTINE DOES NOT RECORD THE FORCED MOTION IN THE VERTICAL POSITION
/VARIABLES, BECAUSE THIS ROUTINE IS PROVIDED ONLY FOR CALL BY PRMOVE,
/WHICH HAS PREVIOUSLY RECORDED THE MOVEMENT.  ALL OTHER CALLERS SHOULD
/USE PRMOVE TO MAKE THE MOTION AND RECORD THE MOVE, AND ONLY THEN CALL
/PRFMOV WITH A ZERO ARGUMENT TO FORCE THE MOTION.

/AC=AMOUNT TO MOVE
/JMS	PRFMOV
/AC=0

PRFMOV,
	XX

	JMS	PRESCS	/SEND THE REQUESTED MOTION
		PCMPUP
	CLA

	JMS	PRESCS	/FORCE THE MOTION TO OCCUR
		PCMFV

	DCA	PRTMOV	/CLEAR TOTAL UNFORCED MOTION
	JMP I	PRFMOV	/AND RETURN

/***********************************************************************/
/									/
/	CKMOVE--CHECK VERTICAL MOVEMENT FOR PAGE OVERFLOW		/
/		IF AUTO-PAGINATION IS NOT IN EFFECT WRAP IF		/
/		NECESSARY SO THAT VERTICAL POSITION IS ALWAYS		/
/		WITHIN CURRENT PAGE					/
/		ROUTINE ADDED REV105					/
/									/
/		THE ROUTINE IS CALLED WITH A VALUE IN THE AC.		/
/		THIS VALUE IS COMPARED TO THE PAGE SIZE			/
/		IF IT EXCEEDS THE PAGE SIZE, THE PAGE SIZE IS		/
/		SUBTRACTED FROM IT AND A NEW VALUE IS RETURNED		/
/		OTHERWISE, THE ORIGINAL VALUE IS RETURNED		/
/									/
/***********************************************************************/

CKMOVE,	XX
	TAD	PRMOVT		/ ADD IN CURRENT LINE SIZE		/
	DCA	CKTEMP		/ SAVE					/
	TAD	PRQAPG		/ IS AUTO-PAGINATION IN EFFECT?		/
	SZA CLA
	JMP	CKMOV1		/ NO, JUMP

	TAD	PRQPSZ		/ GET "-PAGE SIZE"
	CIA
	TAD	CKTEMP		/ SEE IF VERTICAL PSN IS BEYOND PS
	SPA			/ SKIP IF YES.  DON'T UN-NORMALIZE
	TAD	PRQPSZ		/ NORMALIZE BACK TO CURRENT VERT PSN
	DCA	CKTEMP		/ SAVE
CKMOV1,	TAD	CKTEMP		/ GET UPDATED RETURN VALUE
	JMP I	CKMOVE		/ RETURN

CKTEMP,	0			/ A TEMPORARY FOR THIS ROUTINE
PRMOVT,	0	/ TEMPORARY FOR PRMOVE ROUTINE			/m227	/A105

/***********************************************************************/
/									/
/	PLNXT---SUBROUTINE TO GET POINT TO NEXT CHARACTER IN PRLBUF	/
/		THE POINTER PLPTR MAY BE ADVANCED EITHER FORWARD	/
/		OR BACKWARD DEPENDING ON PLDIR BEING 0001 OR 7777,	/
/		WHICH IS SET UP BEFORE CALLING THE ROUTINE		/
/									/
/	PLCNT IS THE NEGATIVE OF THE SPACE REMAINING THE THE BUFFER	/
/	IF THERE IS MORE ROOM, THE BUFFER POINTER IS MOVED AND		/
/	THE SKIP RETURN IS MADE, OTHERWISE THE POINT IS UNMOVED		/
/	AND A NORMAL RETURN IS MADE INDICATING NO MORE CHRS		/
/									/
/***********************************************************************/

/AC=0
/JMS	PLNXT
/AC=0--NO MORE ROOM IN BUFFER
/AC=0--MORE ROOM IN BUFFER

PLNXT,
	XX

	ISZ	PLCNT	/INCREMENT THE COUNTER
	NOP		/DON'T CARE IF IT SKIPS
	TAD	PLCNT	/GET THE COUNT--IS THERE ROOM LEFT?
	SMA CLA
	JMP I	PLNXT	/THE COUNT HAS REACHED ZERO, NO MORE ROOM

	TAD	PLDIR	/THERE IS ROOM FOR NEXT TIME--MOVE THE POINTER
	TAD	PLPTR
	DCA	PLPTR

	ISZ	PLNXT	/INCREMENT THE RETURN LOCATION
	JMP I	PLNXT	/AND RETURN

/ THESE ARE THE BUFFERS FOR THE CHRSET FINAL STRINGS			/A160
/ THEY MUST BE RESIDENT.  EACH TIME A PRINTER CHRSET BOLD		/A160
/ OR NONBOLD IS ENCOUNTERED A NEW STRING IS PUT IN THE APPROPRIATE	/A160
/ BUFFER.  THE BUFFERS ARE THEN COMPARED.  IF THE STRINGS ARE		/A160
/ THE SAME THERE IS NO BOLD INTERPRETATION, IF THEY ARE DIFFERENT	/A160
/ THERE IS BOLD INTERPRETATION						/A160

CHRSSZ=4		/ SIZE OF EACH BUFFER INCLUDING ZERO TERMINATOR	/A160

PCHFBO,	ZBLOCK	CHRSSZ	/ THE BOLD FINAL STRING				/A160
PCHFNB,	ZBLOCK	CHRSSZ	/ THE NONBOLD FINAL STRING			/A160


/	THE XSXD STRING IS SENT BY THE ESCXD ROUTINE RESIDING IN ESC02 TO
/	SET OR RESET PROPORTIONAL MODE
/	THE P2PSET IS THE VARIABLE PART WHICH IS DETERMINED BY THE CODE
/	IN P2INIT
/
/
XSXD,	77 ; 62 ; 67		/ ? 2 7
P2PSET,	0			/ either "h or "l
/--------------------
PAGE

/***********************************************************************/
/									/
/	THE FOLLOWING STRINGS ARE ALL SENT AS ESCAPE SEQUENCES BY THE	/
/	ESC02 MODULE.							/
/									/
/***********************************************************************/

XSSGR,	52; 4155		/ GENERAL SGR, 1 PARAMETER		/A211
XDUNDR,	64 			/ ESC [ 4 m / SET UNDERLINING
XDRST,	4155	  		/ ESC [ m / RESET ALL MODES
XDSHAD,	77; 62; 4155	  	/ ESC [ ? 2 m / SET SHADOW
XDSEC,	77; 61; 4155	  	/ ESC [ ? 1 m / SET SECONDARY
XDPRIM,	61; 4155  		/ ESC [ 1 m /   SET PRIMARY
XDSBL,	"8&177; "m&177+4000	/ ESC [ 8 m  /	DISABLE HAMMAR
XSTRAY,	"*&177 ; 41 ; 4166	/ ESC [ TRAY SELECT ! v
XSPAGS,	"*&177 ; 4164		/ ESC [ PAGESIZE t
XSMOVE,	"*&177;"a&177+4000	/ LQP02 ESCAPE SEQ TO ADVANCE PRINT HEAD/A080
				/  IN "PRINT UNITS" INCREMENTS.		/A080
XSLEFT,	"*&177;"!&177;"t&177+4000/ LQP02 ESC SEQ TO ADV LEFT PRINT UNITS/A084

XSPLD,	ESC;	4113		/ CAPITAL K FOR PLD (FWD)		/C207

XSPLU,	ESC;	4114		/ PARTIAL LINE UP (REV)			/C188
XSXE,	33; 43; 4071		/ ESC # 9	/ FORCE VERTICAL ADVANCE

/ THE FOLLOWING SEQUENCE IS USED TO SET G2 TO DEC MULTINATIONAL	/A200
/ AND G3 TO DEC TECHNICAL CHARACTER SET					/A200
XSTCSI,	ESC; 2052; "<&177; ESC; 53; ">&177				/a200
	ESC; 51; "0&177+4000						/A236

/ THE FOLLOWING ARE FOR THE SS2 AND SS3 SEQUENCE GENERATION
XSSS,	ESC; 4052		/ * IS A STRING POINTER			/A200
XSSS2,	4116			/ ESC N IS SS2				/A200
	4117			/ ESC O IS SS3				/A200
/ NOTE THAT XST94 AND XST95 HAVE SS3 IMBEDED IN THEM			/A200
XST94,	33; 117; 4041		/ ESC O !	/ SELECT TABLE POSITION 94
XST95,	33; 117; 4042		/ ESC O "	/ SELECT TABLE POSITION 95

/	/ SET HORIZONTAL CHAR SIZE
/	/ESC [ 120 ; *-200 ; Sp G
XSCHRS,	 61 ; 62 ; 60 ; 73 ; "*-200 ; 40 ; 4107

/ THE RIGHT MARGIN WAS CHANGED FROM 158 TO 330 BECAUSE THE LQP02	/A111
/ CALCULATES THE RIGHT MARGIN IN RELATIVE UNITS (NUMBERS OF CHARACTERS)	/A111
/ WHICH VARIES ACCORDING TO PITCH.  SINCE WE CAN HAVE 13.2 INCHES OF	/A111
/ CHARACTERS AT 25 PITCH, THE RIGHT MARGIN BELONGS AT 330 CHARACTERS	/A111
/ THIS SITUATION CAN OCCUR EASILY IN MULTICOLUMN APPLICATIONS		/A111
/	/ ESC [ LEFT MARGIN ; RIGHT MARGIN s
XSMARG,	 "*-200 ; 73; 63 ; 63 ; 60 ;  4163	/ LM;330s		/A111

XSJSFY,	"*; ";; "*; ";; "*; ";; "*; "!; 4163	/DECFIL JUSTIFY		/M217

XSSPUM,	"1&177;"1&177;"h&177+4000	/  set  PUM mode ($[11h)	/A080
XSRPUM,	"1&177;"1&177;"l&177+4000	/ reset PUM mode ($[11l)	/A080
XSIVPR,	"*;"e+4000		/ increment vertical position relative	/a229
XSDVPR,	"*;"k+4000		/ decrement vertical position relative	/a229
XSIHPR,	"*;"a+4000		/ increment horizontal position relative/a229
XSDHPR,	"*;"j+4000		/ decrement horizontal position relative/a229
XSEXRP,	77 ; 52 ; 4156	/ESC [ ? * n  ENABLE/DISBLE/SEND STATUS
XSSPAC,	"*-200 ; 41 ; 4171 /ESC [ space size ! y
PRSTG0,	33; 50; 4052		/ ESC-(-FINAL				/A151
PRSTG1,	33; 51; 4052		/ ESC-)-FINAL				/A151
XDFONT,	52; 4155		/ ESC [ * m				/A152
XSPITCH,52; 4167		/ ESC [ * w				/A152
XSTABL,	52; 41; 4170		/ ESC [ * ! x	LQP02 TABLE SELECT/A173	/C174
XSCOLA,	SPC; ESC; 133; 52; 4140	/ SPACE  ESC [ * @			/C222
XSPFS,	77; 52; 40; 4112	/ ESC [ ? * SPC J    PAGE FORMAT SELECT	/A215

/	THE XSXD STRING IS SENT BY THE ESCXD ROUTINE RESIDING IN ESC02 TO
/	SET OR RESET PROPORTIONAL MODE
/	THE P2PSET IS THE VARIABLE PART WHICH IS DETERMINED BY THE CODE
/	IN P2INIT
/
/
/ moved to previous page
/d236XSXD,	77 ; 62 ; 67		/ ? 2 7
/d236P2PSET,	0			/ either "h or "l


/***********************************************************************/
/									/
/	PRCALK--CALCULATE SLACK KONSTANT. (ADDED REV103)		/
/		THE LQP02 DOES NOT LET US ROLLBACK BEYOND THE TOP	/
/		OF THE PAGE, AS WE WOULD IF THE TOP MARGIN WAS 3	/
/		AND THE ROLLBACK CONSTANT WAS 4.  IN THIS CASE THE	/
/		LQP02 IS KNOWN TO THROW AWAY ONE LINE OF ROLLBACK,	/
/		BUT NOT THROW AWAY ONE LINE OF ROLLAHEAD, CREATING	/
/		A MULTICOLUMN FORMAT WHERE THE LEFTMOST GROUP IS	/
/		ONE COLUMN HIGHER THAN THE OTHER GROUPS.		/
/									/
/		THIS ROUTINE CHECKS TO SEE IF THAT IS WHAT WOULD	/
/		HAPPEN.  IT SPECIFIES THAT THE ROLLBACK AMOUNT		/
/		PRSLCK BE THE SMALLER OF PRMSLK OR THE DISTANCE		/
/		TO THE TOP OF THE PAGE					/
/									/
/***********************************************************************/

PRCALK,	XX
	TAD	PRGSAP		/ LOAD ABSOLUTE VERTICAL POSITION	/
	TAD	(-PRMSLK)	/ SEE IF WE WILL ROLLBACK TOO FAR	/
	SMA CLA
	JMP	PRCAL2		/ NO, EVERYTHING IS OK			/

	TAD	PRGSAP		/ YES, SO USE ABSOLUTE POSITION		/
PRCAL1,	DCA	PRSLCK		/ SET SLACK KONSTANT			/
	JMP I	PRCALK		/ RETURN				/

PRCAL2,				/ NORMAL SLACK				/
	TAD	(PRMSLK)	/ LOAD NORMAL VALUE			/
	JMP	PRCAL1		/ GO STUFF & EXIT			/

IFDEF DEVEL1 <								/A143

/THIS LITTLE ROUTINE IS FOR DIAGNOSING ESCAPE SEQUENCES SENT TO THE PRINTER
/IF THE COLUMN MARGIN IS SET TO 430 AND THE DEVELOPMENT SWITCH IN WP27F0
/IS ON, WE WILL BE ABLE TO PRINT AN E IN PLACE OF EVERY ESCAPE.
/IN THIS WAY WE WILL BE ABLE TO GET A HARD COPY OF WHAT IS GOING TO THE PRINTER.

/IF WE ENCOUNTER A CARRIAGE RETURN WE WILL ALSO ADD A LINE FEED
/SO WE WILL NOT OVERPRINT

PRCHR5,	TAD	(-656)		/ SEE IF COLUMN MARGIN IS 430 DECIMAL
				/ THIS WONDERFUL MAGIC NUMBER IS
				/ HARRY PREBLE' BIRTHDAY, IN CASE
				/ YOU ASTUTE READERS CARED
	TAD	PRQCM
	SZA CLA
	JMP	PRCHR4		/ NO, PROCEED NORMALLY

	TAD	PRCHAT		/ GET THE CHARACTER TO BE PRINTED
	TAD	(-33)		/ SEE IF ESCAPE
	SNA
	JMP	PRCESC		/ YES, GO PRINT AN ASCII E

	TAD	(33-15)		/ SEE IF CARRIAGE RETURN
	SZA CLA
	JMP	PRCHR4		/ NO, PROCEED AS USUAL

	TAD	(LF)		/ IS CARRIAGE RETURN, SEND A LINE FEED FIRST
PRCHR6,	CIFSYS
	LPTOU
	SKP CLA			/ NO ROOM
	JMP	PRCHR4		/ LINE FEED OUT, NOW DO A CR

	CIFSYS
	JWAIT
	JMS	SQPINP
	TAD	(LF)		/ LOAD LINE FEED AGAIN
	JMP	PRCHR6		/ TRY AGAIN

PRCESC,	TAD	(105		/ LOAD AN ASCII E
	DCA	PRCHAT		/ STUFF IT
	JMP	PRCHR4		/ AND PROCEED AS USUAL

	>	/ END IFDEF DEVEL1

/------------------------
	PAGE

/***********************************************************************/
/									/
/  ESC02--PART OF PRESCS.  CALLED IF PRINTER IS NOT LQPSE		/
/
/	THE PHILOSOPHY IS THAT ALL OTHER PRINTERS ARE DESIGNED TO
/	DEC SPECIFICATIONS AND STANDARDS.  IN PARTICULAR, THEY ARE
/	COMPATIBLE WITH DEFINITIONS OF STANDARD ESCAPE SEQUENCES
/	WHICH HAVE CERTAIN DEFINED INTRODUCERS, INTERMEDIATE, AND
/	FINAL CHARACTERS.  IF A PARTICULAR PRINT CANNOT PERFORM THE
/	FUNCTION SPECIFIED BY A PARTICULAR ESCAPE SEQUENCE AT LEAST
/	IT WILL PROPERLY IGNORE THE SEQUENCE AND NOT PRINT EXACTLY
/	THOSE CHARACTERS BELONGING TO THE ESCAPE SEQUENCE AND BEGIN
/	PRINTING AGAIN EXACTLY WHEN IT SHOULD.
/
/	ENTER ACC = BINARY Ps OR Pn VALUE
/	EXIT  ACC = "       "  "  "  "
/
/	CALLING SEQUENCE:	TAD	Ps or Pn VALUE
/				JMS	PRESCS
/					CODE
/	THE PARAMETER "CODE" WHICH FOLLOWS THE CALL IS IN GENERAL
/	AN ASCII VALUE.  THIS IS DONE TO MAINTAIN COMPATIBLITIY
/	WITH THE EARLIEST VERSION OF PRESCS WRITTEN TO HANDLE THE LQPSE
/	THE ASCII CODES FOR THIS ROUTINE ARE BASED AT 071 OCTAL--ASCII 9

/	VARIABLES USED:
/	XSADX 	POINTER TO THE ESCAPE STRING AS IT IS BEING TRANSMITTED.
/	ESCNUM	A VARIABLE STRING, TO CONTAIN ASCII NUMERIC CHARACTERS.
/		THESE STRINGS ARE THE VARIABLE PARTS OF ESCAPE SEQUENCES.
/	NUMPTR	A POINTER INTO ESCNUM THAT IS USED IN BOTH PUTTING ASCII
/		NUMERIC CHARACTERS INTO ESCNUM AND IN TRANSMITTING THEM.
/
/	IF AN ESCAPE STRING HAS A VARIABLE COMPONENT, THE STRING CONTAINS
/	AN '*' (52 OCTAL).  WHEN OUTPUTTING THE STRING, IF AN '*' IS FOUND
/	THE OUTPUT SWITCHES TO 'ESCNUM' UNTIL THE NUMBER HAS BEEN SENT.
/	THEN XSADX TAKES OVER AGAIN AS THE OUTPUT POINTER.
/
//////////////////////////////////////////////////////////////////////
/ ESC   /  [     /  YYY   /   *       /   WWW        /   4000 /
//////////////////////////////////////////////////////////////////////
/   ^                       |
/   |                       |
/   |                       |---->///////////////////////////////////
/   |                   ESCNUM   / '0-9'  / '0-9'  / '0-9'  / 4000
/   |                             ////////////////////////////////
/   |                                   ^
/   |----XSADX                          |
/                                       |
/                                       |----NUMPTR
/
/////////////////////////////////////////////////////////////////////
/
/	ALL OF THE ROUTINES ACTIVATED BY THIS CASE STRUCTURE SEND ONE
/	OR MORE ESCAPE STRINGS.  THE ROUTINES ARE CALLED ESC--- AND
/	THE STRINGS ARE DESIGNATED XS---.  WHERE THE ESCAPE STRING HAS
/	A PARAMETER, THE ROUTINE WILL CONVERT THE BINARY VALUE INTO
/	ASCII AND STORE THE RESULT IN 'ESCNUM'.  THE ESCAPE STRINGS ARE
/	STORED WITHOUT THE 'ESC [' AS THESE ARE PRESENT IN ALL ESCAPE
/	STRINGS.  THE OUTPUT ROUTINE 'CSISTR' AUTOMATICALLY OUTPUTS
/	THOSE TWO COMPONENTS.
ESC02,			/ NO LONGER A SUBROUTINE			/C165

/ WE SAVE PRYES.  CERTAIN ESCAPE SEQUENCES MUST BE OUTPUT		/A164
/ EVEN IF PRINTING IS INHIBITED AS WE SCROLL THROUGH THE DOCUMENT	/A164
/ EXAMPLES OF THESE ARE THOSE THAT DO NOT CAUSE PRINTING BUT DO		/A173
/ AFFECT THE STATE OF THE PRINTER, SUCH AS PITCH, CHRSET, FONT, ETC.	/A173
/ THOSE ROUTINES THAT MUST OUTPUT EVEN IF PRINTING IS INHIBITED		/A173
/ CLEAR PRYES SOMEPLACE BEFORE CALLING PRCHAR				/A173

	TAD	PRYES		/ SAVE PRYES INCASE PRINTING		/A162
	DCA	PRYES1		/ IS INHIBITED				/A162
	TAD	(ESCNUM-1
	DCA	NUMPTR		/ INITIALIZE THE NUMERIC OUTPUT PTR
	TAD	PRESCS		/ GET POINTER TO CASE CODE
	DCA	ESCT1		/ STORE TO INDIRECT THROUGH
	TAD I	ESCT1		/ GET THE CASE CODE
	AND	P177		/ STRIP ANY POSSIBLE NLQPSE BIT		/A165
	TAD	(-60		/ SUBTRACT BASE CODE VALUE ASCII 0
	CLL RAL			/ MULTIPLY BY TWO WORDS PER ENTRY
	TAD	(ESCCTB		/ ADD ESCAPE COMMAND TABLE BASE
	DCA	ESCT1		/ PREPARE TO READ THE TABLE PAIR
	TAD I	ESCT1		/ FIRST GET THE STRING ADDRESS
	DCA	XSADX		/ SET THE STRING PTR
	ISZ	ESCT1		/ BUMP POINTER
	TAD I	ESCT1		/ GET THE ADDRESS OF THE ROUTINE
	DCA	ESCT1		/ STUFF IT FOR INDIRECT
	JMP I	ESCT1		/ JUMP TO THE CASED ROUTINE


/ WHEN WE ARE THROUGH SENDING THE ESCAPE SEQUENCE WE COME BACK HERE
/ TO MAKE A NICE CLEAN EXIT OF THIS ROUTINE

PRESXT,	CLA			/ CLEAR THE ACCUMULATOR
	TAD	PRYES1		/ RESTORE PRYES				/A162
	DCA	PRYES		/					/A162
	JMP	PRESC4		/ GO RETURN FROM PRESCS			/C165

ESCT1,	0
PRYES1,	0			/ SAVE PRYES HERE FOR ESC02		/A162

ESCCTB,				/ ESCAPE SEQUENCE TABLE

	/STRING	;	/ROUTINE

	XSEXRP	;	ESCXRP	/ 60 ENABLE/DISABLE EXTENDED REPORTS	/A147
	PRSTG0	;	PRESF	/ 61 SET G0 CHRSET			/A151
	PRSTG1	;	PRESF	/ 62 SET G1 CHRSET			/A151
	XDFONT	;	PREFNT	/ 63 FONT SELECT			/A152
	XSPITCH	;	CSIUWV	/ 64 DRAFT PRINTER PITCH		/C173
	XSTABL	;	CSIUWV	/ 65 LQP02 TABLE SELECT			/A173
	XSTMRS	;	PRESF	/ 66 RESET PRINTER (EXCEPT LQPSE)	/C219
	XSTMID	;	CSIUWV	/ 67 REQUEST TERMINAL ID		/A185
	XSCOLA	;	ESCSTV	/ 70 ABSOLUTE COLUMN POSITION		/C222
	XSPLD	;	ESC9	/ 71 ACCUMULATE VERTICAL ADVANCE
	XSTQM	;	CSIUWV	/ 72 SET QUALITY MODE (ONLY FROM OVDDCK)/C193
	XSMOVE	;	ESCXB	/ 73 ACCUMULATE HORIZONTAL ADVANCE
	XSSS	;	PRESF1	/ 74 SS2 OR SS3				/C200
	XSXD	;	ESCXD	/ 75 ENABLE/DISABLE PROPORTIONAL PRINTING
	XSXE	;	ESCSTG	/ 76 FORCE VERTICAL MOVEMENT		
	XST94	;	ESCSTG	/ 77 TABLE ENTRY 94 FOR WHEEL POSITION	
	XST95	;	ESCSTG	/ 100 TABLE ENTRY 95 FOR WHEEL POSITION	
	XSCHRS	;	ESCA	/ "A SET CHARACTER SIZE			
	XSSPUM	;	ESCB	/ "B SET PUM MODE
	XSRPUM	;	ESCC	/ "C RESET PUM MODE
	XDRST	;	ESCD	/ "D HIT COUNT				
	XSMARG	;	ESCE	/ "E SET MARGIN (IN HAI)
	XSSPAC	;	ESCF	/ "F SET SPACE SIZE
	XSPLU	;	ESCSTG	/ "G HALF LINE REVERSE			/C193
	XSPAGS	;	ESCH	/ "H PAGE SIZE (IN LINES)
	XSPLD	;	ESCSTG	/ "I HALF LINE FORWARD			/C208
	XSTRAY	;	ESTGWV	/ "J SELECT TRAY
	XSTCSI	;	PRESF	/ "K SETUP G2 AND G3 FOR TECHNICAL CHR	/A200
	XSGRAP	;	ESCSTG	/ "L BEGIN SIXEL GRAPHICS		/C222
	XSGRET	;	ESCSTG	/ "M END SIXEL GRAPHICS			/C222
	XSSGR	;	ESTGWV	/ "N SGR, 1 PARAMETER			/A211
	XSPFS	;	CSIUWV	/ "O PFS, PAGE FORMAT SELECT		/A215
	XSIVPR	;	ESTGWV	/ "P increment vertical position rel.	/a229
	XSDVPR	;	ESTGWV	/ "Q decrement vertical position rel.	/a229
	XSIHPR	;	ESTGWV	/ "R increment horizontal position rel.	/a229
	XSDHPR	;	ESTGWV	/ "S decrement horizontal position rel.	/a229
	XDRST	;	ESCDR	/ "T reset attributes			/a234

ESC9,

/***********************************************************************/
/									/
/	ESMVV--PART OF PRESCS WHICH HANDLES VERTICAL MOVEMENT		/
/		DESIGNED TO WORK FOR LQP02, LQP03, AND ALL DP		/
/									/
/	CURRENTLY THE ASSUMPTION IS THAT THE VERICAL PITCH IS 		/
/	ALWAYS 6 LINES PER INCH AND IS NEVER CHANGED			/
/	A PLU OR PLD IS A 1/2 A LINE OR 1/12 INCH			/
/									/
/	ALL REVERSE MOTION IS DONE WITH PLU				/
/									/
/***********************************************************************/

ESMVV,		/ESCAPE SEQUENCE--VERTICAL MOTION
	TAD	PREST1		/GET SIGNED AMOUNT IN 48THS
	SNA			/SKIP IF MOTION REQUIRED
	JMP	PRESXT		/NO MOTION REQUIRED
	SMA			/IF POSITIVE NEGATE
	CIA
	STL RAR
	STL RAR			/DIVIDE BY 4, NOW WE HAVE 12THS
	DCA	ESCT1		/SAVE BACK AS A COUNTER

/ IF THE MOTION IS REVERSE WE HANDLE BY DOING THE PROPER NUMBER
/ OF PLD COMMANDS

	TAD	PREST1
	SMA CLA
	JMP	ESMVV2		/GO HANDLE FORWARD MOTION
	TAD	(XSPLU)
	DCA	XSADX		/SET UP STRING ADDRESS
ESMVV1,	JMS	ESCST		/PUT OUT STRING
	AC7777
	TAD	XSADX
	DCA	XSADX		/BACK UP STRING POINTER
	ISZ	ESCT1		/SEE IF WE ARE DONE
	JMP	ESMVV1		/NO
	JMP	PRESXT		/YES
/----------------------
	PAGE

/ ESCD	IMPLEMENTS THE TEXT ENHANCEMENT FUNCTIONS
/
/
/	PREST1 CONTAINS THE VALUE DEPOSITED BY THE SPOOLER WHICH IS THE SUM
/	OF THE BOLD BIT AND THE DARKNESS BIT.  THIS ROUTINE ADDS IN
/	'DARKNESS' (BIT 11 OF PRQOVP) AGAIN, TO ISOLATE THE BOLD BIT.
/	THE RESULT IS THEN EXCLUSIVE OR'ED WITH THE SHADOW BIT
/	(BIT 5 OF PRQOVP).  THE RESULT OF THIS IS THEN ADDED TO BIT 11
/	OF PRQOVP (DARKNESS) TO YIELD THE HIT COUNT.
/
/	(BOLD EXOR SHADOW) + (DARKNESS) ==>  HIT COUNT
/
/	THE EFFECT OF THIS IS THAT 'BOLD' TEXT WITH THE 'SHADOW' ATTRIBUTE
/	IS NOT GIVEN AN EXTRA 'HIT'.
/	THE 'BOLD' BIT IS THEN AND'ED WITH THE 'SHADOW' BIT, SO THAT
/	ONLY 'BOLD' TEXT IS PRINTED AS SHADOW, IF WE ARE IN SHADOW MODE.
/	THE HIGHLIGHTING MODES OF THE LQP02 ARE THEN RESET AND THE
/	ESCAPE SEQUENCES GENERATED TO A)SET SHADOW PRINTING MODE, B)SET
/	SECONDARY MODE IF 2 HITS REQUIRED, C)SET PRIMARY MODE IF 3 HITS
/	REQUIRED.
/
ESCD,	

/	BEFORE CALLING PRESCS(PCBOLD), SPOOLER DID :			
/	  RAL		PUTTING 'BOLD' BIT IN ACC 11
/	  TAD	PRQOVP	ADDING IN THE DARKNESS BIT			
/	GIVING A VALUE IN ACC OF 0-2.  BY ADDING IN DARKNESS		
/	AGAIN, ACC BIT 11 WILL REFLECT THE ORIGINAL VALUE OF 'BOLD'	
/		BOLD  +  DARK  +  DARK
/		0	 0	  0    = 00
/		0	 1	  1    = 10
/		1	 0	  0    = 01  *
/		1	 1	  1    = 11  *				
/
	JMS	CSISTR		/ OUTPUT 'RESET' ESCAPE STRING
	TAD	PREST1		/ GET HIT COUNT
	SPA			/ IF POSITIVE CONTINUE, 		/A060
	JMP	DSABL		/  ELSE DISABLE HAMMAR FOR TW PASS	/A060
	TAD	PRQOVP		/ CANCEL DARKNESS COMPONENT
	DCA	ESCT1		/ ESCT1 = BOLD BIT (AC11)
/
	AC0001
	AND	PRQSP		/ ISOLATE BIT 11
	DCA	ESCT2		/ ESCT2 = SHADOW BIT (AC11)
/
	TAD	ESCT2
	AND	ESCT1		/ SHADOW (AND) BOLD => ACC 11
	RAR			/ INTO LINK
	CLA
	TAD	(XDSHAD		/ SEND SHADOW IF BOLD AND SHADOW
	JMS	XDSTR
	SNL			/ BOLD BIT IS IN LINK
	JMP	ESCDRK		/ ACC IS CLEAR
	TAD	ESCT2		/ BOLD, SO IF NOT SHADOW
	CMA
	AND	(1		/ THEN INCREMENT HIT COUNT
ESCDRK,
	TAD	PRQOVP		/ ADD DARKNESS
	DCA	ESCT1
	TAD	UNDERL		/ GET UNDERLINE FLAG
	CLL RAR
	TAD	(XDUNDR
	JMS	XDSTR		/ (MAYBE) SEND UNDERLINE ENABLE
/
	TAD	(XDSEC
	JMS	XDSTR		/ (MAYBE) SEND SECONDARY ENABLE
	TAD	(XDPRIM
ECXT,	JMS	XDSTR		/ (MAYBE) SEND PRIMARY ENABLE
	JMP	PRESXT		/ RETURN
/
XDSTR,	XX			/
	DCA	XSADX		/ FIX UP STRING PTR
	SZL			/ IF TRANSMIT ENABLED
	JMS	CSISTR		/ THEN SEND THE ESCAPE STRING
/
	TAD	ESCT1
	RAR
	DCA	ESCT1		/ SET UP TO TEST FOR NEXT STRING
	JMP I	XDSTR		/ RETURN


/DISABLE PRINT HAMMAR ROUTINE, USED FOR TWO WHEEL PRINTING
DSABL,	CLA CLL CML		/ CLEAR AC AND SET LINK SO ESCAPE IS SENT
	TAD (XDSBL		/ GET ESCAPE SEQUENCE TO DISABLE HAMMAR
	JMP ECXT		/ SEND TO PRINTER AND EXIT
	/
UNDERL,	0			/ UNDERLINE FLAG
ESCT2,	0

/***********************************************************************/
/									/
/	ESCXRP--ENABLE EXTENDED REPORTS (ALL EXCEPT LQPSE) /A147	/
/									/
ESCXRP,	AC0003			/ CODE TO ENABLE REPORTS AND GET ONE	/
	JMP	XSMXT		/ GO TRANSMIT.  NOTE WE WILL RETURN	/
				/ RETURN WITH CLEAR AC SINCE WE DID	/
				/ DID NOT LOAD PREST1			/
/***********************************************************************/

//////////////////////////////////////////////////////////////////
/
/	CHARACTER SIZE IS SET BY MULTIPLYING THE 120ths COUNT IN PREST1
/	BY 6, AS REQUIRED BY THE LQP02.  THE LQP02 DIVIDES THE RECEIVED
/	SIZE PARAMTER TO YIELD ITS 'HAI' IN 120ths.
/
/	LIKEWISE FOR SETTING SPACE SIZE
/
/
/									/D051
ESCF,				/ SET SPACE SIZE
ESCA,				/ SET CHARACTER SIZE
	TAD	PREST1		/ MULTIPLY BY 6
	CLL RTL			/ BY MULTIPLYING BY 4
	TAD	PREST1		/ AND ADDING TWICE MORE
	JMP	ESTGWV		/ (ONCE MORE AT ESTGWV)

CSIUWV,				/ UNCONDITIONAL CSI WITH VALUE		/A174
	DCA	PRYES		/ OUTPUT EVEN IF PRINTING INHIBITED	/A173
ESTGWV,				/ ESCAPE STRING WITH VALUE
	TAD	PREST1
XSMXT,	JMS	ESCOUT		/ CONVERT TO ASCII AND STUFF INTO STRING
	JMS	CSISTR		/ AND TRANSMIT				/A222
	JMP	PRESXT		/ RETURN
/
///////////////////////////////////////////////////////////////////////////
/
/
/	PAGE SIZE IS DELIVERED IN 48THS.  DIVIDE BY LINE SIZE TO GET
/	THE PAGE SIZE IN LINES, WHICH IS WHAT THE LQP02 LIKES
/
ESCH,				/ SET PAGE SIZE
	TAD	LPONLN		/ INIT DIVIDEND TO 5 FOR ASF OR 0.	/M093
	AND	(ASFMSK)	/					/A113
	SZA CLA			/ SKIP IF NOT ASF. SET PAGE SIZE AS SPEC/A095
	TAD	(5)		/IFIED. IF ASF ADD 5 (TOO MAKE PAPER FEED/A095
	DCA	ESCT2		/INTO FEEDER TRAY.			/M095
	TAD	(PRNLSZ		/ ALWAYS = 8 FOR 6 LINES/INCH
	JMP	XSDX		/ DIVIDE, CONVERT, PUT IN STRING AND TX

/ HORIZONTAL ADVANCE COMMAND

ESCXB,	TAD	PREST1		/ TO THE RIGHT OR THE LEFT?
	SMA			/ MINUS MEANS LEFT.
	JMP	XSMXT		/ GO DO THE RIGHT THING.
	CIA			/ MAKE POSITIVE.
	DCA	ESCT2		/ SAVE AMOUNT TO MOVE
	TAD	XSLEFT		/ SET "LEFT" MOVEMENT COMMAND.
	DCA	XSADX		/  SET STRING ADDRESS...
ESCXB1,									/A219
	TAD	ESCT2		/ GET AMOUNT TO MOVE
	JMP	XSMXT		/ DO THE LEFT THING.



/
//////////////////////////////////////////////////////////////////////////
/
/	SET LEFT MARGIN
/	THE LEFT MARGIN IS DELIVERED AS A 120THS COUNT.  DIVIDE THIS BY
/	THE CHARACTER SIZE TO GET THE LEFT MARGIN IN SPACES, WHICH IS WHAT
/	THE LQP02 LIKES
/
ESCE,
	AC0001			/ INIT DIVIDEND. LM BEGINS AT 1 (NOT 0)./A082
	DCA	ESCT2		/  ...					/A082
	TAD	PLNRCS		/ DIVIDE 120THS MARGIN BY CHARACTER SIZE
XSDX,	CIA			/ THE DIVISOR MUST BE IN ACC UPON ENTRY
	DCA	ESCT1		/ IT WILL BE REPEATEDLY SUBTRACTED
				/ FROM THE DIVIDEND, GIVING QUOTNT
/
	TAD	PREST1		/ GET THE DIVIDEND
DVLP,	TAD	ESCT1		/ SUBTRACT THE DIVISOR
	SPA			/ UNTIL NEGATIVE
	JMP	DIVX
/
	ISZ	ESCT2
	JMP	DVLP
DIVX,	CLA			/					/M082
	TAD	ESCT2		/ NO REMAINDER, SO ACC ALWAYS ZERO
	JMP	XSMXT		/ GO STUFF VALUE, OUTPUT A CSI STRING	/C222
/
/
//////////////////////////////////////////////////////////////////////////
/
/
/	THE FOLLOWING JUST SEND THE STRING DESIGNATED BY THE ADDRESS
/	IN THE CALLING CASE TABLE.
/
ESCXD,				/ ENABLE/DISABLE PROPORITONAL PRINTING
ESCB,				/ SET  PUM MODE.			/A080
ESCC,				/ RESET PUM MODE.			/A080
ESCDR,				/ reset underline/bold flags		/a234
	JMS	CSISTR
	JMP	PRESXT		/ RETURN

///////////////////////////////////////////////////////////////////////
/
/	ESCOUT - CALL THE BINARY TO ASCII BCD CONVERSION ROUTINE
/	AND PUT RESULT INTO THE ESCAPE STRING. GET READY TO TX IT
/
ESCOUT,	XX
	MQL			/ SAVE THE VALUE			/A143
	TAD	(ESCNUM-1	/ SET UP NUMPTR				/A143
	DCA	NUMPTR		/					/A143
	ACL			/ RESTORE THE VALUE			/A143
	JMS	ASCOUT		/ MAKE IT ASCII NUMERIC
	DCA I	XSNX		/ PUT IT BACK
	TAD	(ESCNUM		/ ADDRESS OF BEGINNING OF STRING
	DCA	NUMPTR		/ READY FOR OUTPUT
/D222	JMS	CSISTR		/ SEND THE ESCAPE STRING
	JMP I	ESCOUT		/ RETURN TO PRESCS

XSNX,	0

PRESF,			/ ESCAPE SEQUENCE WITH "FINAL" STRING		/A151
	DCA	PRYES		/ ENABLE OUTPUT EVEN IF PRINTING OFF	/A164
PRESF1,	TAD	PREST1		/ GET ADDRESS PASSED TO PRESCS		/C200
	DCA	NUMPTR		/ SAVE AS THE SUBSTRING		/A151	/C160
ESCSTG,			/HERE TO OUTPUT STRING WITH NO VALUE		/A222
			/*** ONLY IF PRINTING ENABLED ***		/A188
	JMS	ESCST		/ DO STRING WITH SUBSTRING FINAL	/A151
	JMP	PRESXT		/ GO EXIT				/A151

ESCSTV,		/ESCAPE STRING WITHOUT CSI PREFIX			/A222
	TAD	PREST1		/ GET VALUE				/A222
	JMS	ESCOUT		/ CONVERT				/A222
	JMP	ESCSTG		/ GO OUTPUT				/A222
/-------------------
	PAGE

/ FLABUZ will do 1 of 3 things to top middle of menu pages:
/	1. Display "PRINTER STOPPED" when PRSTTS indicates a
/	printer stop condition (PRSTTS greater than 1).
/	 (will buzz on 1st pass).
/
/	2.Display "PRINTER BUSY" when status word PRSTTS
/	indicates printing (is 0001).
/
/	3.Blank out previous message when printer 1st changes
/	to idle. (PRSTTS=0)

/ AND ONLY one thing when called from the editor:			/M171
/	The FIRST time that a STOPPED condition is detected the PRINTER /M141
/	STOPPED message will be displayed and the buzzer shall buzz.	/M141

FLABUZ,	XX			/ SUBROUTINE ENTRY POINT		/A098
	CLA			/ MAKE SURE THAT ACCUMULATOR IS CLEAR	/M171
	TAD	CIDF0		/ GET CIF CDF INSTRUCTION		/M156
	RDF			/ MAKE IT WORK TO THE CALLERS FIELD	/M156
	DCA	FLEXIT		/ AND PATCH INTO EXIT ROUTINE		/M171

/ TIME will exit FLABUZ if at least one second has not elapsed since the last
/ time the saved time was tested.  TIME  is necessary because of the large
/ system overhead caused when direct cursor addressing is used in both
/ DECmate-I and DECmate-II.  TIME serves not so much to reduce the number of
/ instructions executed but to eliminate escape sequences which can cause the
/ panel code to be executed for a fairly long time (about 1 millisecond in
/ DECmate-I), causing possible system problems such as dropped characters.

TIME,	CDFSYS			/ CHANGE DATA FIELD TO SYSTEM FIELD
	TAD I	(CLOCK+2)	/ GET THE ONCE PER SECOND COUNTER
	CIA			/ NEGATE THE VALUE
	TAD	TIMESE		/ ADD WHAT IT WAS THE LAST TIME WE LOOKED
	SNA CLA			/ HAS IT CHANGED?
	JMP	FLEXIT		/ NO, SO EXIT FLABUZ			/C120
	TAD I	(CLOCK+2)	/ GET THE TIME AGAIN
	CDFMYF			/ RESET DATA FIELD TO THIS FIELD	/A133
	DCA	TIMESE		/ AND SAVE FOR NEXT TIME

	TAD	FLEXIT		/ GET CALLER'S CIF-CDF INSTRUCTION	/A171
	TAD	(-6233)		/ COMBINE WITH NEGATIVE OF EDIT FIELD	/A171
	SZA CLA			/ IS THIS CALL COMMING FROM THE EDITOR	/A171
	JMP	FLABZ1		/ NO, CONTINUE WITH NORMAL FLOW		/A171
	JMS	FLTEST		/ YES, EXIT IF STATUS HAS NOT CHANGED 	/A171

	AC7776			/ CHECK FOR PRINTER/SPOOLER STOPPED	/A110
	TAD	PRSTTS		/  ...					/A110
	SPA CLA			/ DO WE NEED TO FLASH STOPPED MSG?	/A110
	JMP	FLEXIT		/ NO, EXIT BECAUSE OF CALL FROM EDITOR	/A110
	JMP	FLABZ2		/ YES, DISPLAY STOPPED MESSAGE ONLY ONCE/A110

FLABZ1,	TAD	PRSTTS		/ GET CURRENT PRINTER STATUS		/A171
	CIA			/ NEGATE VALUE				/A171
	SNA			/ IS STATUS VALUE EQUAL TO ZERO ?	/A171
	JMP	BLANKP		/ YES, GO BLANK PREVIOUS STATUS MESSAGE	/A171
	IAC			/ INCREMENT STATUS VALUE		/A171
	SNA CLA			/ IS STATUS VALUE EQUAL TO ONE ?	/A171
	JMP	PNTING		/ YES, GO PUT UP "BUSY" MESSAGE		/A171

FLABZ2,	CIFMNU			/ NO, PUT UP PRINTER/SPOOLER STOPPED	/A171
	JMS I 	IOACAL		/ USE IOA TO OUTPUT STRING TO SCREEN	/A098
	0			/ USE IOA DEFAULT OUTPUT ROUTINE	/A098
	PRTEXT			/ CONTROL STRING TO DISPLAY "PRINTER"	/M141
	TOPMID			/ SAVE CURSOR, SELECT TOP MIDDLE SCREEN./M141
	BLKREV			/ SET BLINK, REVERSE ATTRIBUTES		/M141
	STPTXT			/ TEXT FOR "STOPPED"			/A141
	LED4ON			/ TURN LED 4 ON AND RESTORE CURSOR	/A141

	JMS	FLTEST		/ EXIT IF STATUS HAS NOT CHANGED 	/A171
SNDBUZ,	CIFMNU			/ SOUND_BUZZER				/A098
	JMS I 	IOACAL		/ USE IOA TO OUTPUT STRING TO SCREEN	/A098
	0			/ USE IOA DEFAULT OUTPUT ROUTINE	/A098
	CSTRNG			/ ADDRESS OF CONTROL STRING		/A098
	BELTXT			/ ADDRESS OF BELL CODE			/A098
	JMP	FLDONE		/ GO UPDATE STATUS VALUE AND EXIT	/A171

BLANKP,	JMS	FLTEST		/ EXIT IF STATUS HAS NOT CHANGED	/A171
	CIFMNU			/ DON'T ERASE MORE THAN ONCE		/A098
	JMS I 	IOACAL		/ USE IOA TO OUTPUT STRING TO SCREEN	/A098
	0			/ USE IOA DEFAULT OUTPUT ROUTINE	/A098
	BLANKM			/ SEQUENCE TO ERASE MIDDLE OF SCREEN	/M141
	TOPMID			/ SAVE CURSOR, SELECT TOP MIDDLE SCREEN./M141
	LEDOFF			/ TURN LED 4 OFF AND RESTORE CURSOR	/A141
	JMP	FLDONE		/ GO UPDATE STATUS VALUE AND EXIT	/A171

PNTING,	CIFMNU			/ DISPLAY PRINTER BUSY MESSAGE		/A098
	JMS I 	IOACAL		/ USE IOA TO OUTPUT STRING TO SCREEN	/A098
NULTXT,	0			/ USE IOA DEFAULT OUTPUT ROUTINE	/A098
	PRTEXT			/ CONTROL STRING TO DISPLAY "PRINTER"	/M141
	TOPMID			/ SAVE CURSOR, SELECT TOP MIDDLE SCREEN./M141
	NULTXT			/ NUL TEXT STRING (POINTS TO A ZERO)	/A141
	BSYTXT			/ ADDRESS OF "BUSY   " TEXT		/A098
	LEDOFF			/ TURN LED 4 OFF AND RESTORE CURSOR	/A141
				/ AND FALL THRU TO EXIT			/A098

FLDONE,	TAD	PRSTTS		/ GET CURRENT PRINTER STATUS 		/A171
	DCA	PREVST		/ SAVE FOR NEXT PASS TO REFERENCE	/A171
	JMP	FLEXIT		/ DONE, GO RETURN TO CALLER		/A171

FLTEST,	XX			/ CHECK FOR PRINTER STATUS CHANGE	/A171
	TAD	PRSTTS		/ GET CURRENT PRINTER STATUS		/A098
	CIA			/ MAKE IT NEGATIVE			/A098
	TAD	PREVST		/ GET PREVIOUS STATUS (FROM LAST PASS)	/A098
	SZA CLA			/ HAS THERE BEEN A CHANGE ?		/A171
	JMP I	FLTEST		/ YES, GO HANDLE THE DIFFERENCE		/A171

FLEXIT,	XX			/ LOADED WITH A CDF CIF TO CALLERS FIELD/M171
	JMP I 	FLABUZ		/ RETURN TO CALLER

PREVST,	0			/ FOR STORAGE OF PREVIOUS STATUS	/A098
TIMESE,	0			/ FOR STORAGE OF CURRENT SECOND COUNT	/M171

/	ASCOUT CONVERTS A BINARY CODED VALUE IN THE RANGE
/	0000-3777 INTO ITS ASCII ENCODED BCD EQUIVALENT
/	LEADING ZEROS ARE SUPPRESSED, BUT AT LEAST ONE CHARACTER
/	IS CONVERTED, EVEN IF IT IS A ZERO.  THE RESULT IS PLACED IN
/	THE BUFFER POINTED TO BY NUMPTR
/
/	THE LAST CHR CONVERTED IS MARKED WITH THE 4000 BIT		/A196

/	ENTER ACC = BINARY VALUE
/	NUMPTR    = ADDRESS OF OUTPUT STORAGE
/	EXIT  ACC = 0
/	NUMPTR    = ADDRESS OF LAST DIGIT PLACED IN OUTPUT
/		    SIGNIFICANT ASCII OUTPUT
/
ASCOUT,	00
	DCA	BINVAL		/ TEMP STORAGE FOR INPUT VALUE
	TAD	(DECTAB-1
	DCA	DECPTR		/ SET POINTER TO WEIGHTED DECIMAL VALUE
	DCA	ASCFLG		/
/
ASCLP1,	DCA	ASCNT		/ ZERO THE RESULT COUNT
	ISZ	DECPTR		/ GET NEXT DECIMAL WEIGHT
	TAD I	DECPTR
	SNA 			/ IF ITS ZERO, WE'RE DONE
	JMP	ASCOUX		/ GO CLEANUP & EXIT			/C196
	CMA			/ IF ITS (-1) CMA MAKES IT 0000
	SNA CLA			/ IF ITS (-1), SET FLAG SO AT
	ISZ	ASCFLG		/ LEAST ONE DIGIT IS OUTPUT
/
ASCLP2,	TAD	BINVAL
	TAD I	DECPTR		/ SUBTRACT DECIMAL WEIGHT FROM BINARY
	SPA
	JMP	ASCDGT		/ UNTIL BINARY GOES NEGATIVE
	DCA	BINVAL
	ISZ	ASCNT		/ COUNTING UP THE ASCII WEIGHT
	JMP	ASCLP2
/
ASCDGT,	CLA
	TAD	ASCFLG		/ HAS ANYTHING GONE OUT YET ?
	TAD	ASCNT		/ GET THE RESULT
	SNA CLA
	JMP	ASCLP1		/ THIS DOES NOT OUTPUT LEADING ZEROS
	ISZ	NUMPTR
	TAD	(60		/ CONVERT COUNT TO ASCII
	TAD	ASCNT
	DCA I	NUMPTR		/ PUT ASCII VALUE INTO OUTPUT		/M073
	ISZ	ASCFLG		/ NON-LEADING ZEROS MUST BE OUTPUT
	JMP	ASCLP1
/
ASCOUX,	AC4000			/ FLAG LAST CHARACTER OUTPUT		/A196
	TAD I	NUMPTR		/					/A196
	DCA I	NUMPTR		/					/A196
	JMP I	ASCOUT		/ EXIT					/A196


ASCFLG,	0			/ DONT OUTPUT ZEROS UNTIL THIS IS SET
DECPTR,	0			/ PTR INTO THE FOLLOWING TABLE
	DECIMAL
DECTAB,	-1000
	-100
	-10
	-1
	0
	OCTAL
BINVAL,	0			/ THIS GETS DIMINISHED BY ADDING FROM
/				/ THE ABOVE TABLE
ASCNT,	0			/ THIS GETS INCREMENTED UNTIL BINVAL
/				/ IS NEGATIVE

/----------------------
	PAGE

PREFNT,		/ ENABLE A PARTICULAR FONT				/A152
	DCA	PRYES		/ ENABLE OUTPUT EVEN IF PRINTING OFF	/A164
	TAD	PREST1		/ GET THE VALUE				/A152
	AND	(17		/ ALLOW FONTS 8,9,10			/C215
	TAD	(11		/ FONT 1 MEANS A VALUE OF 10		/A152
	JMP	XSMXT		/ GO TRANSMIT A VALUE IN A CSISTR	/A152

/***********************************************************************/
/									/
/	PRQRX---GENERAL PURPOSE ROUTINE TO READ/WRITE THE DISK		/
/									/
/	CALLING SEQUENCE:						/
/		TAD	BLKNO		/LOAD AC WITH BLK NO		/
/		JMS	PRQRX						/
/			FUNCTION CODE	/E.G. RXERD+4000		/
/			DRIVE		/E.G. 0 FOR SYSTEM DISKK	/
/			BUFFER ADDRESS					/
/	JMP	ERROR		/ ERROR RETURN				/
/	...			/ NORMAL RETURN				/
/									/
/***********************************************************************/

PRQRX,	XX
	DCA	PRQB+RXQBLK	/ SET BLOCK NUMBER IN QBLK		/A183
	TAD I	PRQRX		/ PICK UP FUNCTION CODE			/A183
	DCA	PRQB+RXQFNC	/ SET IN QBLK				/A183
	ISZ	PRQRX		/ NEXT PARAMETER			/A183
	TAD I	PRQRX		/ PICK UP DRIVE NUMBER			/A183
	DCA	PRQB+RXQDRV	/ SET IN QBLK				/A183
	ISZ	PRQRX		/ NEXT PARAMETER			/A183
	TAD I	PRQRX		/ PICK UP THE BUFFER ADDRESS		/A183
	DCA	PRQB+RXQBAD	/ SET IN QBLK				/A183
	ISZ	PRQRX		/ NEXT PARAMETER			/A183

PRQRX1,	CIFSYS			/ QUEUE THE REQUEST
	ENQUE
	PRQBLK

PRQRX2,	JMS	SQPINP		/HANDLE ANY CHRS COMING BACK		/A113
	CIFSYS			/WAIT
	JWAIT
	TAD PRQB+RXQCOD		/GET THE DONE FLAG
	SNA	 		/SKIP IF DONE				/M059
	JMP	PRQRX2		/IF ZERO SERVICE NOT DONE		/A059
	SMA CLA			/SKIP BUMP IF ERROR
/ WE HAVE HAD A READ ERROR.  RETURN TO CALLER WITHOUT BUMPING		/A183
/ RETURN ADDRESS							/A183
	ISZ	PRQRX		/BUMP RETURN IF NO ERROR		/A183
	JMP I	PRQRX

MISCTL,	AC0004			/ MISSING END CONTROL			/A183
PRQSDE,	IAC			/SYSTEM DISK READ ERROR HERE		/C183
PRQDDE,	TAD	(22)		/DOCUMENT DISK READ ERROR HERE		/C183
	JMS	STSTTS		/SET PRINTER STATUS			/C122
	TAD	(OVSTP1							/A059
	JMS	PROV							/A059
		OBSTP1

RDFIO4,				/ ENTRY POINT TO CREATE A DOCUMENT READ	/A009
				/ FATAL ERROR FROM OTHER PLACES		/A009
				/ USED IF THE HEADER BLOCK NUMBER IS	/A009
				/ FOUND TO BE 0000			/A009

	CLA			/ CLEAR AC AND				/A009
	DCA	PRQB+RXQCOD	/ MAKE THIS LOCATION ZERO INCASE	/A009
				/ USER HITS RESUME AFTER ENTERING	/A009
				/ THE STOP PRINTER MENU TO SERVICE	/A009
				/ THE ERROR.  IN THIS WAY THE RESUME	/A009
				/ COMMAND WILL NOT DO ANYTHING AND	/A009
				/ THE USER WILL EVENTUALLY HAVE TO "S"	/A009
	JMP	PRQDDE		/ GO ENTER ABOVE TO CREATE DOC RD ERR	/A009

/THIS IS THE INFORMATION BLOCK FOR DISK BLOCKS REQUESTED BY THE PRINTER.

PRQBLK,	DSKQUE;0;0
PRQB,
	0			/ RXQCOD	FLAGS RETURNED HERE	
	0			/ RXQFNC	FUNCTION CODE		
	0			/ RXQDN1				
	0			/ RXQDN2				
	0			/ RXQFNO 	FILE NUMBER				
	0			/ RXQID1				
	0			/ RXQSPC				
	0			/ RXQCTL				
	0			/ RXQDRV	DRIVE NUMBER		
	0			/ RXQBLK	BLOCK NUMBER		
	0			/ RXQRS1				
	0			/ RXQBAD	BUFFER ADDRESS		
	CDFMYF			/ RXQBFD	BUFFER FIELD CDF 	
	0			/ RXQTRK	TRACK			
	0			/ RXQSEC	SECTOR

/***********************************************************************/
/									/
/	CSISTR--ROUTINE TO OUTPUT ESC [ FOLLOWED BY A STRING		/
/		THE STRING MAY CONTAIN A PARAMETER, TYPICALLY		/
/		A STRING OF ASCII DIGITS ALREADY STORED AT "NUMPTR"	/
/									/
/***********************************************************************/

CSISTR,	XX
	TAD	(ESC
	JMS	PRCHAR
	TAD	(133
	JMS	PRCHAR		/ [
	JMS	ESCST		/ OUTPUT THE REST OF THE STRING
	JMP I	CSISTR		/ RETURN

/***********************************************************************/
/									/
/	ESCST--OUTPUTS STRINGS 						/
/		ENTER ACC = 0						/
/		XSADX	  = POINTER TO STRING				/
/		NUMPTR	  = POINTER TO SUBSTRING (NUMERIC PARAMTER)	/
/									/
/		IF AN ASCII '*' IS ENCOUNTERED IN THE STRING AT XSADX	/
/		CONTROL IS PASSED TO THE SUBSTRING. THE SUBSTRING IS	/
/		USUALLY A NUMERIC PARAMETER BUT NOT NEED BE		/
/									/
/		THE LAST CHARACTER OF A STRING HAS THE SIGN BIT SET	/
/									/
/***********************************************************************/

ESCST,	XX			/ ROUTINE TO JUST OUTPUT STRINGS
ESCST1,	TAD I	XSADX		/ GET CHARACTER FROM STRING
	AND	(2177		/ MASK POSSIBLE END BIT			/C201
	TAD	(-52		/ IF CHAR = '*'
	SNA CLA
	JMP	TXENUM		/ THEN TRANSMIT NUMERIC STRING
	TAD I	XSADX		/ ELSE GET CHARACTER
	AND	P177		/ REMOVE POSSIBLE END MARK
	JMS	PRCHAR		/ SEND THE CHARACTER
ESLP,	TAD I	XSADX		/ IF CHAR SENT WAS LAST ONE
	SPA CLA
	JMP I	ESCST		/ THEN RETURN
	ISZ	XSADX		/ ELSE POINT TO NEXT CHAR
	JMP	ESCST1		/      CONTINUE
/
TXENUM,	TAD I	NUMPTR		/ GET NUMERIC CHARACTER
	AND	P177		/ REMOVE POSSIBLE END MARK
	JMS	PRCHAR
	TAD I	NUMPTR		/ WAS THAT THE LAST ONE ?
	ISZ	NUMPTR		/ BUMP POINT NOW!			/C196
	SPA CLA
	JMP	ESLP		/ YES, BACK TO CHARACTER STRING
	JMP	TXENUM

ESCNUM,	0 ; 0 ; 0 ; 0

/***********************************************************************/
/									/
/	PTSTST--TEST FOR STOP.  IF THE USER WANTS TO STOP WE INVOKE	/
/		THE STOP OVERLAYS.  THIS ROUTINE SHOULD ONLY BE CALLED	/
/		WHEN WE ARE PROCESSING A CONTROL STATEMENT (WHICH BY	/
/		DEFINITION CAN OCCUR ONLY BETWEEN LINES).  THE STOP	/
/		OVERLAYS ARE OF TYPE OVTYPE=OLC.  ALL OTHER TYPE C	/
/		OVERLAYS MUST BE CAPABLE OF BEING OVERLAYED BY THE 	/
/		STOP CODE WHICH THIS ROUTINE MAY INVOKE			/
/									/
/***********************************************************************/

PTSTST,	XX		/TEST FOR STOP					/A162

	TAD	PRSTOP		/ DOES USER WANT TO STOP?
	SNA CLA	
	JMP I	PTSTST		/ NO, RETURN

	AC0001			/ YES, SET FLAG				/A162
	DCA	PRSTPF		/ INDICATING SPECIAL STOP		/A162
	TAD	(OVSTP2		/ GO TO STOP OVERLAY
	JMS	PROV
		OBSTP2

PTSTSX,			/ COME BACK HERE IF R, P, C RESPONSE		/A162
	DCA	PRSTPF		/ CLEAR FLAG				/A162
	JMP I	PTSTST		/ AND RETURN				/A162


PRSTPF,	0			/ SPECIAL STOP FLAG			/A162

IDSTTM,	XX		/ ROUTINE TO SET THE TIMER			/A109
			/ READ LOCATION TIMOUT IN SYS AND ADD DELAY	/A109
			/ IN SECONDS					/A109
	DCA	T2	/ SAVE THE PRTID TIME DELAY			/A109
	CDFSYS		/						/A109
	TAD I	(TIMOUT	/ GET VALUE OF THE SYS TIMER			/A109
	CDFMYF								/A109
	TAD	T2	/ ADD THE DELAY					/A109
	DCA	IDTMC	/ SAVE AS THE VALUE TO COMPARE AGAINST		/A109
	JMP I	IDSTTM	/ RETURN					/A109
/------------------
PAGE
/CAUTION - THE FOLLOWING TWO PAGES ARE OCCUPIED BY THE BLKBOX ROUTINE	/A002
/	   AND TSTFUL ROUTINE DUE TO LACK OF SPACE IN THE EDITOR AND	/A002
/	   SYSTEM FIELDS RESPECTIVELY.					/A002

/CAUTION - THE FOLLOWING TWO PAGES ARE OCCUPIED BY THE BLKBOX ROUTINE	/A002
/	   DUE TO LACK OF SPACE IN THE EDITOR AND WPSYS			/C175
/									/A021
/++									/A021
/BLACKBOX PROGRAM FOR VIDEO COSMETICS					/A021
/									/A021
/FUNTIONAL DESCRIPTION: BLKBOX						/A021
/	BLKBOX points us to the user's video cosmetics routine.  It	/A021
/	sets up parameters needed for exiting video cosmetics as well	/A021
/	as pointing to the callers TTYOU routine.  In the case of a two /A021
/	user system (WS82) it determines which user called and sends us	/A021
/	to that user's video cosmetic routine.				/A021
/									/A021
/    BLACKBOX PSEUDO-CODE:						/A021
/									/A021
/	BLKBOX:	hold character						/A021
/		setup for exit to caller's field			/A021
/		get pointer to user's TTYOU routine			/A021
/		if [defined WS82]					/A021
/		   determine which user called. (result in LINK)	/A021
/		cdf to my field						/A021
/		if [defined WS82]					/A021
/		   if [user2 called]					/A021
/		      exit to USER2					/A021
/		exit to USER1						/A021
/									/A021
/CALLING SEQUENCE:EDOCHR, XX						/M021
/			CDFMYF						/A021
/			CIFPRT						/A021
/			JMS I	(BLKBOX)				/A021
/			JMP I	EDOCHR					/A021
/									/A021
/	BLKBOX IS CALLED FROM THE EDITOR (WPEDIT) AS ABOVE.		/A021
/									/A021
/INPUT PARAMETERS:							/A021
/	AC contains character to be displayed along with attrib. bits.	/A021
/									/A021
/IMPLICIT INPUTS:	TTYPTR, BLKBOX					/A021
/									/A021
/OUTPUT PARAMETERS:	AC = Subroutine return address			/A021
/			MQ = char. and attribute bits			/A021
/									/A021
/IMPLICIT OUPUT:	HLDFLD, TTYHLD					/A021
/									/A021
/COMPLETION CODE:	none						/A021
/									/A021
/SIDE EFFECTS:								/A002
/	1) Due to lack of room in fld. 3 (and fld.5 if WS82) of the	/A021
/	   WPEDIT, BLACKBOX resides here in field 1 of WPRINT at	/A021
/	   address 4000. If location of BLKBOX is changed be sure to	/A021
/	   change WPF1.PA (BLKBOX = 4000).				/A021
/									/A021
/--									/A021

/USER1 AND USER2 VIDEO COSMETICS					/A021
/									/A021
/FUNCTIONAL DESCRIPTION:	USER1 and USER2				/A021
/	The USER1 and USER2 routines turn on or off the character	/A021
/	attributes of the video display controller, to enable the user	/A021
/	to see attributed text (bolded, underlined, bolded & underlined)/A021
/	as it will appear in a printed document.			/A021
/									/A021
/  USER1 and USER2 PSEUDO-CODE						/A021
/									/A021
/	The pseudo code described here is applicable for both routines.	/A021
/	It appears here so as not to be redundant at USER2's listing.	/A021
/									/A021
/	USER1 and USER2:						/A021
/		save return address					/A021
/		save character						/A021
/		get cif cdf instruction					/A021
/		save it							/A021
/		get pointer to user's TTYOU routine			/A021
/		install it						/A021
/		get character's attribute				/A021
/		store in current attribute location			/A021
/		if [current char. attrib. = prev. char. attrib.]	/A021
/		      process char					/A021
/	        else							/A021
/		   if [prev. char. was attributed]			/A021
/			 turn off attributes				/A021
/		   set prev. attribute = -current attribute		/A021
/	           CASE ATTRIBUTE MODE OF				/A021
/		      0 : NO ATTRIBUTES 				/A021
/		      1 : BOLD						/A021
/		      2 : UNDERLINE					/A021
/		      3 : BOLD & UNDERLINE				/A021
/		      4 : SUPERSCRIPT					/A021
/	              5 : BOLD (+ SUPERSCRIPT)				/A021
/	              6 : SUBSCRIPT					/A021
/	              7 : BOLD (+ SUBSCRIPT)				/A021
/		   process character					/A021
/									/A021
/		ATTRIBUTE ROUTINE(ALL OFF, BOLD, UNDERLINE)		/A021
/		   TYPE 'ESCAPE' (ASCII 33)				/A021
/		   TYPE '['						/A021
/		   TYPE APPROPRIATE CODE (0, 1, OR 4 RESPECTIVELY)	/A021
/		   TYPE 'm'						/A021
/									/A021
/									/A021
/		TYPE CHAR ON SCREEN					/A021
/									/A021
/		   REPEAT						/A021
/		      TRY TO PUT CHAR ON SCREEN & IN BUFFER		/A021
/		   UNTIL BUFFER NOT FULL				/A021
/									/A021
/		ATTRIBUTE ROUTINE(BOLD & UNDERLINE)			/A021
/		   DO ATTRIBUTE ROUTINE (BOLD)				/A021
/		   DO AN UNDERLINE					/A021
/									/A021
/									/A021
/	PROCESS CHAR							/A021
/									/A021
/		GET CHAR						/A021
/		MASK OUT MODE BITS					/A021
/		TYPE IT							/A021
/		CHANGE INSTR. & DATA FIELD TO CALLER FIELD		/A021
/		EXIT ROUTINE						/A021
/									/A021
/	THIS ROUTINE ACCEPTS ATTRIBUTED ASCII CHARS FROM THE EDITOR AND	/A021
/	PROCESSESES THEM ACCORDING TO THE SPECIFICATIONS GIVEN IN	/A021
/	"VT278 - THE PHASE II PLAN"					/A021
/	-- SECTION 8.4.16 -- 						/A021
/	"ESC[Xm" TO THE TERMINAL PRODUCES ATTRIBUTED CHARS THEREAFTER,  /A021
/	WHERE X = 0	ALL ATTRIBUTES OFF				/A021
/		  1	DISPLAY BOLDED					/A021
/		  4	DISPLAY UNDERLINED				/A021
/									/A021
/INPUT PARAMETERS:	AC = Subroutine return address			/A021
/			MQ = character with attribute bits		/A021
/									/A021
/IMPLICIT INPUTS:	HLDFLD, TTYHLD, CHAR, CURATR, PRVATR, ATRBUT	/A021
/			P177						/A021
/									/A021
/OUTPUT PARAMETER:	AC = 0						/A021
/									/A021
/IMPLICIT OUTPUT:	USER1EXIT, CHAR, EXTFLD, TTYOUP, CURATR,	/A021
/			PRVATR, ATRBUT					/A021
/									/A021
/COMPLETION CODE:	none						/A021
/									/A021
/SIDE EFFECTS:								/A021
/	1) USER1 and USER2 should ONLY be called through the BLKBOX	/A021
/	   routine due to dependence on parameters supplied by BLKBOX.	/A021
/	2) Due to lack of room in fld. 3 (and fld.5 if WS82) of the	/A021
/	   WPEDIT, USER1 and USER2 resides here in field 1 of WPRINT.	/A021
/									/A021
/WPEDIT LOOKS AT CURATR IN THE BOLDING AND UNDERLINING OF TABS		/A057
CURATR,	0		/ CURRENT ATTRIBUTE				/M057

BLKBOX,	XX								/A021
	DCA	CHAR		/SAVE CHARACTER				/M186
	TAD	CIDF0		/SETUP FOR EXIT TO PROPER FIELD		/A021
	RDF								/A021
	DCA	EXTFLD		/PLACE IN EXIT FIELD LOC.		/M174
	CDFMYF								/A021
USER1,	TAD	CHAR		/GET CHARACTER'S ATTRIBUTE		/A021
	RAR;BSW			/	BITS 2,3,4 BECOME BITS 9,10,11	/A021
	AND	(7)		/	MASK OUT REST			/A021
	DCA	CURATR		/STORE NEW CHARACTER'S ATTRIBUTE	/A021
	TAD	CURATR		/IF CURRENT CHAR.'S ATTRIB.
	TAD	PRVATR		/ = PREV CHARS ATTRIB.
	SNA CLA			/   THEN				/A021
	JMP	PRCCHR		/      PROCESS CHARACTER		/A021
/									/A021
/HERE PREV. ATTRIB. SET EQUAL TO -CURRENT ATTRIB. THEN			/A021
/ATTRIBUTE MODE IS ADDED TO START OF ATTRIBUTE TABLE,			/A021
/AND PROGRAM EXECUTES THE PROPER SUBROUTINE.				/A021
/									/A021
				/ELSE					/A021
	TAD	PRVATR		/IF PREV. CHAR. ATTRIBUTED		/A021
	SNA CLA			/					/C197
	JMP	BLKBO1		/					/A197
	JMS	TYPATR		/TURN OFF ALL ATTRIBUTES		/C197
	"0&177								/A021
BLKBO1,	TAD	CURATR		/PREV. ATTRIB. = -CURRENT ATTRIB.	/A021
	CIA								/A021
	DCA	PRVATR							/A021
	TAD	CURATR		/CASE ATTRIBUTE MODE OF			/A021
	TAD	(ATRTBL)	/0					/A021
	DCA	ATRBUT		/THRU					/A021
	TAD I	ATRBUT		/7					/A021
	DCA	ATRBUT							/A021
	JMP I	ATRBUT		/JMP TO APPROPRIATE ATTRIBUTE ROUTINE	/C197

/ NOW PROCESS THE CHARACTER ITSELF

PRCCHR,	TAD	CHAR		/GET CHAR				/A021
	AND	P177		/MASK OUT MODE BITS			/A021
	SZA			/SKIP IF A NULL				/A222
	JMS	T1YPE		/TYPE IT				/A021
EXTFLD,	0			/CHANGE TO CALLER DATA AND INSTR. FIELD	/A021
	JMP I	BLKBOX		/ Return to caller.			/M174


ATRBUT,	0			/ATTRIBUTE TABLE POINTER		/A021
/									/A021
/	ATTRIBUTE TABLE							/A021
/									/A021
ATRTBL,	PRCCHR			/NO ATTRIBUTE				/C197
	BOLD			/DO ATTRIBUTE ROUTINE (BOLD)		/A021
	UNDRLN			/ "     "       "     (UNDERLINE)	/A021
	BLDUND			/ "	"	"     (BOLD & UNDERLINE)/A021
	PRCCHR			/SUPERSCRIPT				/C197
	BOLD			/BOLD (+ SUPERSCRIPT)			/A021
	PRCCHR			/SUBSCRIPT				/C197
	BOLD			/BOLD (+ SUBSCRIPT)			/A021
/									/A021
/	ATTRIBUTE ROUTINE(BOLD)						/A021
/									/A021
BOLD,	JMS	TYPATR		/TYPE ATTRIBUTE USE ASCII '1' PARAMETER	/C197
	"1&177								/A021
	JMP	PRCCHR							/C197
/									/A021
/	ATTRIBUTE ROUTINE(UNDRLN)					/A021
/									/A021
UNDRLN,	JMS	TYPATR		/TYPE ATTRIBUTE USEASCII '4' PARAMETER	/C197
	"4&177								/A021
	JMP	PRCCHR							/C197
/									/A021
/	ATTRIBUTE ROUTINE(BOLD & UNDERLINE)				/A021
/									/A021
BLDUND,	JMS	TYPATR		/FIRST DO THE UNDERLINE			/C197
	"4&177			/					/C197
	JMP	BOLD		/AND FINISH WITH THE BOLD		/A197


/	TYPE ATTRIBUTE ROUTINE(ALLOFF, BOLD, UNDERLINE)			/A021
/									/A021
TYPATR,	XX								/A021
	TAD	(ESC)							/A021
	JMS	T1YPE		/TYPE "ESCAPE"				/A021
	TAD	("[&177)						/A021
	JMS	T1YPE		/TYPE '['				/A021
	TAD I	TYPATR							/A021
	JMS	T1YPE		/TYPE APPROPRIATE CODE(0, 1, OR 4)	/A021
	TAD	("m&177
	JMS	T1YPE		/TYPE 'm'				/A021
	ISZ	TYPATR		/BUMP POINTER PAST PARAMETER		/A021
	JMP I	TYPATR							/A021
/									/A021
/									/A021
/	TYPE CHAR ONTO SCREEN						/A021
/									/A021
T1YPE,	XX								/A021
	JMP	T1YPE2							/A021
T1YPE1,	CIFSYS			/REPEAT					/A021
	JWAIT								/A021
T1YPE2,	CIFSYS			/TRY TO PUT CHAR ON SCREEN & IN BUFFER	/A021
	TTYOU			/ output character to terminal.		/A174
	JMP	T1YPE1		/UNTIL BUFFER NOT FULL			/A021
	JMP I	T1YPE							/A021


CHAR,	0			/HOLDS CURRENT CHARACTER		/A021
PRVATR, 0			/PREVIOUS ATTRIBUTE			/A021

/***********************************************************************/
/									/
/	PRTRID--							/
/	THIS ROUTINE SERVES AS A SUBROUTINE ENTRY POINT WHICH		/
/	CAN BE CALLED FROM OTHER FIELDS					/
/	IT IS CALLED BOTH FROM WITHIN THE PRINTER CODE			/
/	AND FROM LIST PROCESSING (WPCUT) AND CX (WPCX)			/
/									/
/		AC0002		INDICATES A CALL TO CHECK DOC DEST	/
/		CDFMYF		AND SET QUALITY MODE IF LA50/LA100	/
/		CIFPRT							/
/		JMS PRTRID						/
/			DOC DESTINATION OK RETURN			/
/			WRONG DD RETURN					/
/-----------------------------------------------------------------------/
/		AC0001		INDICATES A CALL TO IDENTIFY THE PRINTER/
/		CDFMYF		AND RETURN TO THE CALLER ON ERROR	/
/		CIFPRT							/
/		JMS PRTRID						/
/			OK RETURN					/
/			ERROR RETURN					/
/-----------------------------------------------------------------------/
/		AC0000		INDICATES A CALL TO IDENTIFY THE PRINTER/
/		CDFMYF		AND GO TO STOP OVERLAY ON ERROR		/
/		CIFPRT		(GENERALLY ONLY USED BY PRINTER CODE	/
/		JMS PRTRID						/
/			OK RETURN					/
/			ON ERROR CALLS STOP PRINTER OVERLAY		/
/			 WITH NON-EXISTENT PRINTER MESSAGE		/
/			 OR PAUSED MESSAGE				/
/
PRTRID,	XX
	DCA	IDCAL	/SAVE AC ON ENTRY
	RDF		/READ CALLER'S DATA FIELD			/A055
	TAD 	CIDF0	/BUILT CDI INSTRUCTION				/A055
	CDFMYF		/CHANGE DATA FIELD TO MINE			/A055
	DCA	IDRTN							/A055
	DCA	PRPUMM	/ clear PUM mode flag for all callers		/a232
	AC7777		/SEE WHAT ROUTINE IS DESIRED			/A140
	TAD	IDCAL	/DETERMINED BY AC UPON CALL			/A140
	SNA SPA CLA	/SKIP IF IDCAL 2 OR GREATER			/A140
	JMP	PRTRI1	/ID PRINTER					/A140

/***********************************************************************/A206
/									/A206
/	NOTE: OBDDCK AND OBPID MAY NOT BE THE SAME TYPE AS OBWAIT	/A206
/	SINCE PRTRID MAY BE CALLED BY THE USER JOB (LIST PROCESSING)	/A206
/									/A206
/***********************************************************************/A206

	TAD	(OVDDCK)/CHECK DOCUMENT DESTINATION			/A140
	JMS	PROV							/A140
		OBDDCK							/A140

PRTRI1,	TAD	(OVPID)	/ID PRINTER					/A140
	JMS	PROV							/A140
		OBPID							/A140


IDRTN,	XX								/A055
	JMP I	PRTRID							/A036

IDCAL,	0	/USED BY PRINTER ID ROUTINE
		/0 FOR REGULAR ERROR PROCESSING, NON 0 WHEN
		/SKIP RETURN ON ERROR REQUESTED			

SKNHST,	XX		/SKIP IF NOT DD CHST				/A207
	TAD	PRQPNT		/GET DOCUMENT DESTINATION
	TAD	(-DHOST2)	/SEE IF MATCHES CODE FOR CHST
	SZA CLA			/
	ISZ	SKNHST		/BUMP IF NOT DD CHST
	JMP I	SKNHST		/RETURN

ESMVV2,		/FORWARD VERTICAL MOTION IS DONE BY DOING AS MANY
		/FULL LINE FEEDS AS POSSIBLE, AND THEN ANY HALF LINE FEED
		/LINE FEEDS ARE ASSUMED TO BE 1/6 INCH
		/REMEMBER ESCAPE SEQUENCES ARE NOT SENT TO THE HOST
		/SO WE MUST USE LINE FEEDS
		/EXCEPT IN THE CASE OF DD CHST WHEN WE USE CARRIAGE RETURNS

	ISZ	ESCT1		/NEXT 1/2 LINE
	SKP
	JMP	ESCSTG		/ONE MORE HALF LINE NEEDED		/C222
	JMS	SKNHST		/SKIP IF NOT HOST
	TAD	(CR-LF)		/IF HOST PUT OUT CARRIAGE RETURN	/A207
	TAD	(LF)		/ELSE PUT OUT LINE FEED			/A207
	JMS	PRCHAR		/CALL PRCHAR DIRECTLY			/A207
	ISZ	ESCT1		/SEE IF WE ARE DONE LINE FEEDS
	JMP	ESMVV2		/NO
	JMP	PRESXT		/YES
/-----------------
	PAGE

/ THIS CODE CONTAINS THE RESIDENT JEXIT FROM THE PRINTER JOB		/A180
/ THIS IS DONE WHEN ANOTHER JOB NEEDS THE PRINTER FIELD			/A180
/ SEE FULL EXPLANATION NEAR OVPRJX IN WPRTOV				/A180

/***********************************************************************/
/									/
/	THIS CODE CONTAINS NO ASSEMBLER GENERATED LINKS			/
/	THIS IS BECAUSE THE END OF THIS PAGE IS PART OF LPOBUF		/
/									/
WAITJX,	CIFSYS								/A180
	JEXIT								/A180

/WE MUST RELOAD THE CRITICAL VALUES ON PAGE ZERO BEFORE WE LEAVE	/A180
/RESIDENT CODE SINCE WE MAY DO A JWAIT OR AN LPTIN WHEN WE GO		/A180
/TO LOAD AN OVERLAY!							/A180

	TAD	WAITK1		/ INITIALIZE 10020-10076
	DCA	T1		/ UP TO BUT NOT INCLUDING T1!
	TAD	WAITK2		/ ELSE THIS LITTLE SECTION BLOWS AWAY!
	DCA	X0
	TAD	WAITK2
	DCA	X1
WAKEU1,	CDFSYS
	TAD I	X0
	CDFMYF
	DCA I	X1
	ISZ	T1
	JMP	WAKEU1

/ FLUSH IN THE INPUT BUFFER INCASE THERE IS GARBAGE
	CIFSYS
	LPTIN
	SKP			/ NO MORE CHRS, CONTINUE
	JMP	.-3		/ GO BACK FOR MORE
/	CLA

	AC4000			/LOAD A CODE TO MAKE SURE		/A180
	DCA I	WAITP1		/WE LOAD THIS OVERLAY AFRESH		/A180
	TAD	WAITP2		/GO WAKE UP AT OVWKUP			/C183
	JMS I	WAITP3		/JMS PROV				/C183
		OBWKUP							/A180
WAITK1,	20-T1								/A183
WAITK2,	20-1								/A183
WAITP1,	OBWKUP&7400+PROVA						/A183
WAITP2,	OVWKUP								/A183
WAITP3,	PROV								/A183

/ THIS PAGE CONTAINS TEXT STRINGS SENT BY FLABUZ ROUTINE

BLANKM,	TEXT '^A                  ' / BLANK OUT STOPPED OR BUSY MESSAGE	/M141
*.-1				/ SAVE LOCS BY COMBINING BLANKM & CSTRNG/C193
CSTRNG,	TEXT '^A'		/ THIS SAYS TO IOA "NEXT WORD IS ADDRESS OF
				/ STRING TO OUTPUT TO SCREEN"
BELTXT,	BELL; 0			/ ASCII STRING TO RING TERMINAL BELL	/A098

PRTEXT,	IFDEF ENGLSH <
	TEXT '^A!&PRINTER ^A^S^A' / DISPLAY "PRINTER" & STOPPED OR BUSY	/M141
	>
	IFDEF ITALIAN <
	TEXT '^A!&STAMPANTE ^A^S^A'
	>
	IFDEF V30NOR <
	TEXT '^A!&SKRIVER ^A^S^A'					/A238
	>
	IFDEF V30SWE <
	TEXT '^A!&SKRIVAREN \DR^A^S^A'>					/A238

	IFDEF DUTCH <
	TEXT '^A!&PRINTER ^A^S^A' / DISPLAY "PRINTER" & STOPPED OR BUSY	/M141
	>

	IFDEF SPANISH <
	TEXT '^A!&IMPRESORA ^A^S^A' / DISPLAY "PRINTER" & STOPPED OR BUSY	/M141
	>


STPTXT,	IFDEF ENGLSH <
	TEXT '!&STOPPED'	/ TEXT FOR PRINTER "STOPPED" MESSAGE	/M141
	>
	IFDEF ITALIAN <
	TEXT '!&BLOCCATA'
	>
	IFDEF V30NOR <
	TEXT '!&STOPPAD'>						/A238

	IFDEF V30SWE <
	TEXT '!&STOPPET'>						/A238
	
	IFDEF DUTCH <
	TEXT '!&GESTOPT'>
	
	IFDEF SPANISH <
	TEXT '!&DETENIDA'>
	



BSYTXT,	IFDEF ENGLSH <
	TEXT '!&BUSY   '	/ TEXT FOR PRINTER "BUSY" MESSAGE	/M141
	>
	IFDEF ITALIAN <
	TEXT '!&OCCUPATA'
	>
	IFDEF V30NOR <
	TEXT '!&AKTIV' >

	IFDEF V30SWE <
	TEXT '!&UPPTAGEN'>

	IFDEF DUTCH <
	TEXT '!&BEZIG  '>

	IFDEF 	SPANISH <
	TEXT '!&OCUPADA '>



/ TOPMID SAVES CURSOR POSITION AND ATTRIBUTES AND SELECTS ABSOLUTE MODE	/M138
/ OF ADDRESSING AND POSITIONS CURSOR TO TOP MIDDLE OF SCREEN (col.33)	/M138

TOPMID,	ESC; "7&177		/ SAVE CURSOR POSITION AND ATTRIBUTES	/A138
	ESC; "[&177; "?&177; "6&177; "l&177
				/ SELECT ABSOLUTE CURSOR ADDRESSING	/A138
	ESC; "[&177; "1&177; ";&177; "3&177; "3&177; "H&177
				 / POSITION CURSOR TO COLUMN 33	/M138
	0			/ ASCII STRING TERMINATOR		/A120

BLKREV,	ESC; "[&177; "5&177; ";&177; "7&177; "m&177
				/ SET BLINK AND REVERSE ATTRIBUTES 	/M138
	0			/ ASCII STRING TERMINATOR		/A120

LED4ON,									/A138
	ESC; "[&177; "m&177; " &177/ RESET CURSOR ATTRIBUTES & PRINT BLANK	/M138
LEDOFF,									/A138
	ESC; "8&177		/ RESTORE CURSOR POSITION AND ATTRIBUTE	/A138
	0			/ ASCII STRING TERMINATOR		/A120

PRLBUF,	XX	/THE BEGINNING OF THE LINE BUFFER.

/ THERE MUST BE NO LINKS HERE!
/----------------------------------------------
	PAGE			/ 4400
/

	XX
/-----------------------
	PAGE			/ 4600


/THE PART OF THE PRECEEDING PAGE AFTER THE LABEL PRLBUF, AND THIS ENTIRE
/PAGE COMPRISES THE LINE BUFFER FOR THE PRINTER.  HOWEVER, SOME BOOT TIME
/INTIIALIZATION CODE RESIDES IN THE BUFFER TEMPORARILY.

/AFTER THE SYSTEM IS LOADED, CONTROL TRANSFERS HERE.  SOME INITIALIZATION
/AND COPYING TAKES PLACE, THE ONE (OR TWO) USER JOBS ARE STARTED UP, AND
/THE PRINTER CONTINES WITH ITS OWN INITIALIZATION.
/ALSO FIELD 7 FOR WPFILS

FLD3R,

/ INITIALIZE PRINTER PAGE ZERO SINCE IT IS NOT WRITTEN OUT		/A166

	CDFMYF								/A166

FLD2R1,	DCA I	FLD3T1		/RESET A LOCATION IN LOC 0-17		/A166
	ISZ	FLD3T1		/BUMP ADDRESS				/A166
	ISZ	FLD3T3		/BUMP COUNTER				/A166
	JMP	FLD2R1		/NOT DONE				/A166

/THIS LOOP COPIES SIXTY WORDS BEGINNING AT LOCATION 20 IN FIELD 0 INTO
/FIELD 1, FIELD 2 AND FIELD 7

FLD3L1,	
	CDF	0		/CHANGE TO FIELD 0
	TAD I	FLD3T1		/GET A WORD
	CDF	10		/CHANGE TO FIELD 1
	DCA I	FLD3T1		/SAVE THE WORD

	TAD I	FLD3T1		/RECOVER THE WORD
	CDF	20		/CHANGE TO FIELD 2
	DCA I	FLD3T1		/SAVE THE WORD

	TAD I 	FLD3T1		/COPY FIELD 0 GLOBALS INTO FIELD 7
	CDF	70
	DCA I 	FLD3T1
	ISZ	FLD3T1		/INCREMENT THE POINTER
	ISZ	FLD3T2		/ARE WE THROUGH?
	JMP	FLD3L1		/NO--KEEP COPYING

	CDFPRT			/CHANGE BACK TO THIS FIELD		

FLD2R2,	DCA I	FLD3T1		/RESET A LOCATION IN LOC 100-177	/A166
	ISZ	FLD3T1		/BUMP ADDRESS				/A166
	ISZ	FLD3T4		/BUMP COUNTER				/A166
	JMP	FLD2R2		/NOT DONE				/A166

	TAD	(PRTRID		/INITIALIZE THE LINK ON PAGE ZERO	/A166
	DCA	PRTID		/FOR THE WORLD				/A166

	TAD    (U1JOB)		/NOW START THE FIRST USER		
	CIF	0		
	JSTRT		

	CLA								/C143

/ NOW WE MUST INITIALIZE THE WORD AT THE BEGINNING OF EACH PRINTER
/ OVERLAY SO THAT WE WILL BE SURE AND LOAD EACH AREA THE FIRST TIME

	TAD	(7400							/A150
	DCA	PROVA							/A150
	TAD	(7400							/A150
	DCA	PROVA+400						/A150
	TAD	(7400							/A150
	DCA	PROVA+1000						/A150


/It is boot up time so read in system value block from system floppy
/and get auxiliary baud rate from system diskette and set baud to that
/value
	TAD (DLSVAL)		/Set to read system value block 	/A027
	JMS PRQRX		/Go read in block			/A027
		RXERD+4000	/					/A183
		0		/SYSTEM DRIVE				/A183
		RDBUF		/BUFFER ADDRESS				/A183
	JMP	PRQSDE		/ERROR READING DLSVAL DURING BOOT	/A183
	TAD  I (RDBUF+MNPRTB-MNABRV)	/Get auxiliary baud rate /A027	/M030
	AND  (17)							/A030
	TSB2			/Set baud rate				/A027
	6321;NOP		/ CLEAR PENDING FLAG.			/A056
	6326;NOP		/ READ PENDING CHARACTER.		/A056
	CLA

/ Load the 8 bit fallback code on top of the startup section in DSKHND	/a228
/ The startup code is saved in panel mem so that it can be called back  /a228
/ in if there is a problem reading/writing drive 0			/a228

/ But first modify the the V25STB startblock so that V25ST will run on	/a228
/ any warm start							/a228	

	CDF 0			/ PUT all this stuff in the DSKHND field/a228
	TAD	(V25STB-1)	/ get the table address			/a228
	DCA	X3		/ put in an auto index register		/a228
	TAD	(DLCMPS)	/ load the start block			/a228
	DCA I	X3		/ put it in the table			/a228
	TAD	(CDFSYS)	/ CDF buffer FLD			/a228
	DCA I	X3		/ put it in the table			/a228
	TAD	(V25ST)		/ get the buffer start address		/a228
	DCA I	X3		/ put it in the table			/a228
	TAD	(-DSCMPS)	/ negative block count			/a228
	DCA I	X3		/ put it in the table			/a228
	CDFMYF			/ put the data feild back		/a228

	JMS	BHOOK		/ call the BLASTR that has already been /a228
				/ loaded				/a228
	FALBKE			/ fallback entry code			/a228
	CLA			/ clear the AC just in case BHOOK dusne	/a228

/ load the PLNRCS with the standard character width for use by cx & print
/ screen								/a233

	TAD	(12)		/ get the standard character width	/a233
	DCA	PLNRCS		/ save it for use by all		/a233
	

/ THE INITIALIZATION CODE IS DONE.  GO TO THE DONE OVERLAY
	TAD	(OVDON1
	JMS	PROV
		OBDON1


TSB2=6333	/SET THE BAUD RATE ON SLU3 OR THE VT278 PRINTER PORT
	




FLD3T1,	0	/THE ADDRESS TO INITIALIZE
FLD3T2,	-60	/THE AMOUNT TO COPY FROM FIELD 0 (LOCS 20-77)
FLD3T3,	-20	/COUNTER TO INITIALIZE LOCS 0-17 ON PAGE ZERO
FLD3T4,	-100	/COUNTER TO INITIALIZE LOCS 100-177 ON PAGE ZERO
/-----------------
	PAGE
MAXLIN=.-PRLBUF	/THE SIZE OF THE LINE BUFFER
	DECIMAL
IFNZRO MAXLIN-288&2048 <BUFFER TOO SMALL!>				/A215
	OCTAL

/PRESCS - SENDS [ESCAPE] [VALUE] [CHARACTER] TO LQP

/AC=VALUE
/JMS	PRESCS
/	CHARACTER
/RETURN POINT, AC=VALUE


PRESCS,	XX

	DCA	PREST1	/SAVE THE VALUE

/ IF DD=HOST, DON'T SEND ANY ESCAPE SEQUENCES				/A158
/ IF WE ARE PRINTING TO AN LQPSE, USE ESC01 ROUTINE
/ FOR DRAFT PRINTERS AND LQP02 USE ESC02 ROUTINE

	TAD	LPONLN							/A113
	SNA CLA							/A158	/C165
	JMP	PRESC4		/ GO RETURN WITHOUT SENDING		/A165
	JMS	SKIPIF		/ SKIP IF LQPSE				/A165
		LQPSE		/					/A165
	JMP	ESC02		/ MAKE ESC02 PART OF THIS ROUTINE	/C165

/ IS AN LQPSE								/A182
	TAD I	PRESCS		/ PICK UP THE CODE			/A182
	JMP	ESC01		/ PROCESS LQPSE ELSEWHERE

PRESC3,			/ RETURN HERE TO FINISH LPQSE SECTION
	TAD I	PRESCS		/ GET THE CHARACTER
	JMS	PRCHAR		/ OUPUT IT

PRESC4,
	TAD	PREST1		/ GET THE VALUE
	ISZ	PRESCS		/ ADJUST THE RETURN ADDRESS
	JMP I	PRESCS		/ AND RETURN

/ ESCAPE SEQUENCE FORMATTING & OUTPUT ROUTINE FOR LQPSE

/ IF THE BIT FLAG NLQPSE IS SET THEN NOTHING IS OUTPUT			/A165
/ AS THIS SEQUENCE IS NOT INTENDED FOR THE LQPSE AND IT DOESN'T		/A165
/ KNOW HOW TO THROW IT AWAY						/A165

/THE VALUE TAKES THE FORM OF UP TO THREE ENCODED DIGITS.  THESE DIGITS
/OCCUPY FOUR-BIT SEGMENTS OF THE VALUE (0-3, 4-7, 8-11).  THE DIGITS ARE
/TRANSMITTED BEGINNING WITH THE HIGHEST ORDER NON-ZERO DIGIT.  IF ALL THE
/DIGITS ARE ZERO, NO VALUE IS TRANSMITTED.

/THE DIGITS ARE OUTPUT ENCODED AS ASCII CHARACTERS--DIGIT 0 BECOMES 40
/(SPACE), DIGIT 1 BECOMES 41, AND SO ON.

/AFTER THE VALUE IS TRANSMITTED, THE CHARACTER IS SENT.
/MODIFIED TO OUTPUT LEADING ZEROS					/A165

ESC01,
				/AC CONTAINS THE ARGUMENT AFTER THE CALL
	AND	(NLQPSE)	/SEE IF THE NO TRANSMIT BIT IS SET	/A165
	SZA CLA								/A165
	JMP	PRESC4		/YES, JUST GO EXIT			/A165

	TAD	PREST1		/GET THE VALUE
	DCA	PROVT1		/SAVE IT IN A TEMPORARY

	AC7775			/THERE CAN BE A MAXIMUM OF THREE DIGITS ENCODED
	DCA	PROVT2		/SAVE INTO A COUNT TEMPORARY

	TAD	(ESC)
	JMS	PRCHAR		/SEND THE ESCAPE

/THIS LOOP SEARCHES FOR THE FIRST NON-ZERO DIGIT.

ESC01A,
	TAD	PROVT1	/GET VALUE
	AND	(7400)	/LOOK AT THE HIGH ORDER DIGIT
	SZA
	JMP	ESC01B	/THERE IS A DIGIT--BEGIN THE OUTPUT SEQUENCE

/THE DIGIT IS NOT NON-ZERO.  WE MUST LOOK IN THE NEXT POSITION.

	TAD	PROVT1	/RECOVER THE VALUE
	CLL RTL
	RTL		/MOVE THE NEXT DIGIT CANDIDATE TO THE HIGH POSITION
	DCA	PROVT1	/SAVE THE VALUE
	ISZ	PROVT2	/BUMP THE COUNT--LEAVE THE LOOP IF WE'VE LOOKED AT
			/ALL THREE POSITIONS
	JMP	ESC01A	/CONTINUE THE LOOP

	JMP	PRESC3	/OUTPUT NO VALUE--THE VALUE WAS ZERO


/A DIGIT HAS BEEN FOUND IN THE HIGH FOUR BITS.  OUTPUT THIS DIGIT AND ALL
/THAT FOLLOW UNTIL THE COUNT OF 3 EXPIRES.

ESC01B,	
	CLL BSW
	RTR		/MOVE THE DIGIT INTO THE LOW FOUR BITS
	TAD	(40)	/ADD THE SPACE VALUE
	JMS	PRCHAR	/OUTPUT THE DIGIT

	TAD	PROVT1	/GET THE VALUE BACK
	CLL RTL
	RTL		/GET THE NEXT DIGIT INTO THE HIGH FOUR BITS
	DCA	PROVT1	/SAVE THE ROTATED VALUE

	TAD	PROVT1	/RECOVER THE VALUE
	AND	(7400)	/ISOLATE THE DIGIT
	ISZ	PROVT2	/BUMP THE COUNT--SKIP IF WE'VE EXCEEDED IT
	JMP	ESC01B	/CONTINUE THE OUTPUT SEQUENCE

/A VALUE HAS BEEN TRANSMITTED IF NECESSARY.
	CLA
	JMP	PRESC3	/NOW GO SEND THE FINAL TERMINATING CHARACTER

/CHANGED RETURN LOCATIONS TO INCLUDE A TECH CHARACTER RETURN		/A206
/CHANGED RETURN LOCATIONS TO INCLUDE A multinational CHARACTER RETURN	/a227


/When this routine is called, the buffer variables point to the last processed
/character.  The routine determines which of five possibilities hold:

/1.  This is the last character in the line
/	Make a normal return

/2.  The next character is a multinational character precedence character
/	Point to it and make a skip return

/3.  The next character is a technical character precedence character
/	Point to it and make a skip return

/4.  There is another character in the current position
/	Move the buffer pointers to indicate it and make a triple skip return

/5.  The next character is in the next position
/	Move the buffer pointers to indicate it and make a quad skip return

PLCHBS,	XX

	JMS	PLNXT	/Is there another character?
	JMP I	PLCHBS	/No--make a normal return

/THERE IS ANOTHER CHARACTER.  IF IT IS A DEAD KEY PRECEDENCE CODE	/A202
/WE WILL MAKE A SKIP RETURN						/C206
/IF IT IS A MULTINATIONAL						/a271

	ISZ	PLCHBS	/PREPARE AT LEAST A SKIP RETURN			/A206
	TAD I	PLPTR	/GET THE CHARACTER
	AND	P177	/						/A202
	TAD	(-23)	/IS IT ANY OF THE DEAD KEY PRECEDENCE CHRS?	/A202
	SNA		/ test for tech precedence char			/a227
	JMP	PWSTEC	/ ok was a tech char				/a227
	IAC		/ multinational precedence?			/a227
	SNA		/ ?						/A227
	JMP	PWSMNC	/ ok was a M.N.C				/a227
	IAC		/ could it have been a line drawing precedence	/a227
	SZA		/ was it -- then return				/a227		PLCHXX	/ no try the rest then				/a227
	JMP	PLCHXX	/ no then keep looking				/a227	

PWSTEC,	ISZ	PLCHBS	/ prepar a double skip return			/a227
PWSMNC,	JMP I	PLCHBS	/YES, MAKE A SKIP RETURN			/C206

/THERE IS ANOTHER CHARACTER AND IT IS NOT A TECHNICAL PRECEDENCE CHR	/A202
/IF IT IS BACKSPACE PLNXT IS GUARANTEED TO SKIP				/A202
PLCHXX,	ISZ	PLCHBS	/PREPARE AT LEAST A SKIP ROUTINE	/c227	/M202
	ISZ	PLCHBS	/PREPARE AT LEAST A SKIP RETURN			/A227
	TAD	(21-BS)	/IS IT BACKSPACE				/C202
	SNA CLA		/Skip if not a backspace

	JMS	PLNXT	/Point to the next character if a backspace

/Although PLNXT makes a normal return if there are no more characters,
/we can assume that it won't since a character always follows a backspace.
/Instead, it will make a skip return.

	ISZ	PLCHBS	/Prepare a double skip return to indicate no backspace
	JMP I	PLCHBS	/And return
/***********************************************************************/
/									/
/	THIS BUFFER IS STORAGE FOR THE 4 PARAMETERS IN THE SEQUENCE	/
/	ESC[*;*;*;*!s
/	THIS SEQUENCES IS USED IN JUSTIFICATION
/
JSTIFY,	ZBLOCK	13		/ 11 DIGITS ASSUMES			/C196
				/ 4 DIGIT FIRST PARAMETER
				/ 1 DIGIT 2ND PARAMETER
				/ 4 DIGIT 3RD PARAMETER
				/ 2 DIGIT 4TH PARAMETER

/********************************************************************
/ BHOOK      Hook to panel page blaster
/******************************************************************** 	/a227

BHOOK,	0			/ hook return address			/a227
	DCA	BLACSV		/ save accumulator			/a227
	RDF			/ read the data field 			/a227
	TAD	CDF0		/ make a cdf instruction		/a227
	DCA	BHKEXI		/ save for return			/a227
	CDFMYF			/ set to hooks field			/a227
	TAD I	BHOOK		/ get the table entry			/a227
	MQL			/ push into MQ				/a227
 	TAD	BLACSV		/ get the ac				/a227
	ISZ	BHOOK		/ increment the return address		/a227
	CIFMNU			/ blaster is in the menu field		/a227
	IOF			/ turn the interrupts off before.. 	/a227
	JMS I	BLASTH		/ Calling blaster			/a227
	ISZ	BHOOK		/ skip return exit			/a227
BHKEXI,	0			/ CDF instruction position important	/a227
	JMP I	BHOOK		/ return				/a227
BLASTH,	BLASTR			/ blastr address (get from WPF1)	/a227
BLACSV,	0			/ ac save				/a227



X=.-1
/----------------
	PAGE

/ DRAFT PRINTER, BOLD INTERPRETATION SUBROUTINE				/A152
/	THIS SUBROUTINE PUTS OUT ESCAPE SEQUENCES TO SELECT 		/
/	EITHER A FONT OR CHARACTER SET					/
/		IF PRBIF=1 A CHRSET IS SELECTED				/
/		IF PRBIF=2 A FONT IS SELECTED				/

/	IF THE LAST SELECTION WAS THE SAME AS THE CURRENT SELECTION	/
/	THEN NO ESCAPE SEQUENCE IS SENT					/
/	HOWEVER, IF PRBICS IS NEGATIVE WE EXECUTE THE ROUTINE		/A177
/	UNCONDITIONALLY.  PRBICS IS SET 7777 AT BEGIN OF DOCUMENT	/A177

LPBI,	XX								/
	MQA			/ SAVE THE MQ AS PRESCS CLOBBERS IT!	/A154
	DCA	LPBIT1		/					/A154
	TAD	PRBICS		/ GET SAVED VALUE OF BIC		/
	SMA			/ SKIP IF AC=7777 TO FORCE EXECUTION	/A177
	TAD	PRBIC		/ ADD TO CURRENT VALUE			/
	AND	(2000)		/ SEE IF SAME				/
	SNA CLA			/ IF SO JUST EXIT			/
	JMP I	LPBI		/ SAME BOLD INTERPRETATION AS LAST CHR	/

	TAD	PRBIC		/ SAVE NEW INTERPRETATION		/
	DCA	PRBICS		/ FOR NEXT TIME				/

/ SEE WHETHER WE ARE DOING FONTS OR CHRSETS

	AC7776								/
	TAD	PRBIF							/
	SNA CLA								/
	JMP	LPBIF		/ FONTS					/

/ WE ARE DOING CHRSET INTERPRETATION					/

	TAD	PRBIC		/ GET BOLD INTERPRETATION		/
	SNA CLA			/ SEE IF BOLD OR NONBOLD		/
	AC0001			/ SELECT SI FOR G0			/
	TAD	(SO)		/ ELSE SELECT SO FOR G1			/
	JMS	PRCHAR		/ SEND IT OUT				/
	JMP I	LPBI		/ RETURN				/

/WE ARE DOING FONT BOLD INTERPRETATION					/

LPBIF,									/
	TAD	PRBIC		/ SEE IF THIS CHR IS BOLD		/
	SNA CLA			/					/
	JMP	LPBIF1		/ NO					/
	TAD	PRBIFB		/ YES, GET BOLD FINAL			/
LPBI1,	JMS	PRESCS		/ DO ESCAPE SEQUENCE			/
		PCSTFN		/ FOR FONT SELECTION			/
		CLA		/ CLEAR RETURNED CODE			/
	TAD	LPBIT1		/ GET PREVIOUS MQ			/A154
	MQL			/ AND PUT IT BACK IN MQ			/A154
	JMP I	LPBI		/ RETURN				/

LPBIF1,	TAD	PRBIFN		/ GET NORMAL FINAL			/
	JMP	LPBI1		/ AND GO OUTPUT SEQUENCE		/

PRBIC,	0								/
PRBICS,	0								/
LPBIT1,	0			/ A TEMP TO HOLD MQ			/A154

/***********************************************************************/
/									/
/	LPIND--ROUTINE TO INDENT.  USED ONLY ON DRAFT PRINTERS THAT	/
/		CANNOT RECOGNIZE THE HORIZONTAL MARGIN ESCAPE SEQUENCE	/
/		ESC [ Pn s
/		CURRENTLY THE LA50					/
/		ALSO THE HOST PORT					/A159
/		...(WE DON'T SEND ESCAPE SEQS TO HOST			/
/D174		DELETED DPMSK TEST WHICH CAUSED THIS ROUTINE TO WORK	/
/D174		ALSO ON THE LA120, WHICH DOES RECOGNIZE MARGIN COMMND	/
/									/
/***********************************************************************/

LPIND,	XX							/A143
	DCA	LPINDT	/SAVE AMOUNT TO INDENT				/A188
	TAD	LPONLN	/GET TYPE OF PRINTER
	SZA		/DD=HOST					/A159
	TAD	(-LA50)	/SEE IF LA50
	SZA CLA		/YES, DO THIS ROUTINE
	JMP I	LPIND	/NO, JUST RETURN

	AC0006		/INITIALIZE THE JUSTIFY COUNTER TO HALF A SPACE
	DCA	LPJCNT

/NOW INDENT THE LINE ACCORDING TO THE VALUE PASSED.			/C188

	TAD	(SPC)	/GET A SPACE
	MQL		/SET THINGS UP FOR LPMOVE

	TAD	LPINDT	/GET THE VALUE					/C188
	JMS	LPMOVE	/INDENT THE MARGIN
	JMP I	LPIND	/RETURN

LPINDT,	0		/STORAGE FOR AMOUNT TO INDENT			/A188

/THIS ROUTINE DOES HORIZONTAL MOTION FOR THE LINE PRINTER.  IT EXPECTS THE
/AMOUNT TO MOVE IN PRINT UNITS IN THE AC UPON CALL.  IT ADDS THE REQUEST
/TO THE LEFTOVER UNITS FROM THE LAST CALL.  THIS ROUTINE CANNOT ALWAYS
/MOVE THE FULL AMOUNT REQUESTED, SINCE IT CAN ONLY MOVE IN UNITS OF ONE
/CHARACTER.  THE ROUTINE FILLS THE SPACE IT MOVES ACROSS WITH THE
/CHARACTER IN THE MQ.

/MQ=CHARACTER TO FILL WITH
/AC=DISTANCE TO MOVE IN UNITS
/JMS	LPMOVE
/AC=0

LPMOVE,
	XX
	
	TAD	LPJCNT	/ADD THE UNCOMPLETED SPACING FROM LAST TIME
	DCA	LPJCNT	/SAVE AS THE AMOUNT TO SPACE

/THIS LOOP OUTPUTS AS MANY UNITS OF SPACES AS IT CAN OF THE UNCOMPLETED SPACING.

LPMOV1,
	TAD	PLNRCS	/GET THE SIZE OF A SPACE			/A143
	CIA								/A143
	TAD	LPJCNT	/GET THE AMOUNT OF UNCOMPLETED SPACING
	SPA
	JMP	LPMOV2	/NO WHOLE SPACES REMAIN--LEAVE THE LOOP
	DCA	LPJCNT	/SAVE THE NEW UNCOMPLETED SPACING

	MQA		/GET THE THING TO PRINT
	AND	P177	/MASK ANY MODE BITS
	JMS	PRCHAR	/PRINT IT
	JMP	LPMOV1	/CONTINUE THE LOOP

LPMOV2,
	CLA
	JMP I	LPMOVE	/RETURN	

LPJCNT,	0		/CONTAINS ANY UNCOMPLETED UNITS OF SPACING

/THIS ROUTINE MULTIPLIES THE NUMBER ADDRESSED AFTER THE SUBROUTINE CALL BY
/THE NUMBER IN THE AC UPON CALL.  BOTH SHOULD BE NON-NEGATIVE INTEGERS.
/THE RESULT IS RETURNED IN THE AC.  THIS ROUTINE OPERATES MOST EFFICIENTLY
/IF THE FACTOR IN THE AC IS THE SMALLER.

/AC=SMALLER FACTOR
/JMS	PRMULT
/	ADDRESS OF LARGER FACTOR
/AC=PRODUCT OF TWO FACTORS

PRCHAT,	/HARRY PREBLE WILL DO ANYTHING TO SAVE A LOCATION.  HERE WE
		/USE A LOCATION FROM A ROUTINE THAT DOES NOT CALL PRCHAR
		/AND IS RELATIVELY PURE AND SIMPLE AND IS NEARBY PRCHAR...
PRMULT,
	XX

	CMA
	DCA	T1	/SAVE THE NEGATIVE LESS ONE OF THE MULTIPLIER

	TAD I	PRMULT	/GET ADDRESS OF MULTIPLICAND
	ISZ	PRMULT
	DCA	T2	/SAVE TO INDIRECT THROUGH

/THE MULTIPLIER IS NOW NEGATED (LESS ONE) AND STORED IN T1, WHILE THE
/MULTIPLICAND ISS ADDRESSED THROUGH T2.  THIS LOOP REPEATEDLY ADDS THE
/MULTIPLICAND INTO THE AC.

PRMLT1,
	ISZ	T1	/TEST THE MULTIPLIER
	SKP		/KEEP MULTIPLYING
	JMP I	PRMULT	/RETURN

	TAD I	T2	/ADD THE MULTIPLICAND
	JMP	PRMLT1	/CONTINUE THE LOOP

/ This code allows use to call PRCHAR from a routine in SYS that is 	/a231
/ dealing with	eight bit chars See WPRTHL				/a231

XFPRCH,	JMS	PRCHAR	/ call PRCHAR					/a231
	CDIFIO		/ return to sys FIELD			/m0234	/a231
	JMP	P85C	/ at this address			/m0234	/a231

/THIS ROUTINE OUTPUTS A CHARACTER TO THE PRINTER.  THE LOCATION PRCHR3,
/WHICH IS A JMS TO THE PRINTER HANDLER, IS PATCHED ELSEWHERE IN THE
/SPOOLER TO EITHER LPTOU OR HS2OU, DEPENDING ON WHETHER A PRINTER HANDLER
/OR A HOST HANDLER IS TO BE USED.

/AC=CHARACTER
/JMS	PRCHAR
/AC=0

PRCHAR,
	XX
	AND	P377	/STRIP THE MODE BITS	/allow 8 bits 		/m227
	DCA	PRCHAT	/SAVE THE CHARACTER
IFDEF DEVEL1 <JMP PRCHR5>

PRCHR4,	TAD	PRYES	/IS PRINTING DISABLED?
	SZA CLA								/M010
	JMP I	PRCHAR	/YES--JUST RETURN WITHOUT PRINTING
	JMP	PRCHR2	/ENTER THE PRINT LOOP

PRCHR1,
	DCA	PRCHAT	/SAVE THE CHARACTER
	JMS	SQPINP	/SEE IF ANY CHARACTERS COMING IN		/A113
	TAD	PABORT	/HAS PRINTING BEEN ABORTED?
									/D016
	SZA CLA		/						
	JMP I 	PRCHAR	/ YES- RETURN WITHOUT PRINTING
	CIFSYS		/  WAIT FOR HANDLER TO ACCEPT CHARACTERS
	JWAIT

PRCHR2,
	TAD	PRCHAT	/RECOVER THE CHARACTER
	CIF 0		/GIVE CHARACTER TO HANDLER

PRCHR3,
	LPTOU		/THIS LOCATION IS PATCHED WITH EITHER LPTOU OR HS2OU.
			/THIS IS A JMS TO THE APPROPRIATE HANDLER.  THE
			/HANDLER WILL MAKE A NORMAL RETURN WITH AC=CHARACTER
			/IF THERE IS NO ROOM IN ITS BUFFER FOR THE CHARACTER.
			/OTHERWISE, THE HANDLER WILL MAKE A SKIP RETURN WITH
			/AC=0.

			/THE LOCATION IS PATCHED WITH LPTOU INITIALLY BECAUSE
			/THE INITIALLY LOADED HANDLER IS THE SERIAL HANDLER.
			
	JMP	PRCHR1	/NO ROOM--CONTINUE THE WAIT LOOP

IFDEF DEVEL <								/A213
/ THE FOLLOWING CODE INSERTED TEMPORARILY.  IT IS SO THE HOST PORT
/ CAN BE USED TO BE A MONITOR.  THE HOST IS USED TO RECORD AN IMAGE OF
/ THE PRINTER OUTPUT.

	TAD	PRCHAT		/GET CHR
	CIFSYS
	HS2OU
	SKP CLA		>
	JMP I	PRCHAR		/RETURN--WE ARE DONE
IFDEF DEVEL <	JMS	SQPINP
	CIFSYS
	JWAIT
	JMP .-10	>



/PRCHAT NOW SHARED WITH PRMULT, NEARBY ON THE SAME PAGE
/PRCHAT,	0	/A temporary to hold the character being printed


/This routine does division.  The dividend is in PRJDEF at the time of
/call, and must be negative.  The divisor is in the AC.  The quotient is
/the number of times the divisor can be added to the dividend before the
/dividend becomes a non-zero positive number.  The remainder is the positive
/number which remains when the dividend becomes positive, negated, minus one,
/added to the divisor.

/This routine is used in justifying the line.  We are dividing the amount by
/which the line is too short (PRJDEF) among the number of positions or spaces
/indicated in the AC upon invocation.  The quotient is the constant amount to
/add to each position or space; the remainder is an ISZ counter used in
/making positions or spaces for additional justification.

/The remainder is returned in PRJDEF; the quotient is returned in the AC.


PRDVID,
	XX

	DCA	T2	/Save the divisor
	DCA	T3	/Clear the quotient
	TAD 	PRJDEF	/Get the dividend

/We now enter a loop where we successively add the divisor to the dividend
/until the AC goes positive.

PRDVI1,
	TAD	T2	/Add in the divisor--is it too much?
	SMA SZA
	JMP	PRDVI2	/Yes--leave the loop
	ISZ	T3	/No--increment the quotient
	JMP	PRDVI1	/And continue the division loop

/The quotient is in T3, and the AC contains the amount too large the
/dividend is with one extra addition of the divisor.  We want to derive the
/remainder--so we negate the AC and subtract one.

PRDVI2,
	DCA 	PRJDEF	/Save the remainder
	TAD	T2	/Recover the divisor
	CMA		/Negate and subtract one
	TAD 	PRJDEF	/From the remainder
	DCA 	PRJDEF	/Save the result

	TAD	T3	/Recover the quotient
	JMP I	PRDVID	/And return
/---------------
	PAGE

/***********************************************************************/
/									/
/ SQPINP--PARSING ROUTINE CALLED AS NEEDED FROM WITHIN			/
/	THE PRINTER CODE.  IT HANDLES POLLED PRODUCT IDENTIFICATION	/
/	RESPONSES AND ASYCHRONOUS ERROR REPORTS (IF ANY)		/
/	RECEIVED FROM THE PRINTER					/
/									/
/	IF THE DOCUMENT DESTINATION IS CHST THEN LPTIN IS REPLACED	/
/	BY HS2IN AND WE THROW AWAY ALL CHARACTER SENT BACK BY THE HOST	/
/									/
/***********************************************************************/
/
/	THIS PARSER HANDLES THE LQPSE AND TWO GENERAL TYPES OF STRINGS:	/
/		PRODUCT IDENTIFICATION SEQUENCES			/
/		STATUS REPORTS						/
/	PRODUCT IDENTIFICATION SEQUENCES MAY BE OF THE FORM:		/
/		ESC [ ? Pa ; Pb c
/		THE ; Pb MAY BE MISSING ON SOME PRODUCTS
/		SEE TABLE AT VWHOTB FOR MORE DETAILS			/
/	THE BRIEF STATUS REPORT 					/
/		ESC [ 0 n		INDICATING NO ERRORS
/	EXTENDED STATUS REPORTS OF THE FORM				/
/		ESC [ ? Pa ; Pb ; ... ; n
/		THEY MAY CONTAIN UP TO 16 Px NUMERICAL ARGUMENTS
/		IF Pa = 0 then there are no errors
/		IF Pa < 20 then Pa should =3 and there are errors
/		SEE TABLE AT VERRTB FOR MORE DETAILS			/
/
/	THE FOLLOWING SEQUENCES ARE PARSED				/
/	FOR THE LQPSE:  ESC [ ? 9 c  FOR THE "WHO ARE YOU REPORT"
/	                ESC N3 N2 N1 0 FOR A STATUS REPORT		/
			CAN=30		/ FATAL ERROR
			EOT=04		/ NON FATAL ERROR

			CSI=233		/ 8 BIT CODE REPLACES ESC [

SQPINP,	XX								/
	JMS	PRSTUP		/ SEE IF MUST ROLLUP STATUS		/
SQPNXT,	CIFSYS			/ SEE IF THERE IS A CHARACTER		/
	LPTIN			/ IN THE BUFFER FROM THE PRINTER	/
	JMP I	SQPINP		/ ...NOTHING, JUST RETURN		/


	AND	P177		/ STRIP TO SEVEN BITS			/A119
				/ THE LA120 ALWAYS TRANSMITS THE 200 BIT/A119
				/ SO DOES THE LA34			/A120
	SNA
	JMP	SQPNXT		/ IGNORE NULLS
	DCA	INPUT		/ SAVE THE INCOMING CHR			/


/ IF WE ARE PRINTING TO CHST THEN DISCARD ALL CHARACTERS.  BEFORE THIS	/A218
/ CODE WAS ADDED THE ECHOS FROM THE HOST COULD LOOK LIKE VERY LONG	/A218
/ LQPSE STATUS REPORTS, CAUSING HALTS AND FROWNS...			/A218

	JMS	SKNHST		/ SKIP IF NOT CHST			/A218
	JMP	SQPNXT		/ YES, JUST FLUSH BUFFER		/A218

/ THE DOCUMENT DESTINATION IS NOT CHST...				/A218
	TAD	INPUT		/ CHECK FOR EOT AND CANCEL		/A126
	TAD	(-EOT		/ IF INPUT = 'EOT'			/C118
	SNA								/
/d236	JMP	SQEOT		/      THEN PROCESS 'EOT'		/
	JMP	SQPNXT		/ ignore LQPSE errors			/a236
	TAD	(EOT-CAN	/ IF INPUT = 'CAN'
	SNA CLA
/d236	JMP	SQCAN		/	THEN PROCESS 'CAN'
	JMP	SQSTRT		/ ignore LQPSE Errors			/a236

				/ ELSE DISPATCH
	TAD	STATX		/ GET THE PARSE STATE			/
	JMS	VSTAT		/ CASE STATEMENT ON VSTAT		/
	VSTAT0								/
	VSTAT1								/
	VSTAT2								/
	VSTAT3								/
	VSTAT4

VSTAT,	0								/
	TAD	VSTAT		/ VECTOR ADR = BASE ADR + VSTAT		/
	DCA	VSTAT							/
	TAD I	VSTAT		/ GET ADDRESS OF STATE HANDLER CODE	/
	DCA	VSTAT		/ SAVE THE VECTOR			/
	TAD	INPUT		/ RETRIEVE THE CHAR INPUT		/
	JMP I	VSTAT		/ JMP TO STATE HANDLER CODE		/
/							

VSTAT1,	TAD	(-133		/ IS IT A BRACKET ?			/
	SNA CLA			/					/C221
	JMP	VSET2		/ YES, GO STATE2			/
/d236	JMS	SKIPIF		/ ONLY IF LQPSE DO MORE			/A221
/d236		LQPSE		/ ELSE DCS WILL FOUL US ALL UP!		/A221
	JMP	SQESCS		/ NOT LQPSE, DON'T STORE!		/A221
/d236	TAD	INPUT		/ GET CHR AGAIN				/A221
/d236	TAD	(-60		/ ZERO ENDING STATUS REPORT (LQP01)	/
/d236	SNA CLA								/
/d236	JMP	REP01		/           IF SO, DO REP0T		/
/d236	TAD	INPUT		/ ELSE SAVE LQPSE STATUS DATA		/
/d236	DCA I	VPTR		/ ON THE STACK				/
/d236	ISZ	VPTR
/d236	JMP	SQESCS		/ GO CHECK FOR ESC OR CSI
						
VSTAT2,	TAD	(-77		/ IS IT QUESTION MARK ?
	SNA
	JMP	VSET3		/ YES, GO TO STATE 3
	TAD	(77-60		/ IS IT A ZERO DIGIT ?
	SZA CLA
	JMP	SQSTRT		/ NO, IGNORE AND START OVER
	DCA I	VPTR		/ PUT ZERO ON NUMBER STACK
	JMP	VSET4		/ GO TO STATE 4

SQSTRT,	CLA
	DCA	STATX		/ BACK TO STATE 0
	JMP	SQESCS		/ GO CHECK FOR ESC OR CSI

VSTAT3,	JMS	DIGCHK		/ INPUT A DIGIT?
	JMP	VSTA3A		/ NO
	DCA	INPUT		/ SAVE DIGIT VALUE
	TAD I	VPTR		/ GET PRESENT VALUE
	CLL RTL
	TAD I	VPTR
	RAL			/ MULTIPLY BY TEN
	TAD	INPUT		/ AND ADD IN DIGIT VALUE
VSTA3D,	DCA I	VPTR		/ SAVE IT
	JMP	SQPNXT		/ GO PROCESS NEXT DIGIT

VSTA3A,	TAD	(-73		/ SEE IF A SEPARATOR ';'
	SZA			/ SKIP IF ";"				/C191
	JMP	VSTA3C		/ NOT ";"				/A191
	ISZ	VPTR		/ ";", BUMP POINTER
	JMP	VSTA3D		/ GO CLEAR THIS LOCATION & CONTINUE	/C191

VSTA3C,	TAD	(73-143)	/ SEE IF A PRODUCT ID TERMINATOR 'c'
	SNA
	JMP	VSTWHO		/ YES, GO PROCESS

	TAD	(143-156)	/ SEE IF A STATUS REPORT TERMINATOR
VSTA3B,	SNA
	JMP	VSTERR		/ YES, GO PROCESS
	JMP	SQESCS		/ ELSE WE DON'T KNOW WHAT THIS IS

VSTAT4,	TAD	(-156)		/ FINISH BRIEF NO ERROR REPORT
	JMP	VSTA3B

SQESCS,	CLA
	TAD	INPUT		/ RECOVER INPUT
VSTAT0,	TAD	(-CSI		/ IF INPUT = 'CSI
	SNA								/
	JMP	VSET2A		/ THEN STATE=2
	TAD	(CSI-ESC	/ ELSE IF INPUT = 'ESC'			/
	SNA CLA								/
	JMP	VSET1A		/      THEN STATE 1
	JMP	SQPNXT

VSET4,	IAC
VSET3,	IAC
VSET2,	IAC
	IAC
	DCA	STATX
	JMP	SQPNXT

VSET2A,	IAC								/A118
VSET1A,	IAC								/A118
	DCA	STATX							/A118
	TAD	(VSTACK
	DCA	VPTR
	JMP	VSTA3D		/ GO CLEAR FIRST STACK LOCATION		/C191

STATX,	0
INPUT,	0
/--------------------
	PAGE

VSTWHO,

/ THIS SECTION REWRITTEN REV169 SO THAT ONLY THE PRIMARY PRODUCT ID CODE
/ IS USED IN MOST CASES.  IN ONLY THOSE CASES WHERE IT MAKES A DIFFERENCE
/ TO DECMATE DO WE USE ANY SECONDARY PRODUCT ID ATTRIBUTES	/A169

	ISZ	VPTR		/ CLEAR THE NEXT
	DCA I	VPTR		/ LOCATION IN THE STACK
	TAD	(VSTACK)	/ GET POINTER TO PARAMETERS
	DCA	VPTR		/ AND STUFF IT
	TAD	(VWHOTB		/ SEARCH PRIMARY TABLE

/ PREPARE TO SEARCH THE PRODUCT IDENTIFICATION (WHO) TABLE
/ IF THE TABLE ENTRY IS MINUS ONE WE ARE DONE
/ IF THE TABLE ENTRY HAS THE MOST SIGNIFICANT BITY SET IT
/ INDICATES THAT THE VALUE WITHOUT THAT BIT IS THE VALUE FOR COMPARISON,
/ BUT THAT THERE ARE SECONDARY ATTRIBUTES THAT MUST BE CHECKED OUT

VSTWH0,	TAD	(-1)		/ BECAUSE WE USE AUTOINDEXING
	DCA	X3
VSTWH1,	TAD I	X3		/ READ AN ENTRY
	DCA	VSTTMP		/ SAVE IN A TEMP
	TAD	VSTTMP		/ RECOVER TEMP
	IAC			/ BUMP TO TEST FOR MINUS ONE
	AND	P177		/ STRIP SECONDARY ATTRIBUTE FLAG
	SNA			/ SKIP IF NOT END OF TABLE
	JMP	VSTIDF		/ ENTRY NOT FOUND IN TABLE
	TAD	(-1)		/ COMPENSATE FOR -1 TEST
	CIA			/ NEGATE
	TAD I	VPTR		/ SEE IF MATCHES
	SZA
	ISZ	X3		/ NO, BUMP OVER 2ND HALF OF TABLE PAIR
	SZA CLA
	JMP	VSTWH1		/ NO, AND TRY NEXT ENTRY
	TAD	VSTTMP		/ GET VALUE THAT MATCHED
	SMA CLA			/ SEE IF SECONDARY ATTRIBUTES SPECIFIED
	JMP	VSTWH2		/ NO, WE HAVE THE ANSWER!
	ISZ	VPTR		/ YES, USE NEXT PARAMTER
	TAD I	X3		/ GET ADDRESS OF THIS NEW TABLE
	JMP	VSTWH0		/ AND START USING IT
VSTWH2,	TAD I	X3		/ YES, READ VALUE
	DCA	LPONLN		/ SAVE IT FOR POSTERITY
	TAD I	(VSTACK)	/ Get the first parameter value		/a226
	TAD	(-30)		/ Is it an LQP03?			/a226
	SNA 			/ ?, has multinational capability?/m236	/a226
	JMP	VSTWHZ		/ YES has 				/m236
	TAD	(-7)		/ Is it an LQP25?			/m236
	SZA CLA			/ YES, has multinational capability?/m236/a226
	JMP	VSNOMC		/ No, just set flags			/a226
VSTWHZ,	TAD	(MNMSK)		/ Get multinational mask		/a226
	TAD	LPONLN		/ Add it to rest of printer type	/a226
	DCA	LPONLN		/ And re-save it			/a226
VSNOMC,	AC7777			/ ANSWERED FLAG=7777			/C201
	DCA	IDANSW		/ ANSWERED FLAG=7777			/C201
	JMP	SQSTRT		/ GO RESET PARSE STATE

VSTIDF,		/ ID FAILURE						/A131
	IFDEF DEVEL <HLT>	/ IF DEVELOPMENT SWITCH, HALT		/A131
	JMP	SQSTRT		/ GO RESET PARSE STATE			/A131

VWHOTB,	/ TABLE OF PRODUCT IDENTIFICATION CODES

	VWHOSP=2		/ SPARE ALLOCATION

	DECIMAL

/d232	02;	LA120		/ LA120					/C188
/d232	03;	LA34		/ LA34
/d232	09;	LQPSE		/ LQPSE
   2048+10;	LA1002		/ LA100 WITH SECONDARY ATTR		/m226
   2048+13;	LQP022		/ LQP02 WITH SECONDARY ATTR
/d232	15;	LA12		/ LA12
	17;	LA50		/ LA50
   2048+24;	LQP022		/ LQP03 WITH SECONDARY ATTR
	26;	LN03		/ LN03					/C214
	31;	LQP022		/ LQP25 with secondary attribute	/a236

	ZBLOCK	VWHOSP^2
	-1	/STOPPER

LQP022,		/ LQP02 SECONDARY ATTRIBUTES
	0;	LQP02
	1;	LQP02
	2;	LQP02+ASF01	/ WAS +ASF02				/C172
	3;	LQP02+ASF01	/ WAS +ASF02				/C172
	4;	LQP02+ASF02
	5;	LQP02+ASF01
	-1	/ STOPPER

LA1002,		/LA100 secondary attributes				/a226
	0;	LA100							/a226
	2;	LA100+MNMSK	/ LA100-PC				/a226
	3;	LA100+MNMSK	/ LA210 or LN03 in LA100 mode		/a232
	-1			/ stopper				/a226

	OCTAL

VERRTB,		/ ERROR CODE CONVERSION TABLE
		/ BASED AT NUMBER 20 SINCE ERRORS ARE BASED AT 20 DECIMAL
		/ ENTRIES > 3777 OCTAL ARE DESTINATION ADDRESSES

	VSTER2	/ 20 -- IGNORE
	VMALF	/ 21 PRINTER HARDWARE MALFUNCTION
	VCOMME	/ 22 COMMUNICATION I/O ERROR				/C126
	VMALF	/ 23 INPUT BUFFER OVERFLOW
	VPAUSE	/ 24 PAUSE ACTIVE					/C132
	VSTER2	/ 25 TEXT RECOVERY ACTIVE -- IGNORE
	20	/ 26 COVER OPEN
	21	/ 27 PAPER OUT
	16	/ 28 RIBBON OUT
	VMALF	/ 29 PRINTWHEEL TABLE LOAD ERROR
	VSTER2	/ 30 NO SHEET FEEDER ERROR -- IGNORE
	17	/ 31 SHEET FEEDER HARDWARE ERROR
	17	/ 32 SHEET FEEDER MISFEED
	16	/ 33 TONER LOW						/A213
	VMALF	/ 34 LN03 FATAL HARDWARE ERROR--CALL FIELD SERVICE	/A213
	VSTER2	/ 35 PERFORM USER MAINTENANCE -- IGNORE			/A213
VERRTE,	/ LABEL TO INDICATE VERR TABLE END				/A213
	21	/ 36 LN03 PAPER OUT					/A213

/ THE FOLLOWING ZBLOCK IS STORAGE FOR THE PARAMETERS WHICH ARE CONTAINED
/ IN THE ANSI SEQUENCES SENT BY THE PRINTERS.  DEC HAS A HOUSE RULE THAT
/ SAYS THAT A MAXIMUM OF SIXTEEN PARAMETERS WILL BE CONTAINED IN ANY
/ ANSI SEQUENCE
VSTACK,	ZBLOCK 20

VSTTMP,	0
/------------------
	PAGE
	XLIST

/*********************************************************************	/a229
/ CFPRES	Cross field call to PRESCS				/a229
/		Modify WPF1 if you move this code			/a228
/**********************************************************************	/a229

CFPRES,	XX			/ return address			/a229
	DCA	CFPP1		/ save the acc				/a229
	RDF								/a229
	TAD	CIDF0		/ get th return field an make a CDF CIF	/a229
	DCA	CFPP2		/ PUT IT IN PLACE FOR RESTORE		/A229
	CDFMYF			/ change to this field			/a229
	ACL			/ get the content of MQ which is PS val	/a229
	JMS	PRESCS		/ output the escape sequence		/a229
CFPP1,	0			/ keep the parameter here		/a229
CFPP2,	0			/ CDIF instruction put here		/a229
	CLA			/ clear ac				/a229
	JMP I	CFPRES		/ return				/a229


/***********************************************************************/
/									/
/	DIGCHK--DIGIT CHECK. CALLING FORMAT:				/
/		TAD	ASCII	/ LOAD AN ASCII VALUE			/
/		JMS	DIGCHK	/ CALL THIS ROUTINE			/
/		JMP	NOTDIG	/ RETURN HERE WITH AC UNCHANGED		/
/				/   IF NOT A DIGIT			/
/		XECUTE		/ ELSE HERE WITH AC=DIGIT VALUE		/
/									/
/***********************************************************************/

DIGCHK,	XX
	TAD	(-72)		/
	SMA			/ SKIP IF 71 OR SMALLER
	JMP	DIGRTN		/ TOO BIG
	TAD	(12)		/
	SPA			/ SKIP IF 60 OR LARGER
	JMP	DIGRTN		/
	ISZ	DIGCHK		/ AC IS ALL SET, BUMP RETURN
	JMP I	DIGCHK		/ AND RETURN
DIGRTN,	TAD	(72)		/ RESTORE AC
	JMP I	DIGCHK		/ RETURN



/ PROCESS EXTENDED ERROR REPORTS

VSTERR,	ISZ	VPTR
	DCA I	VPTR		/ SET STOPPER
	DCA	VPAUSF		/ RESET PAUSE FLAG			/A132
	DCA	STSTTS		/ AND ANY OTHER ERROR FLAG		/C179
	TAD	(VSTACK)
	DCA	VPTR		/ INITIALIZE INDEX REGISTER
	TAD I	VPTR		/ READ FIRST NUMBER
	SNA			/ SEE IF ESC [ ? 0 n
	JMS	PRESET		/ YES, THERE ARE NO ERRORS

/ WE RANGE CHECK THE ERROR CODES, IGNORING ANY ERROR CODES LESS THAN 20
/ OR BEYOND THE END OF OUR TABLE.  WE PROCESS THEM ALL, SETTING THE STATUS
/ TO THE LAST ONE REPORTED EXCEPT IF PAUSE IS REPORTED WITH ANOTHER
/ ERROR, THE OTHER ERROR WILL RECEIVE PRIORITY.
/ RANGE CHECKING IS NECESSARY BECAUSE SOME OF THE TABLE ENTRIES CAN
/ BE DESTINATION ADDRESSES AND WE DON'T WANT TO JUMP TO OBLIVION!

	DECIMAL
VSTER1,	TAD	(-20)		/ SUBTRACT ERROR BASE
	SPA
	JMP	VSTER2		/ IGNORE CODES LESS THAN 20		/C213
	TAD	(VERRTB-VERRTE	/ SEE IF IN RANGE OF TABLE		/C214
	OCTAL								/A135
	SMA SZA			/ SKIP IF MINUS OR ZERO			/A213
	JMP	VSTER2		/ IGNORE CODES NOT IN THE TABLE		/A213
	TAD	(VERRTE		/ ADD ERROR CODE TABLE BASE		/C214
	DCA	VSTERT		/ AS GOOD A TEMP AS ANY
	TAD I	VSTERT
	SPA CLA			/ SEE IF A DESTINATION ADDRESS
	JMP	VSTDIS		/ YES, GO TO IT
	TAD I	VSTERT		/ NO, GET ERROR CODE
	JMS	STSTTS		/ AND REPORT IT				/C179
VSTER2,	CLA			/ CLEAR ANY IGNORED CODES		/A213
	ISZ	VPTR
	TAD I	VPTR		/ GET NEXT NUMBER (NOT 1ST NUMBER)
	SZA			/ SEE IF END OF NUMBERS
	JMP	VSTER1		/ NO, PROCESS ANOTHER ERROR

/ IF THE PAUSE WAS THE ONLY ERROR DETECTED WE WILL REPORT IT		/A132
/ OTHERWISE, WE WILL NOT.  THIS WILL HAVE THE EFFECT OF GIVING		/A132
/ MORE INFORMATION TO THE USER IF THE PRINTER REPORTS ERRORS IN		/A132
/ ASCENDING ORDER, AS THEY SEEM TO					/A132
/ FOR INSTANCE, THE LA50 WHEN IT RUNS OF OUT PAPER WOULD OTHERWISE	/A132
/ REPORT PAUSE ACTIVE							/A132

	TAD	VPAUSF		/ SEE IF WE HAD A PAUSE ERROR		/A132
	SNA CLA			/					/A132
	JMP	SQSTRT		/ NO, WE ARE DONE			/A132
	TAD	STSTTS		/ SEE IF IT WAS THE ONLY ERROR		/C179
	SZA CLA			/					/A132
	JMP	SQSTRT		/ NO, WE ARE DONE			/A132
	TAD	(15)		/ PAUSE WAS ONLY ERROR, LOAD CODE	/A132
	JMS	STSTTS		/ REPORT IT				/C179
	JMP	SQSTRT		/ GO RESET STATE MACHINE
/D135	OCTAL

VSTDIS,	TAD I	VSTERT		/ DISPATCH TO DESTINATION ADDRESS
	DCA	VSTERT		/ SAVE D.A.
	JMP I	VSTERT		/ GO TO D.A.

VSTERT,	0			/ A TEMPORARY
VPAUSF,	0			/ PAUSE ERROR FLAG			/A132

/**********************************************************************/
/									/
/	VCOMME--COMMUNICATIONS ERROR.  WE MAY HAVE PRINTED A CHR	/
/		INCORRECTLY.  THEREFORE WE MUST STOP PRINTING.		/
/		WHEN THE USER RESPONDS WE WILL OFFER HIM B,T OR S	/
/									/
VCOMME,				/ COMMUNICATIONS ERROR			/A127
	AC0001			/ SET THE STOP FLAG			/A225
	DCA	PRSTOP		/					/A225
	TAD	(26)							/A127
	JMP	VMALF1		/ JMP BELOW				/A225
/ HERE WE USED TO GO TO THE STOP OVERLAY DIRECTLY BUT THAT CAUSED A	/A225
/ CRITICAL BUG SINCE IF THE COMM ERROR OCCURRED DURING AN OVERLAY LOAD	/A225
/ WE WOULD CALL PROV AGAIN BEFORE IT WAS DONE.  SQPINP MAY NOT CALL PROV/A225

VMALF,				/ REPORT MALFUNCTION
	CDFSYS			/ THIS WAS MISSING !!!! **** UGH !!!!	/A185
	AC0001
	DCA I	(LPDNFG
	CDFMYF			/ GOES WITH ABOVE CDFSYS		/A185
	AC7777
	DCA	PRSTOP		/ SET STOP FLAG				/A125
	TAD	(14)		/ LOAD MALFUNCTION ERROR CODE
VMALF1,	JMS	STSTTS		/ GO REPORT IT				/C179
	TAD	PRSTOP		/ AND ABORT FLAG			/A125
	DCA	PABORT		/					/C125
	JMP	SQSTRT		/ AND START OVER

VPAUSE,	ISZ 	VPAUSF		/ SET THE PAUSE FLAG			/A132
	JMP	VSTER2		/ GO PROCESS ANOTHER ERROR		/A132

/***********************************************************************/
/									/
/	THIS STUFF IS UNIQUE TO THE LQPSE				/
/									/
/***********************************************************************/
/
/	REP01 IS ENTERED FROM VSTAT1 TO PROCESS A REPORT FROM
/	AN LQP01.  THE NUMERIC DATA IS IN THE VSTACK.

/d236REP01,	AC0001
/d236	AND	VSTACK+2	/ GET SHEET FEEDER PRESENCE BIT		/C118
/d236/d236
/d236	SNA CLA			/					/
/d236	JMP	REP01A		/ NO FEEDER				/

/ IF THERE IS A SHEET FEEDER WE FIRST TURN OFF THAT BIT, AS IT MAY
/ ALREADY BE ON.  THEN WE PUT THE BIT BACK.  WE MUST DO THIS THIS WAY
/ SINCE THE LQPSE REPORTS SHEET FEEDER PRESENCE AS PART OF ITS STATUS
/ AND NOT AS PART OF ITS TERMINAL ID LIKE THE LQP02

/d236/d236	TAD	(ASF01		/ IT MUST BE AN ASF01
/d236	CMA			/ MAKE A NEGATIVE MASK			/A168
/d236	AND	LPONLN		/ LPONLN SANS ASF01 BIT			/A168
/d236	TAD	(ASF01		/ TURN THE BIT BACK ON			/A168
/d236	DCA	LPONLN		/ SET NEW LPONLN VALUE WITH ASF INFO
/d236REP01A,									/
/d236	TAD	VSTACK+1	/ GET FIRST INFO CHR			/C118
/d236	JMP	PNFERR		/ GO DETERMINE ERROR


/***********************************************************************/
/									/
/	COME HERE IF LQP01 GETS AN 'EOT'				/
/									/
/d236SQEOT,
/D236	JMS	SKIPIF		/ SKIP IF LQPSE				/A126
/D236		LQPSE							/A165
/d236	JMP	SQPNXT		/ NOT LQPSE, IGNORE			/A126
/D236	CIFSYS								/
/D236	JMS I	(SQREST)	/ DO A STATUS REQUEST			/
/D236	JMP	SQPNXT		/ GO CHECK FOR MORE CHRS		/


/***********************************************************************/
/									/
/	THIS IS THE LQPSE FATAL ERROR PROCESSOR				/
/									/
/d236SQCAN,
/D236	JMS	SKIPIF		/ SKIP IF LQPSE				/A126
/D236		LQPSE							/A165
/d236	JMP	SQSTRT		/ NOT LQPSE, START OVER			/A126
									/
/D236	TAD	(25)		/ THIS ERROR RATES A CODE OF ITS OWN	/
/D236	JMS	STSTTS		/ REPORT IT				/C179
/D236	JMP	SQSTRT		/ AND START OVER			/
/									/
/***********************************************************************/

/*********************************************************************/
/									/
/	SKIPIF--SKIPS IF THE ATTACHED PRINTER IS OF THE TYPE SPECIFIEC	/
/		IN THE LOCATION FOLLOWING THE CALL			/
/									/
/	CALLING SEQUENCE:	JMS	SKIPIF				/
/					LQPSE				/
/				...RETURNS HERE IF NOT LQPSE		/
/				...RETURNS HERE IF LQPSE		/
/									/
/				OF COURSE, ANY PRINTER TYPE MAY BE	/
/				SPECIFIED.				/
/									/
SKIPIF,	XX							/A126	/C165
	CLA			/ MAKE SUR AC CLEAR
	TAD I	SKIPIF		/ GET PRINTER TYPE			/A165
	AND	LPONLN		/ MASK WITH LPONLN			/C165
	CIA								/A126
	TAD I	SKIPIF		/ SEE IF MATCHES SPECIFIED TYPE		/C165
	ISZ	SKIPIF		/ BUMP UP PAST ARGUMENT			/A165
	SNA CLA			/ SKIP IF NOT SPECIFIED TYPE		/C165
	ISZ	SKIPIF		/ IS, TAKE SKIP RETURN			/C165
	JMP I	SKIPIF		/ RETURN				/A126



/***********************************************************************/a237
/ part of MNGETC in the next field					/a237
/***********************************************************************/a237

MNGTC6,	DCA	MNSVCH	/ save it					/a237
	TAD 	PLPTR	/ SAVE POINTER					/A237
	DCA	MNPTR	/ ............					/A237
	TAD	PLCNT	/ SAVE COUNT					/A237
	DCA 	MNCNT	/ ..........					/A237
	JMS	PLNXT	/ get the next char				/a237
	NOP		/ it doesn't matter if there isn't one		/a237
	JMS	MNGETA	/ HAVE WE GOT ONE?				/A237
	JMP	MNGTC2	/ yes get the saved char			/a237
	TAD	MNPTR	/ restore pointer				/a237
	DCA	PLPTR	/ ...............				/a237
	TAD	MNCNT	/ restore count					/a237
	DCA	PLCNT	/ .............					/a237
	JMP	MNGTC4	/ jump back					/a237

MNPTR,	0		/ PLPTR saved					/a237
MNCNT,	0		/ PLCNT saved					/a237

/------------------------

	PAGE

/***********************************************************************/
/									/
/	PRRSST--RESET PRINTER STATUS					/
/		THIS ROUTINE DECIDES WHETHER OR NOT THE ATTACHED	/
/		PRINTER WILL VOLUNTARILY REPORT WHEN CERTAIN		/
/		OF THE ERROR CONDTIONS ARE FIXED.  IF THE CURRENT	/
/		STOP CODE IS FOR ONE OF THOSE CONDITIONS, AND		/
/		THEN THAT ERROR CODE IS NOT RESET.			/
/		THE ASSUMPTION IS THAT WHEN THE ERROR IS FIXED		/
/		THE NO ERROR CONDITION WILL BE DECODED AND PRSTTS	/
/		RESET.  IN THIS MANNER THE OPERATOR MAY BE ALLOWED	/
/		TO LEAVE CERTAIN ERROR CONDITIONS IN FORCE AND TRY	/
/		TO RESUME, PRINT TO END OF PAGE, B OR T, BUT ALL	/
/		TO NO AVAIL!						/
/									/
/***********************************************************************/

PRRSST,	XX
	TAD	PRSTTS		/ GET STOP REASON			/A147
	JMS	PRRSRD		/ READ THE TABLE			/A122
	SZA CLA			/ SKIP IF CODE MUST RESET		/A147
	JMP I	PRRSST		/ EXIT IF TABLE SAYS SO			/A155
	CDFQUE								/A122
	TAD I	(PQFRST		/ SEE IF ANYTHING IN QUEUE		/A122
	CDFMYF			/					/A122
	SZA CLA			/ IF SO RESET TO BUSY, ELSE CLEAR	/A122
	AC0001			/ ELSE WE ASSUME THE OPERATOR HAS FIXED	/A147
	DCA	PRSTTS		/ THE ERROR
	JMP I	PRRSST		/ EXIT					/A147

PRRSRD,	XX			/ READ THE TABLE			/A122
	CLL RAR			/ DIVIDE BY 2, PUT LSB IN LINK		/A122
	TAD	(PRRSTB		/ ADD RESET STATUS TABLE BASE		/A122
	DCA	T2		/ SAVE IN A TEMP			/A122
	TAD I	T2		/ READ THE TABLE			/A122
	SZL			/ SKIP IF EVEN ERROR CODE		/A122
	BSW			/ SWAP IF ODD ERROR CODE		/A122
	AND	P77		/ MASK					/A122
	JMP I	PRRSRD		/ RETURN				/A122


PRRSTB,		/ TABLE OF PRSTTS CODES WHICH EMENATE FROM
		/ PRINTERS WHICH CAN REPORT ERRORS			/A147
	0	/ 01, 00
	0	/ 03, 02
	0	/ 05, 04
	0	/ 07, 06
      100	/ 11, 10
	0	/ 13, 12
      101	/ 15, 14
      101	/ 17, 16
      101	/ 21, 20
	0	/ 23, 22
	0	/ 25, 24
      000	/ 27, 26						/A126

/***********************************************************************/
/									/
/	PRESET--ROUTINE CALLED WHEN A PRINTER REPORTS THAT THERE ARE	/
/		CURRENTLY NO ERRORS.  WE USE PRRSTB TO DETERMINE IF WE	/
/		SHOULD CLEAR PRSTTS, PRSTT2, OR BOTH			/
/									/
/***********************************************************************/

PRESET,	XX			/ RESET TO NO ERROR STATUS		/
	TAD	PRSTTS		/
	JMS	PRSTCK		/ RESET ERROR STATUS IF A ONE IN PRRSTB	/
	DCA	PRSTTS		/  (THIS RETURN ONLY IF PRT ERR STTS	/
	TAD	PRSTT2		/ NOW CHECK THE OTHER ERROR STATUS.	/
	JMS	PRSTCK		/ RESET ERROR STATUS IF A ONE IN PRRSTB	/
	DCA	PRSTT2		/  (THIS RETURN ONLY IF PRT ERR STT2.	/
	JMS	PRSTUP		/ ROLLUP STATUS IF NEED BE		/A167
	JMP I	PRESET

PRSTCK,	XX			/ CHECK STATUS				/C122
	JMS	PRRSRD		/ READ THE TABLE			/C122
	SNA CLA			/ SKIP IF MUST RESET			/C122
	JMP	PRSTC1		/ SPOOLER ERROR				/C122
	CDFQUE								/A122
	TAD I	(PQFRST		/ SEE IF ANYTHING IN QUEUE		/A122
	CDFMYF			/					/A122
	SZA CLA			/ IF SO RESET TO BUSY, ELSE CLEAR	/A122
	AC0001			/ 					/A122
	JMP I	PRSTCK		/ RETURN				/A122
PRSTC1,	ISZ	PRSTCK		/ SPOOLER ERROR, SKIP RESET		/C122
	JMP I	PRSTCK		/ RETURN				/C122

/***********************************************************************/
/									/
/	STSTTS--SETS PRSTT2 TO STOP STATUS.  IF PRSTT2 IS THE SAME	/
/		AS PRSTTS THEN PRSTT2 IS CLEARED (DUPLICATE ERROR).	/
/		PRSTT2 IS COPIED UP TO PRSTTS BY PRSTUP			/
/									/
/***********************************************************************/

STSTTS,	XX			/ENTRY POINT.				/A069
	DCA	PRSTT2		/ SET STOP STATUS CODE.			/A069
	TAD	PRSTT2		/ SEE IF THE SAME IS CURRENT STATUS	/A167
	CIA			/					/A167
	TAD	PRSTTS		/					/A167
	SNA CLA			/ IF NOT, SKIP				/A167
	DCA	PRSTTS		/ ELSE DON'T REPORT DUPLICATE ERRORS	/A167
	JMS	PRSTUP		/ SEE IF CAN COPY UP			/A122
	JMP I	STSTTS		/ RETURN				/A122

PRSTUP,	XX			/ COPY STATUS UP			/A122
	TAD	PRSTT2		/ GET STATUS				/A122
	TAD	(-1)		/ SEE IF WE ARE IN TROUBLE		/A122
	SPA SNA CLA							/A122
	JMP I	PRSTUP		/ NO, JUST RETURN			/A122
	TAD	PRSTTS		/ SEE IF WE ARE ALREADY IN TROUBLE	/A122
	TAD	(-1)							/A122
	SMA SZA CLA							/A122
	JMP I	PRSTUP		/ YES, JUST RETURN			/A122
	TAD	PRSTT2		/ NO					/A122
	DCA	PRSTTS		/ COPY UP STATUS			/A122
	DCA	PRSTT2		/ AND CLEAR THE STACKED STATUS		/A122
	JMP I	PRSTUP		/ AND RETURN				/A122



/***********************************************************************/a227
/ MNGETC,  get a character from the buffer and check for multinational
/		precedence char. If there is one the get the next char
/		and make it 8 bits by adding 200
/		here because of space problems in proportional spacing olay
/***********************************************************************/a227

MNGETC,	XX		/ return address				/a237
	DCA	TCCHAR	/ clear tech char				/a237
	TAD	PLDIR	/ get direction					/a237
	SMA CLA		/ skip if negative 				/a237
	JMP	MNGTC1	/ normal direction 				/a237
	TAD I	PLPTR	/ get the char					/a237
	JMP	MNGTC6	/ reverse direction				/a237
			/ on previous page				/a237

MNGTC4,	TAD I	PLPTR	/ get this char					/a237
	JMP	MNGTC3	/ skip next instrucyion				/a237
MNGTC2,	TAD	MNSVCH	/ get saved char				/a237
MNGTC3,									/a237
	ISZ	TCCHAR	/ tech char detected				/a237
	JMP	MNGTC5	/ no cont					/a237
	CLA		/ clear ac					/a237
	SKP		/ skip the increment				/a237
MNGTC5,	ISZ	MNGETC	/ do a skip return				/a237
	JMP I	MNGETC	/ return					/a237

MNGTC1,	JMS	MNGETA	/ test the char					/a237
	JMS	PLNXT	/ if yes then get the next char			/a237
	NOP		/ WILL NEVER BE THE LAST ONE			/A237
	JMP	MNGTC4	/ join code to test for tech char		/a237
	
MNSVCH,	0		/ save character				/a237
TCCHAR,	0		/ tech char flag				/a236

MNGETA,	XX		/ return address				/a227
	TAD I	PLPTR	/ get the character				/a227
	AND	P177	/ strip off the mode bits			/a227
	TAD	(-23)	/ test for tech precedence			/a227
	SNA		/ skip if it is'nt				/a227
	JMP	MNGET2	/ go to pick up the char			/a227
	IAC		/ test for multinational			/a236
	SNA		/ skp if it isnt				/a236
	JMP	MNGET3	/ jump if it is					/a236
	IAC		/ test for line drawing				/a236
	SZA CLA		/ skip if it is					/a236
	JMP	MNGET5	/ must be a normal char				/a236
MNGET2,	
	AC7777		/ SET THE TECH CHAR FLAG			/a237
	DCA	TCCHAR	/ save it					/a237
	JMP 	MNGET3	/ jmp to jion the multinational code		/a236

MNGET5,	ISZ	MNGETA	/ do a skip return				/a236
	JMP I	MNGETA	/ return					/a227

MNGET3,
	AC7777		/ set the multinational flag			/a227
	DCA	PLWMUL	/ 						/a227
	JMP I	MNGETA	/ go pick up the char				/a236


/d236/***********************************************************************/
/									/
/	PNFERR--PROCESS NON FATAL ERROR FROM LQPSE			/
/		THIS ROUTINE HAS BEEN REWORKED			/A132	/
/		TO GIVE HIGHER PRIORITY TO ERRORS		/A132	/
/		OTHER THAN PAUSE				/A132	/
/									/
/***********************************************************************/

/d236PNFERR,				/ PROCESS NON FATAL ERROR		/
/d236	TAD	(-40
/d236	SNA			/ IF ANY ERROR
/d236	JMP	PNF0
/D132
/d236	RTR			/ IF RIBBON				/C132
/d236	SZL
/d236	JMP	PRS28		/      THEN PROCESS
/d236	RTR
/d236	SZL			/ ELSE IF 'CUT SHEET FEEDER ERROR'	/
/d236/d236	JMP	PRS32		/      THEN PROCESS
/d236	RTL			/ IF PAUSE				/A132
/d236	RAL								/A132
/d236	SZL CLA
/d236	JMP	PRS24		/      THEN PROCESS
/ IF WE FALL THROUGH, UNDEFINED ERROR, RESET ERROR CONDITIONS
/
/d236PNF0,	JMS	PRESET		/ REPORT NO ERROR CONDITION
/d236	JMP	SQSTRT		/ AND START OVER

/
/ CAREFUL--THE AC MAY NOT BE NOT CLEAR WHEN ENTER AT THESE LABELS	/
/d236PRS32,	CLA			/				/C130	/C134
/d236	TAD	(24)		/ CODE FOR LQPSE ASF ERROR		/A134
/d236	JMP	VMALF1		/ GO SET STATUS, PRSTOP, & PABORT	/C225
/d236				/ PAPER AFTER USER RESPONDS		/C134

/d236PRS28,	AC0001			/ LQPSE RIBBON = 16			/
/d236PRS24,	TAD	(15)		/ LQPSE PAUSE = 15			/
/d236	JMS	STSTTS		/ SET ERROR STATUS			/C114
/d236	JMP	SQSTRT		/ GO RESET PARSER & START OVER		/C225
/d236

/---------------------
	PAGE

/	R2FILP - RDFIL FOR PRINTER.
/
/	183	HLP	17-APR-84	Combine R2FILP with WPRINT
/	014	HLP	17-APR-84	Fixup problems of combining QBLKs
/	013	HLP	12-APR-84	MOVE PRVALB FROM RESIDENT
/			12-APR-84	MOVE PCTBUF TO OVERLAY
/					Use only PRQB--delete RDFQB
/	012	HLP	09-FEB-84	Document read error caused program HLT
/	011	HLP	14-NOV-83	Move READCH here from WPRINT
/	010	HLP	19-OCT-83	Add PCTBUF for parsing printer controls
/	009	HLP	03-OCT-83	Add label RDFIO4 as part of bugfix when
/					  user places a diff. docdsk. after queing
/					  and print spoller finds nonexist doc
/	008	WCE	17-AUG-83	Remove changes made under #004 changing
/					  RXE?? definitions from those in WPF1
/	007	HLP	10-MAY-83	Add JMS SQPINP near JWAIT
/	006	HLP	25-APR-83	Add code to detect if WPRINT is too big
/	005	HLP	07-MAR-83	RDFIO handles all document disk read errors
/	004	HLP	04-MAR-83	Making compatible with RXE??
/					  definitions which have 4000 bit
/	003	GDH	03-MAR-82	Changed temp location of  RDGTHS.
/					Fix for long docs.
/	002	GDH	10-FEB-82	Modified error handling. (since we
/					 weren't properly handling (disk) errors
/					 error handling was disabled. Also there
/					 is a critical room shortage.
/	001	GJP	21-JAN-82	Added 2 more possible header extensions
/		TT	07-JUL-81	Removed superfluous conditionals
/	X3.5	JLZ	20-MAY-80	REARRANGED TO SUPPORT SAVING POSITIONS FOR
/	ENHANCED HEADERS/FOOTERS
/	2.7A-1	LDB	1/29/78		CHANGE FOR WT78 7-BIT
/	2.J	KEE	ADD 4-FLOPPY SUPPORT 8/26/77
/
	SCHCNT= 774 		/ BYTES PER BLOCK
	BOFSET= 2
	SCBKOF= 52 		/ OFFSET TO FIRST BLOCK PTR IN HEADER 1
/

/THE VARIABLES IN THE BLOCK WHICH FOLLOWS ARE READ FROM THE HEADER BLOCK
/OF THE DOCUMENT TO BE PRINTED.  SOME OF THE VALUES ARE CHANGED AT START-UP
/TIME.  THE MEANINGS OF THE VLAUES ARE DETAILED BELOW:

PRVALB,

PRQCPY,	0	/THE NUMBER OF COPIES TO BE MADE.  THE VALUE IS
		/DECREMENTED AS	COPIES ARE PRINTED.

PRQIND,	0	/THE NUMBER OF BLANK COLUMNS IN THE LEFT MARGIN.

PRQLSZ,	0	/THE NUMBER OF EXTRA HALF LINES TO BE ADDED.

PRQTMG,	0	/THE NUMBER OF LINES IN THE TOP MARGIN.  CHANGED TO
		/THE NUMBER OF LINE UNITS IN THE TOP MARGIN.

PRQBMG,	0	/THE NUMBER OF LINES IN THE BOTTOM MARGIN.  CHANGED TO
		/THE NUMBER OF LINE UNITS IN THE BOTTOM MARGIN.

PRQPSZ,	1020	/THE NUMBER OF LINES ON THE PAGE.  CHANGED TO THE SIZE
		/OF THE PAGE IN LINE UNITS.

PRQPIT,	0	/THE PITCH WITH WHICH THE DOCUMENT SHOULD BE PRINTED.

PRQBOT,	0	/THE PAGE NUMBER OF THE FIRST PAGE TO BE PRINTED.

PRQTOP,	0	/THE PAGE NUMBER OF THE LAST PAGE TO BE PRINTED.  IS
		/ZERO IF THERE IS NO UPPER LIMIT.

PRQPGO,	0	/THE FIRST PAGE NUMBER TO BE USED.

PRQSP,	0	/BIT 11 OF THIS WORD IS USED TO FLAG SHADOW PRINTING	/A058
		/IF BIT 11 IS SET WE ARE SHADOW PRINTING, ELSE NOT	/A058

PRQAPG,	0	/AUTOMATIC PAGINATION FLAG.  PRQAPG=0 IF NO AUTOMATIC
		/PAGINATION IS TO BE DONE, NON-ZERO OTHERWISE.

PRQINU,	0	/INDENT IN PRINT UNITS; AN UNUSED HEADER SPOT		/C209

PRQTMP,	0	/THIS IS AN UNUSED HEADER VALUE, SO IT IS USED AS A	/M089
		/TEMP DURING DOCUMENT STARTUP TO HOLD THE PAGE SIZE OF	/M089
		/THE LAST DOCUMENTED PRINTED.				/M089

PRQSSM,	0	/ INITAL SE MENU SETTING

PRQSSS,	0	/ CURRENT SE SETTING

PRQOVP,	0	/=1 IF EXTRA DARK PRINTING IS DESIRED.

PRQ2W,	0	/IS NON-ZERO IF TWO PASSES ARE REQUIRED.   IS MODIFIED
		/BY SPOOLER TO KEEP TRACK OF PASSES.

PRQPNT,	0	/THE TYPE OF PHYSICAL PRINTER ATTACHED.  VALUES ARE:
		/DHOST = HOST (HOST)
		/DHOST1 = HOST BUT UNDERLINES AND MULTIPLE PASSES	/A189
		/	  STRIPPED, EOL LINE FEED STRIPPED		/A189
		/DDP2 = SERIAL DRAFT PRINTER (DP2)
		/DSQ1 = SERIAL LQP, ONE HEAD (SQ1)

PRQCM,	0	/THE NUMBER OF EXTRA SPACES TO PUT BETWEEN COLUMNS.

PRQSB1,	0	/THE FIRST SUBSTITUTION CHARACTER.

PRQSB2,	0	/THE SECOND SUBSTITUTION CHARACTER.

/
/	THIS ROUTINE OPENS A FILE FOR READING.  IT IS CALLED WITH THE FILENAME
/	AS AN ARGUMENT.
/
RDINIT,
	XX
/
	DCA	T1 		/ SAVE THE FILE NAME
	TAD	T1 		/ RECOVER IT
	AND	P377 		/ GET THE FILE NUMBER
	DCA	PRQB+RXQFNO 	/ WRITE THE FILE NUMBER
/
	TAD	T1 		/ RECOVER THE FILE NAME
	BSW
	RTR
	AND	(17) 		/ GET THE DRIVE NUMBER
	DCA	RDFDRV		/ SAVE THE DRIVE NUMBER			/C183
	JMS	RDFIO		/ ESTABLISH THE DENSITY			/A001
	RXEDN+4000		/ GO DO A SET DENSITY			/M008
	JMS	RDFIO		/ GET HEADER BLK # INTO PRQB+RXQBLK
	RXEGF+4000
	TAD	PRQB+RXQBLK 	/ GET THE HEADER BLOCK NUMBER
				/ IF THE HEADER COULD NOT BE FOUND
				/ THEN PRQB+RXQBLK CONTAINS ZERO
	DCA	RDHDRB 		/ SET HEADER BLOCK NUMBER
	AC7777
	DCA	RDCHNO 		/ INITIALIZE THE COUNT OF NUMBER OF CHARACTERS
				/ LEFT IN THE BUFFER
	AC7777
	DCA	RDPTNO 		/ INITIALIZE THE COUNT OF NUMBER OF BLOCK NUMBERS
				/ LEFT IN THE TABLE
	TAD	(SCBKOF) 	/ INITIALIZE THE OFFSET OF THE FIRST BLOCK NUMBER
				/ IN THE HEADER BLOCK
	DCA	RDPTRS
	DCA	RDMOD 		/ CLEAR THE MODE VALUES (USED IN SIX BIT TRANSLATION)
	DCA	RDMOD+1
	DCA	RDHDBN 		/ SHOW BUFFER EMPTY OF HEADER BLOCK
	JMS	RDGETR 		/ GET THE FIRST HEADER EXTENSION
	DCA	RDHDRB+1 	/ SAVE ITS BLOCK NUMBER
	AC0001
	JMS	RDGETR 		/ GET THE SECOND HEADER EXTENSION
	DCA	RDHDRB+2 	/ SAVE ITS BLOCK NUMBER
	TAD	(1354)		/ GET THE PTR TO WHERE THE EXTENSIONS	/A001
				/ ARE IN THE 2ND HEADER EXTENSION
	JMS	RDGTHS		/ GO GET REMAINING HEADERS INTO MEMORY	/A001
	JMP I	RDINIT 		/ AND RETURN


/
/	THIS ROUTINE RETURNS THE NEXT CHARACTER FROM THE FILE IN 6-BIT
/
RDNXC,
	XX
/
	JMS	RDNXCB 		/ GET THE NEXT BYTE FROM THE FILE
/
	TAD	(-77) 		/ IS IT AN ESCAPE?
	SNA
	JMP	RDNXCX 		/ JUMP IF SO
/
	TAD	P77 		/ ELSE RESTORE THE CHARACTER
	JMP I	RDNXC 		/ AND RETURN IT
/
RDNXCX,
	JMS	RDNXCB 		/ GET ANOTHER BYTE
	SMA SZA
	TAD	P7700 		/ SHOW IT IS AN ESCAPE CHARACTER
	JMP I	RDNXC 		/ AND RETURN IT


/
/	THIS ROUTINE RETURNS THE NEXT BYTE FROM THE FILE
/
RDNXCB,
	XX
/
RDNXC1,
	CLA
	ISZ	RDCHNO 		/ INCREMENT THE NEGATIVE CHARACATER COUNT
	JMP	RDNXC3 		/ JUMP IF THERE ARE ANY CHARACTERS LEFT IN THE BUFFER
/
	TAD	RDPTRS		/ INCREMENT THE OFFSET.			/A002
	JMS	CK3HDR		/  (AND CHECK FOR SKIP).		/A002
	DCA	RDPTRS		/    AND SAVE.				/A002
	ISZ	RDPTNO 		/ ANY BLOCK NUMBERS LEFT?
	SKP 			/ SKIP IF SOME ARE LEFT
/
/	THERE ARE NO BLOCK NUMBERS LEFT IN THE TABLE.  FILL THE TABLE BACK UP.
/
	JMS	RDFTAB 		/ THIS RTNE FILLS THE TABLE WITH BLK NBRS/M002
/
/	THERE ARE NO CHARACATERS.  READ THE NEXT BLOCK INTO THE BUFFER.
/
	TAD	(-SCHCNT) 	/ RESET THE CHARACTER COUNT
	DCA	RDCHNO
	JMS	RDFBUF 		/ FILL THE BUFFER			/M002
	JMP I	RDNXCB 		/ ERROR OR EOF RETURN
/
/	NOW, READ THE NEXT BYTE FROM THE BUFFER
/
RDNXC3,
	TAD	RDCHNO 		/ GET THE CHARACTER COUNT
	TAD	(SCHCNT) 	/ SUBTRACT FROM THE END OF THE BUFFER
	JMS	RDGTBY 		/ GET THE NEXT BYTE FROM THE BUFFER
	RDBUF+BOFSET
/
	SNA 			/ IS THE VALUE A NULL?
	JMP	RDNXC1 		/ JUMP TO GET A NEW ONE IF SO
	JMP I	RDNXCB 		/ ELSE, RETURN THE VALUE

/
/
/	THIS ROUTINE READS THE NEXT BLOCK INTO THE TABLE
/
RDFBUF,	XX
	ISZ	RDLPTR 		/ INCREMENT THE POINTER INTO TABLE
	TAD	RDLPTR		/ NOW LOCATED OFF PAGE			/A198
	DCA	RDBUT1		/ SAVE TEMPORARILY			/A198
	TAD I	RDBUT1		/ RECOVER THE NEXT BLOCK NUMBER		/A198
	SNA 			/ IS THERE ANOTHER BLOCK NUMBER?
	JMP	RDFBL1 		/ JUMP IF THERE ARE NO MORE

	JMS	RDFIO 		/ READ THE NEXT BLOCK
	RXERD+4000							/M008
	ISZ	RDFBUF
	JMP I 	RDFBUF 		/ AND RETURN

RDFBL1,		/ WE HAVE REACHED THE END OF THE FILE
	DCA	RDCHNO 		/ CLEAR THE CHARACTER COUNT TO SIGNAL EOF
	JMP I 	RDFBUF 		/ AND RETURN

RDBUT1,	0			/ TEMP TO INDIRECT THROUGH		/A198
/---------------------
	PAGE

/THIS ROUTINE IS THE MERGING POINT OF THE THREE ELEMENTARY FILE ACCESS
/ROUTINES.  THIS ROUTINE JUMPS TO WHICHEVER ELEMENTARY ROUTINE IS ADDRESSED
/THROUGH THE LINK RDCHAR, AND RETURNS THE CHARACTER WHICH THE ELEMENTARY
/ROUTINE RETURNS.

/IF AN END PRINT CONTROL OR AN END OF FILE IS RECEIVED, THE ROUTINE
/RETURNS ZERO.  ALSO, THE LOCATION RDCHAR IS CLEARED SO THAT SUBSEQUENT
/ATTEMPTS TO READ FROM THE CURRENT ELEMENTARY ROUTINE WILL RESULT IN
/CONTINUING RETURNS OF ZERO UNTIL THE LINK IS RESET.

/AC=0
/JMS	READCH
/AC=CHARACTER OR ZERO (FOR END OF FILE OR END PRINT CONTROL)

READCH,
	XX

	TAD	RDCHAR	/HAS RDCHAR BEEN CLEARED?
	SZA CLA
	JMP I	RDCHAR	/USE THE ELEMENTARY ROUTINE CURRENTLY SELECTED

/THE ELEMENTARY ROUTINES RETURN HERE WHEN READING IS COMPLETE.

READRT,
	DCA	T1	/SAVE THE RETURNED VALUE

/IF THE RETURNED CHARACTER INDICATES END OF FILE (ZERO OR NEGATIVE) OR
/END OF PRINT CONTROL (1414), RETURN ZERO.  OTHERWISE, RETURN THE VALUE
/FROM THE ELEMENTARY ROUTINE.

	TAD	T1	/RESTORE THE VALUE--IS IT AN END OF FILE?
	TAD	(-EPC)	/IS IT AN END OF PRINT CONTROL?
	SNA
	JMP	READC1	/YES--RETURN ZERO

	TAD	(EPC)	/IS IT AN END OF FILE?
	SMA SZA CLA
	JMP	READC2	/NO--RETURN THE VALUE

/WE WANT TO RETURN ZERO.

READC1,
	DCA	RDCHAR	/CLEAR THE READ LINK TO PERPETUATE EOF
	JMP I	READCH	/AND RETURN

/THE VALUE WHICH SHOULD BE RETURNED IS NOW IN T1.

READC2,
	TAD	T1	/GET THE RETURN VALUE
	JMP I	READCH	/RETURN


/THIS SECTION READS CHARACTERS FOR THE PRINTER FROM THE FILE SYSTEM.

RDFILE,

	JMS	RDNXCH	/READ THE NEXT CHARACTER
	JMP	READRT	/RETURN THE CHARACTER


/THIS SECTION READS CHARACTERS FROM THE EDITOR.

RDEDIT,
	XX		/A CIF TO THE EDITOR'S INSTRUCTION FIELD IS
			/PATCHED HERE

	JMS I	PRIRAD	/GET A CHARACTER FROM THE EDITOR
	JMP	READRT	/RETURN THE CHARACTER


/THIS ROUTINE READS CHARACTERS FROM THE DISK HEADER/FOOTER BUFFER.

RDBUFF,
	ISZ	RDBPTR	/POINT TO THE NEXT POSITION IN THE BUFFER
	ISZ	RDCCNT	/ANY CHARACTERS LEFT?
	JMP	RDBUF1	/YES--READ THE NEXT ONE

	TAD   (OVRDBL)	/NO--READ THE NEXT BLOCK FIRST
	JMS	PROV
		OBRDBL

RDBUF1,
	XX		/THIS LOCATION IS PATCHED WITH A CDF TO THE
			/FIELD OF THE BUFFER

	TAD I	RDBPTR	/GET THE CHARACTER
	CDFMYF
	JMP	READRT	/RETURN THE CHARACTER

RDCCNT,	0	/CHARACTERS REMAINING IN BLOCK TO BE READ
RDBPTR,	0	/POINTER INTO BUFFER OF BLOCK BEING READ
RDBLCK,	0	/THE BLOCK CURRENTLY BEING READ


/
/	THIS ROUTINE FILLS THE BLOCK NUMBER TABLE WHEN IT IS EMPTY.
/
RDFTAB,	XX
	TAD	(-RDNPTR)
	DCA	RDPTNO 		/ INITIALIZE COUNT OF NUMBERS IN TABLE
	TAD	(RDPTRB-1)
	DCA	RDLPTR 		/ INITIALIZE POINTER INTO TABLE
	AC7777			/ UN-DECREMENT THE POINTER.		/A002
	TAD	RDPTRS 		/ SAVE THE OFFSET TO USE BELOW	
	DCA	RDTEMP							
/
/	NOW FILL THE TABLE WITH BLOCK NUMBERS.
/
RDFTL1,
	ISZ	RDLPTR 		/ INCREMENT POINTER INTO THE TABLE
	TAD	RDTEMP		/ GET OFFSET & INCREMENT IT.		/A002
	JMS	CK3HDR	/ GO CHECK TO SEE IF THE 3RD HEADER EXT BLCKS	/A001
	DCA	RDTEMP		/ SAVE NEW OFFSET.			/A002
/
	TAD	RDTEMP 		/ GET THE NEXT OFFSET			
	JMS	RDGETR 		/ GET NEXT BLOCK NUMBER
	SNA			/ SKIP IF THERE IS AN OFFSET.		/A002
	JMP	RDFTL2		/ JMP IF AT END OF FILE.		/A002
	DCA I	RDLPTR 		/ STORE THE BLOCK NUMBER IN THE TABLE
	ISZ	RDPTNO 		/ IS THERE STILL ROOM IN THE TABLE?
	JMP	RDFTL1 		/ CONTINUE LOOP IF THERE IS
/
	SKP			/ DON'T SET STOPPER.			/A002
RDFTL2,	DCA I	RDLPTR		/ SET STOPPER.				/A002
	TAD	(-RDNPTR) 	/ RESET TABLE COUNT
	DCA	RDPTNO
/
	DCA	RDHDBN 		/ SHOW THE BUFFER CONTAINS NO HEADER BLOCK
/
	TAD	(RDPTRB-1) 	/ GET ONE BEFORE THE BEGINNING OF THE TABLE
	DCA	RDLPTR 		/ INITIALIZE THE POINTER INTO THE BLOCK NUMBER TABLE
/
	JMP I 	RDFTAB 		/ AND RETURN
/

RDTEMP,	0			/ A TEMP FOR RDFTAB.			/A002


RDLPTR,	0 			/ POINTER INTO THE BLOCK NUMBER TABLE
RDPTNO,	0 			/ COUNT OF TABLE ENTRIES
/
/	THE FOUR VARIABLE LOCATIONS WHICH FOLLOW MUST REMAIN IN THIS ORIENTATION
/	SINCE THEY ARE SAVED AND RESTORED BY THE PRINTER TO IMPLEMENT ENHANCED
/	HEADERS AND FOOTERS.
/
/	*********************************************************************
/
FSSAV,
RDPTRS,	0 			/ OFFSET INTO THE HEADER BLOCK OF NEXT BLOCK NUMBER
RDMOD,	0 			/ MODES FOR DECODING 6-BIT
	0
RDCHNO,	0 			/ BUFFER CHARACTER COUNT


/THE BUFFER AREA FOR MULTI COLUMN

PRMCAC=24	/SIZE OF THE COLUMN AREA 20 COLUMNS			/C198

PRMCAY,
	1
	ZBLOCK	PRMCAC


/THE BUFFER AREA FOR SAVE/RESTORE OPERATONS

PRSAV,
	ZBLOCK 30				/M056
/---------------------
	PAGE


/
/	THIS ROUTINE READS THE NEXT CHARACTER FROM THE FILE AND RETURNS IT IN
/	SEVEN BIT ASCII.
/
RDNXCH,
	XX
/
/	IF THE CHARACTER COUNT IS CLEARED, THE EOF HAS BEEN REACHED.
/
	TAD	RDCHNO 		/ IS THE COUNT CLEAR?
	SMA CLA
	JMP I	RDNXCH 		/ YES--RETURN IMMEDIATELY
/
RDNXH1,	JMS	RDNXC 		/ ++++
	SNA 			/ ++++
	JMP I	RDNXCH 		/ RETURN IF NONE
	JMS	XLTASC
	JMS	GETMOD 		/ ++++
	RDMOD
	SNA 			/ ++++
	JMP	RDNXH1 		/ DON'T RETURN NULLS
	JMP I	RDNXCH
/
RDGTBY,	XX
	CLL RAR
	TAD I	RDGTBY
	DCA	GETBY1
	ISZ	RDGTBY
	TAD I	GETBY1
	SNL 			/ ++++
	BSW
	AND	P77
	JMP I	RDGTBY
	GETBY1=T1
/
RDFIO,	XX
	DCA	RDFIOT		/ SAVE BLOCK NUMBER TEMPORARILY		/C183
	TAD I	RDFIO 		/ ++++
	DCA	RDFIOQ+2	/ AND FUNCTION CODE			/C183
	ISZ	RDFIO
RDFIOQ,	TAD	RDFIOT		/ GET BLOCK NUMBER BACK			/A183
	JMS	PRQRX		/ CALL DISK IO ROUTINE			/A183
		0		/ FUNCTION CODE (LOADED ABOVE)		/A183
RDFDRV,		0		/ STORAGE FOR FILE DRIVE NUMBER		/A183
		RDBUF		/ BUFFER				/A183
	JMP	PRQDDE		/ IF ERROR GO REPORT IT			/A183
	JMP I	RDFIO		/ RETURN

RDFIOT,	0			/ TEMP STORAGE FOR BLK			/A183


/
/	RDFIL HEADER CONTROL BLOCK
/
RDBFCB,	RDBUF 			/ BUFFER ADDRESS
RDHDBN,	0 			/ POINTER TO CURRENT HEADER BLOCK NUMBER
RDHDRB,	0 			/ ++++
	0
	0
	0 			/ ++++
	0 			/ ++++
	0 			/ HEADER BLOCK NUMBERS ENDED BY ZERO
/
/	THIS ROUTINE RETURNS THE BLOCK NUMBER ADDRESSED BY THE OFFSET WHICH IS
/	IN THE AC UPON CALL.
/
RDGETR,
	XX
/
	DCA	.+2 		/ SAVE THE OFFSET IN THE CALL BELOW
/
RDGETA,
	JMS	SCOFST 		/ THIS ROUTINE RETURNS THE ADDRESS IN THE BUFFER OF
				/ THE DESIRED OFFSET IN A SKIP RETURN.  IF THE
				/ RIGHT HEADER BLOCK IS NOT IN THE BUFFER, IT MAKES
				/ ANORMAL RETURN, BUT HAS SET RDHDBN TO THE ADDRESS
				/ OF THE PROPER HEADER BLOCK NUMBER.
	0 			/ THE DESIRED OFFSET
	RDBFCB 			/ THE HEADER CONTROL BLOCK
/
	JMP	RDGTXR 		/ NORMAL RETURN MADE--JUMP TO HANDLE IT
/
	DCA	T1 		/ SAVE THE BLOCK NUMBER ADDRESS TO INDIRECT THROUGH
	TAD I	T1 		/ GET THE BLOCK NUMBER
	JMP I	RDGETR 		/ RETURN IT
/
/	WE MUST LOAD THE HEADER BLOCK INTO THE BUFFER AND TRY AGAIN
/
RDGTXR,
	TAD I	RDHDBN 		/ GET THE BLOCK NUMBER OF THE HEADER BLOCK
	SNA
	JMP	RDGTXZ 		/ JUMP IF NO HEADER BLOCK WAS SPECIFIED
/
	JMS	RDFIO 		/ READ THE HEADER BLOCK
	RXERD+4000							/M008
/
	JMP	RDGETA		/ GO BACK AND GET THE BLOCK NUMBER
/
RDGTXZ,
	DCA	RDHDBN 		/ CLEAR TO INDICATE NO HEADER BLOCK IS IN THE BUFFER
	JMP I	RDGETR 		/ AND RETURN
/
SCOFST,	XX
	DCA	SCOFS1 		/ INIT REL BLK #
	TAD I	SCOFST
	TAD	(-376) 		/ COMPUTE REL BLK #
	ISZ	SCOFS1
	SMA 			/ ++++
	JMP	.-3
	DCA	SCOFS2 		/ SAVE OFFSET-400
	ISZ	SCOFST
	TAD I	SCOFST 		/ BUFCB PTR
	DCA	SCOFS3
	AC0001 			/ ++++
	TAD	SCOFS3 		/ CUR BLK PTR PTR
	DCA	SCOFS4
	ISZ	SCOFST
	TAD I	SCOFS4
	SNA 			/ ++++
	JMP	SCOFSA 		/ READ IF CURR BLK 0
	CIA 			/ ELSE COMPARE WITH NEEDED PTR
	TAD	SCOFS1 		/ ++++
	TAD	SCOFS4
	SNA CLA 		/ ++++
	JMP	SCOFSB 		/ JUMP IF SAME
SCOFSA,	TAD	SCOFS1 		/ ++++
	TAD	SCOFS4 		/ SET NEW BLK PTR
	DCA I	SCOFS4
	JMP I	SCOFST 		/ RETURN FOR READ
SCOFSB,	TAD	SCOFS2 		/ ++++
	TAD	(400) 		/ WORD OFFSET
	TAD I	SCOFS3 		/ +BUFFER PTR
	ISZ	SCOFST 		/ BUMP FOR NORMAL RETURN
	JMP I	SCOFST 		/ RETURN WORD PTR
/
SCOFS1,	.-.
SCOFS2,	.-.
SCOFS3,	.-.
	SCOFS4=T1							/A005

/THIS ROUTINE IS CALLED TO UNDERLINE THE DISTANCE IN PLASPC.  UPON COMPLETION,
/THE HEAD SHOULD HAVE MOVED ONLY THE DISTANCE PLASPC, PLASPC MUST BE CLEAR,
/PLOLNC MUST NOT HAVE CHANGED, AND PLPOS MUST NOT HAVE CHANGED EITHER.

PRUNDL,
	XX

/WE PROCEED TO PRINT UNDERLINES AND UPDATE PRCCH AND THE AMOUNT WHICH
/REMAINS TO BE PRINTED.  WHEN THE HEAD POSITION EXCEEDS THE LIMIT, WE QUIT.

PRUND0,
	TAD	PLNRCS	/GET THE SIZE OF AN UNDERLINE
	JMS I	PRLSCX	/SET SPACE SIZE AND UPDATE HEAD POSITION

	TAD	U137	/GET AN UNDERLINE
	JMS I	PRCHAX	/PRINT THE UNDERLINE

	TAD	PLNRCS	/GET AMOUNT JUST PRINTED
	CIA
	TAD	PLASPC	/SUBTRACT FROM SPACING TO DO
	DCA	PLASPC	/SAVE AS SPACING WHICH REMAINS

	TAD	PLASPC	/SEE IF THE HEAD IS FAR ENOUGH LONG NOW
	SZA SMA CLA
	JMP	PRUND0	/NO--CONTINUE UNDERLINING

/WE ARE ALMOST THROUGH PRINTING THE UNDERLINE.  WE MOVE BACK TO THE END OF
/THE UNDERLINE AND PUT A LAST ONE THERE.

	JMS I	PLHMOX	/DO THE MOVE

	JMS I	PRLSCX	/SET THE SPACING TO ZERO
	TAD	U137	/GET AN UNDERLINE
	JMS I	PRCHAX	/PRINT IT

	JMP I	PRUNDL	/AND RETURN

/LINKS FOR THIS ROUTINE.

PRLSCX,	PRLSCS
U137,	137
PRCHAX,	PRCHAR
PLHMOX,	PLHMOV
/--------------------
	PAGE

/ NOTE: THIS CONSTANT (1355) IS USED ONCE DURING OPEN, THEN OVERLAID

XLTASC,	 			/ XLAT 6-BIT TO ASCII
	XX
				/ 1-73: NORMAL
				/ 74:	SHIFT
				/ 76:	UNSHIFT
				/ 7702-7777:	ESCAPE
/
/	OUTPUT:
/
				/ -(1-6):	MODE CHANGE (L=1 IF ON)
				/ 0-200:	ASCII CHAR (L=1 IF ALPHA)
/
	SPA SNA 		/ ++++
	JMP	XLTAS1 		/ ESCAPE
	TAD	(-74) 		/ ++++
	SMA 			/ ++++
	JMP	XLTAS2 		/ SHIFT-UNSHIFT
	TAD	(74-41)
XLTAS4,	CLL CML 		/ SET LINK FOR ALPHA
	TAD	(41+37) 	/ CLEAR LINK IF NOT ALPHA
	JMP I	XLTASC
XLTAS1,	TAD	(100-MAXESC) 	/ ++++
	SMA 			/ ++++
	CLA 			/ CHECK FOR OK
	TAD	(MAXESC+ESCTAB) / ++++
	DCA	T1
	TAD I	T1 		/ ++++
	SPA 			/ ++++
	JMP	XLTAS3
	TAD	(-100) 		/ ADJUST FOR ALPHA TEST
	JMP	XLTAS4
/
XLTAS2,	SNA CLA 		/ ++++
	IAC
	CMA
XLTAS3,	CLL CML RAR
	JMP I	XLTASC
/
ESCTAB,	0 			/ ++++
	0
	-3 			/ ++++
	-4 			/ ++++
	-5 			/ ++++
	-6 			/ ++++
	11 			/ ++++
	10 			/ ++++
	15
	-13 			/ ++++
	-14 			/ ++++
	12 			/ ++++
	14 			/ ++++
	-7 			/ ++++
	-10
	-11 			/ ++++
	-12 			/ ++++
	0
	133 			/ ++++
	134 			/ ++++
	135 			/ ++++
	136 			/ ++++
	137
	0 			/ NORMALLY 7 FOR NEED-WRAP CODE
	16 			/ ++++
	17
	MAXESC=.-ESCTAB
	-16 			/ ERROR
/	NOTE: THIS CONSATNT (RDHDRB+2) IS USED ONCE, THEN OVERLAID
GETMOD,	 			/ XLAT ESCAPES, ADD MODES TO ASCII
	XX
	MQL
	TAD I	GETMOD 		/ ++++
	DCA	T1 		/ ++++
	ISZ	GETMOD
	MQA
	SMA SZA 		/ ++++
	JMP	GETMD1 		/ NORMAL ASCII
	SNA 			/ ++++
	JMP I	GETMOD
	IAC
	SNA 			/ ++++
	ISZ	T1 		/ ADJUST T1 IF SHIFT-UNSHIFT CHANGE
	TAD	(MODTAB) 	/ ++++
	DCA	T2 		/ GET PTR
	TAD I	T2
	SPA 			/ ++++
	JMP I	GETMOD 		/ RETURN QUICK IF ERROR
	CMA
	AND I	T1
	SNL 			/ ++++
	TAD I	T2
	DCA I	T1 		/ SET NEW MODE
	JMP I	GETMOD
GETMD1,	TAD I	T1 		/ ADD MODE FLAGS
	ISZ	T1
	SZL 			/ ++++
	TAD I	T1 		/ AND UNSHIFT
	JMP I	GETMOD
/
	-1 			/ ERROR
	2000
	1400
	1000
	400
	200
	MODTAB=.
	40
/
	RDNPTR=10
RDPTRB,	ZBLOCK RDNPTR

/***********************************************************************		/									/A001
/	THIS ROUTINE WILL COPY IN TO MEMORY THE TWO ADDITIONAL		/A001
/	HEADER BLOCK NUMBERS FOR DOUBLE DENSITY DISKETTES.		/A001
/									/A001
/***********************************************************************/A001
RDGTHS,	/ GETS HEADER EXTENSIONS 3 AND 4 INTO MEMORY			/A001
	XX								/A001
	DCA	RDTMP1		/ GET POINTER TO WHERE THE BLOCK NBRS ARE/M003
	TAD	(RDHDRB+2)		/ GET THE TARGET AREA ADDRESS	/A001
	DCA	X1		/ STORE IT FOR AUTOINDEXING		/A001
	TAD	RDTMP1		/ GET POINTER TO HEADER EXTENSIONS	/M003
	JMS	RDGETR		/ GO GET THE EXTENSION			/A001
	DCA I	X1		/ PUT IT INTO BLOCK LIST		/A001
	ISZ	RDTMP1		/ BUMP UP THE POINTER TO NEXT EXTENSION	/M003
	TAD	RDTMP1		/ GET IT				/M003
	JMS	RDGETR		/ GO GET 4TH EXTENSION			/A001
	DCA I	X1		/ PUT IT INTO RDFIL BLOCK CONTROL AREA	/A001
	JMP I	RDGTHS		/ RETURN				/A001

/********************************************************************	/A001
/									/A001
/	THIS ROUTINE WILL CHECK TO SEE IF THE POINTER IS POINTING TO 	/A001
/	THE AREA ON THE 2ND HEADER EXTENSION WHERE THE ADDITIONAL	/A001
/	HEADER BLOCK EXTENSION BLOCK NUMBERS ARE. IF THE POINTER IS 	/A001
/	POINTING THERE, IT WILL BUMP UP THE POINTER SO THAT IT WILL BE	/A001
/	POINTING TO THE NEXT DOCUMENT TEXT BLOCK NUMBER, SO THAT WE 	/A001
/	WON'T BE TRYING TO PRINT HEADER EXTENSION BLOCK NUMBERS AS	/A001
/	TEXT BLOCKS.							/A001
/									/A001
/***********************************************************************/A001

RDTMP1,									/A003
CK3HDR,		/ CHECK FOR THIRD HEADER, AND BUMP PAST HDR EXTENSIONS	/A001
	XX								/A001
/D002;	TAD	RDPTRS		/ GET HEADER WORD POINTER		/A001
	TAD	(-1353)		/ GET NEG OF POINTER WHERE EXT ARE	/M003
	SNA 			/ ARE THEY EQUAL?			/A001
	TAD	(16)		/ BUMP PAST THE HEADER EXT BLOCK NBRS	/A001
	TAD	(1354)		/ ADD BACK 1354, WHERE HEADERS ARE	/A001
	JMP I	CK3HDR		/ RETURN				/A001
/
	PAGE
/
/****************************************************************************
/
/	This area blasted by print screen routine.  This buffer will	/a226
/	not be in use then, as print screen hook tests for printer	/a226
/	busy before blasting, and aborts if it is.  Therefore it is	/a226
/	perfectly safe to blast it in here (er-hem! cough! cough!)	/a226
/
/****************************************************************************

RDBUF,	ZBLOCK 400 		/ READ BUFFER

IFZERO .-1&4000 <?WPRINT TOO BIG>					/A006




