/WPRTOV DECMATE-II V2.0 PRINTER OVERLAYS
	/XLIST		/THIS IS SUPPOSED TO BE HERE
/276	EMcD	24-Sep-85	Dutch and Spanish Xlations
/275	EMcD	16-Sep-85	Nordic translations
/274	Mart	28-june85	fix reqired space for tech chars
/273	Mart	28-may-85	set flag to repeat char for shadow
/				and sort bugs in theme printing
/272	MART	03-MAY-85	flag PUM mode
/271	Mart	02-APR-85	Allow 8 bit multinational chars
/270	RCME	22-MAR-85	Set up G1 as line drawing character set
/
/---------------------- All below refer to V2.0 and earlier ---------------
/
/269	HLP	10-JAN-85	Fixup EOD wait for double XON on 02/03/WD
/268	HLP	28-DEC-84	Don't strip trailing spaces if soft retn
/				Delete SP-BS ruse to trigger underline
/				Fix no-letterspacing bug (unreported)
/				Only reset LQP02 at EOD
/				Fix missing jump--going to oblivion on EOD timeout
/				Set DECPSP flag for LN03 proportional fonts
/267	HLP	13-DEC-84	UNDO 266 and B include printer ID and
/				reset printer after printer ID
/266	HLP	06-DEC-84	Add 1 sec delay after RIS in PRTRID
/265	HLP	03-DEC-84	Changes for bug 334:  B to include printer ID
/				Reset printer after printer ID using
/				new PCTMRS technique
/				R NOT to ask for status if nonexistent printer
/				Fix dead key tab posn bug
/264	HLP	27-NOV-84	Fix \s.\p hang BUG384, BUG373
/263	HLP	26-NOV-84	Reset PRIRFD when wakeup !!! WPSV2-380
/262	HLP	21-NOV-84	Fix LQP02 bold broken in edit 258
/261	HLP	12-NOV-84  19Z	Fix bug in XMT; too many uses of T2
/260	HLP	12-NOV-84	Changes for extra FF if EO and RESET causes
/				consecutive odd or even pages
/259	HLP	07-NOV-84	Rename LPLIN symbols to DPLIN so will CREF
/258	HLP	06-NOV-84	Fix old TW justify bug WPSV2-361
/257	HLP	26-OCT-84	Change DCS escape chr from \ to /
/				Reenable error reports at EOD after RIS
/256	HLP	23-OCT-84	Fix V2-336 TW alignment problem
/255	HLP	19-OCT-84	For DEVEL, add \v for a fixed string
/254	HLP	16-OCT-84  19X	Fix Attributed CHRSET, FONT, PITCH bug (unreported)
/				Fix Attributed tab justification bug (unreported)
/253	HLP	10-OCT-84	Fix Footer Problem Again broken on edit 214
/				Increase EOD wait before declare malfunction
/				(wpsv2-313) etc.
/252	ECH	09-OCT-84	Fix for incorrect margins on pitch changes
/251	HLP	08-OCT-84	Fix WPSV2-307, Justify with para return
/				Fix WPSV2-314, LQPSE centering justify
/250	HLP	04-OCT-84	For DEVEL, \d includes time
/249	HLP	02-OCT-84  19W	Fix Page Number Centering bug 298
/248	HLP	27-SEP-84	Fix Wide Track Printer Justification
/247	HLP	21-SEP-84	Install Form Feed at BOTP if DD CHST
/				Add 2 overlays for LN03 justification
/246	ECH	18-SEP-84	Fix incorrect font for underlines
/245	HLP	18-SEP-84  19V	Put LPQSE justification back to v1.5
/		10-SEP-84	Minor changes for LN03
/				Fix LQPSE Dead key problem
/244	HLP	07-SEP-84  19T	Rework LQP02 Centering logic to fix bug,
/				  add C in ruler centering ability
/		30-AUG-84  19S	Fix tabbed underline in OV3L10
/				Fix shadowbolding when shouldn't in OV3l10
/243	HLP	28-AUG-84	Initial Changes for proportional centering LQP02
/				...added a new overlay for LQP02 centering
/				Fix 1 space indent bug--reset P2PSN to 0001
/				Fix tab after underline bug
/				Fix Multicolumn not centering
/				Fix Tabs in multicolumn blobbing
/242	HLP	17-AUG-84	Fix LQP02 ppnl TW printing Bug#99
/241	HLP	10-AUG-84	Fix LP headers not printing and clobr boot blk
/240	HLP	09-AUG-84	Changes for odd/even paging
/239	HLP	07-AUG-84	Fix ppnl tabs in LQP02
/238	ECH	01-AUG-84	MINOR BUG IN TECH CHAR TO PRBIF
/237	HLP	31-JUL-84	Add delay after LQP02 XON
/236	HLP	26-JUL-84	Changes for sixel graphic controls
/235	ECH	30-JUL-84	Technical Characters to Host.
/234	HLP	24-JUL-84	Fix DD CHST blank line problem
/233	HLP	20-JUL-84	Account for new return from PLCHBS on tech chr
/232	HLP	17-JUL-84	Change PRTRID so PRSTTS is not set when
/				a non existent printer in CX or LP
/				Do not execute CHFNRS if LQPSE (WPSV2-114)
/231	HLP	15-JUL-84	Move OVDDCK to a type A overlay
/				...Fix missing CLA after set quality mode
/230	LJJ	13-JUL-84	Fixes for \d\p\s expansion/contraction bug
/229	ECH	12-JUL-84	Comments and removal of the start of a block
/				absorbed an extra disk block
/228	ECH	10-JUL-84	Integrate fixes for draft/tech printing:
/					justification of indented rulers
/					justification with tech char
/					bolding of tech char when bold interp on
/227	HLP	09-JUL-84	Move PLSCPX and PLREST from resident to overlay
/226	HLP	02-JUL-84	End of document fix
/				Create CHFNRS for use by PRTRID & OVNDOC
/225	GDH	29-JUN-84	Empty control block bugfix
/224	ECH	22-JUN-84	Technical Characters in LPLIN
/223	HLP	18-JUN-84	Integrate LJJ changes for British lb. sign
/				Initialize G2 and G3 for tech chars.
/222	ECH	15-JUN-84	Complete supers/subs in LPLIN
/221	LJJ	13-Jun-84	Remove edit 205, fix \d processing
/220	HLP	11-JUN-84	Rework ASCOUT and justification sequence
/219	HLP	10-JUN-84	Save a little space in OVJUSD and OVJUSL
/218	HLP	06-JUN-84	Fix Proportional Justified Printing
/				   with replacement characters
/				Fix Required Space with LQPSE
/217	HLP	31-MAY-84	Move PRJL5A here from resident
/				Make PIDW use ESC02 for terminal ID seq
/				Use correct table for proportional printing
/216	HLP	30-MAY-84	Changes for Coding of Required Space
/				Conditionalize code for multiple pass dead keys
/				Use PRESCS to set quality mode
/215	ECH	29-MAY-84	Initial Changes for supers/subs on draft printers
/214	HLP	24-MAY-84	More changes for DD HOST1
/213	HLP	14-MAY-84	Initial Changes for adding DD HOST1
/212	HLP	11-MAY-84	Change XXSTGN names to match G0 and G1 properly
/				Change LPLIN to require argument MC on LA50
/				Reset page size at end of document
/				  (re-establishes top of form)
/				F and N rulers, EX changes for draft printers
/211	HLP	30-APR-84	Restructure justificationn overlays
/				Eliminate thrashing when DD HOST
/				Rebias LQPSE PSTBL from 2 to 1
/210	HLP	25-APR-84	Change end of document scheme to
/				  detect LQP02 done with D2XONF
/				  delete SNDCHR add PCTMID
/209	HLP	24-APR-84	Flush Host Input Buffer if DD HOST
/208	HLP	23-APR-84	Select G0 at beginning of document
/				Fix CHRSET NORMAL bug not resetting G1
/207	HLP	20-APR-84	Changes for RDFIO to use PRQRX
/206	HLP	18-APR-84	Fixup drive no passing for QBLK change
/205	ECH	16-APR-84	Fix for the date change for U.S./British
/204	HLP	13-APR-84	Move PCTBUF to overlay from R2FILP
/				Change RDFQBK to PRQB
/203	HLP	10-APR-84	Add JEXIT code so print field can be used by other jobs
/202	HLP	14-MAR-84	Move justification variable to page zero
/------------------------SDC Submission DECmate-II V1.5---------------------
/201	HLP	19-MAR-84	Reset function code to READ after MISCTL in WBLK
/200	HLP	16-MAR-84	Fix Footer positioning method so works with
/				draft printer which cannot move backwards
/				ALSO fix false mismatch CTL if footer size is
/				less than amount stripped AP NO
/199	HLP	13-MAR-84	WAIT routine not to reset status (move WAIT2,)
/198	HLP	05-MAR-84	Add duplicate routine IDCKT2 to test TIMEOUT
/197	HLP	03-MAR-84	Don't issue PRINTER PITCH command to LQPs
/196	HLP	15-FEB-84	Re-issue margin command after setting pitch
/				LA100,LA120,LA34-WA firmware bug pitch reset margins
/195	HLP	06-FEB-84	Select either table 1 or table 2 in NDOC
/194	HLP	05-FEB-84	Fix theme justification bug.  Although old,
/				this bug never hit V2.1 or V1.1 Yea!
/193	HLP	01-FEB-84	Fix problem of OVRULR (formerly an OLA)
/				being called by other OLAs if a ruler in
/				certain control blocks.  Fixed by making type C
/				Changed OVFONT from type C to B
/193	HLP	19-JAN-84	Don't ask for status on LPQSE ASF error
/				Fix CHRSET initialization bug
/192	HLP	16-JAN-84	Reworking character routines, etc.
/				Make PRSTRP test if already at EOC
/				Restore JMP PRSTRP near PRMCL4
/191	HLP	11-JAN-84	More work on mismatched controls, etc.
/				Inhibit enabling of status reports on LA34
/190	HLP	06-JAN-84	Rewrite LP Header/Footer processing for mismatch
/				  control processing, use diff buffer to save space
/189	HLP	05-JAN-84	LQPSE to feed envs from front tray (DECII-156)
/188	HLP	29-DEC-83	Fix multicolumn matching control problems
/187	HLP	27-DEC-83	Add time delay to loop which times out
/				at end of document if there is an error condx
/186	HLP	16-DEC-83	Reset character size if LQPSE in Stop Menu
/				   otherwise print screen gives blobs (bug 130)
/185	HLP	16-DEC-83	Refine EOF within Control block processing
/184	HLP	08-DEC-83	Detect EOF within Control block indicating
/				   missing end print control
/183	HLP	07-DEC-83	Change end of document delay from 8 to 12 secs
/				(for DECII-140 LA120 bug)
/182	HLP	07-DEC-83	Change Stop Overlays to Type C
/				(fixes missing end control bugs)
/				Call PTSTST where needed near JMS PRRULE
/181	HLP	01-DEC-83	Fix a bunch of SE/SELECT bugs
/180	HLP	30-NOV-83	Fix insert rear message on PRINTER SELECT
/				LETTERHEAD with SE YES
/				SE NO to select trays if ASF attached
/179	HLP	22-NOV-83	Allow String Finals for CHRSET
/178	HLP	17-NOV-83	Move all overlays in WPRINT to here
/				Clear LPONLN if DD=HOST
/177	HLP	11-NOV-83	Changes for SE ENVELOPE multipass strategy
/176	HLP	07-NOV-83	Fix Problem if do user stop while
/				  LQP02 timing out
/				Request a status report after response
/				  to Stop Printer Menu
/175	HLP	02-NOV-83	Don't set T3 at OVSTN unless ASF attached
/174	HLP	29-OCT-83	Bugfixes
/				PRINTER STOPPED at end of doc LQPSE
/				No sheet fed, LQPSE/ASF
/				LQP02 doesn't print: ovly loading probs
/173	HLP	23-OCT-83	Add CHRSET and FONT functions
/172	HLP	13-OCT-83	Add SE LETTERHEAD to PRINTER SELECT cntrol
/171	HLP	03-OCT-83	Bugfix: Detect if header blk #=0 and declare
/				  it to be a doc rd error. (Happens if user
/				  switches disks after que'ng and new dsk
/				  doesn't have a document with same number)
/170	HLP	30-SEP-83	Changed places PRRSST is called
/				  so not clobbered by reset buffer
/169	HLP	11-AUG-83	Changed order of processing so SE stop
/				  processing takes place before reading anything
/168	HLP	23-AUG-83	Restructure overlays so there can be
/				  up to 16 overlay areas and
/				  up to 256 overlays which can load into given area
/				Implement menu pitch for draft printers
/				Don't load printer handlers anymore
/				Add PRINTER control blocks for sending escape
/				  sequences and controlling ASF01/02 tray selection
/167	WCE	17-AUG-83	Remove changes made in edit #146 that caused a
/				  redefinition of "RXE??" handler commands
/166	HLP	10-AUG-83	Make check document destination code
/				  part of PRTRID.  Call wwith AC=0002
/				  This so list processing can set quality
/				  mode on LA50/LA100.
/165	HLP	02-AUG-83	Reset all character enhancement attributes
/				  at end of document ESC [ m (was ESC [ 1 m)
/164	HLP	25-JUL-83	Lengthen end of document delay for LA50
/				Make LA50 & LA100 not observe rest of EOD delay
/				   once answerback occurs
/161	HLP	09-JUN-83	Rework footer processing to leave footer in
/				a fixed psn if text invades BM in AP NO
/160	HLP	07-JUN-83	Add IDANSW flag
/159	HLP	06-JUN-83	Delete extra blank pages when BM=0
/158	HLP	02-JUN-83	Come out of PRWAIT on PRACTN not PRSTOP
/157	HLP	01-JUN-83	Reset LPFLAG near DONE1.  Fix V2.1 bug 159
/156	HLP	24-MAY-83	Change comments near PRST6A
/				Move OVTOPP from a B to an A overlay
/				   to speed up to/from
/				Use 13 bit arithmetic on PRPGNM range checks
/				Delete count backwards after 2048 (\p\s)
/				Lock maximum page number at 4095
/				If PRSTOP occurs during PRTRID treat as
/				   nonexistent printer
/155	HLP	16-MAY-83	Add stuff for communications error code 26
/154	HLP	13-MAY-83	Change PRTRID timer from 3 to 4 seconds
/				Do not re-do printer stop. WPCUT handles this
/153	HLP	10-MAY-83	Reinstate code at GETDC to set busy
/152	HLP	27-APR-83	Make PRRSST resident, add calls in WAITPR
/				  and PRST8A
/				Reorganize setting and clearing of PRSTTS, PRSTT2
/151	HLP	22-APR-83	Make CLQP01 execute only once
/				Increase delays at end of document
/				  to prevent timeouts while printer finishes
/				Make PRRSST request status if LQPSE attached
/150	HLP	08-APR-83	Fix extra CLA d'l't'd rev 094 which resulted
/				   in R also doing an N new page
/149	HLP	07-APR-83	Rewrite SETSTN
/				Revert to old page rollup on B,T (see REV140)
/				Make S call PRRSTS
/148	HLP	01-APR-83	Delete JEXIT so printer errors can be parsed
/				   at all times
/				Fix multicolumn (change SNA to SZA at PRMLTC+2)
/147	HLP	23-MAR-83	Don't reset status for those errors which
/				   the printer will report when corrected
/146	HLP	04-MAR-83	Rewrite to handle disk errors
/145	HLP	01-MAR-83	No ESC-[-c after print if DD=HOST
/				No JMS PRTRID after B,T
/				Use JMS DIGCHK near PRMCG1 to save space
/				Skip JMS PRTRID on N if DD=HOST
/144	HLP	28-FEB-83	Rewrote PRTID to use XRPMSK
/143	HLP	21-FEB-83	New useage of LPONLN (IDFLAG & PRQLQP deleted)
/				  also PRASF deleted
/142	HLP	15-FEB-83	Rework for parser in PRINT field
/141	HLP	27-JAN-83	Fix mask for LPONLN in IDTMMX--was giving
/				  wrong delays for draft printers when dequeue
/				  this was culprit in LA34 beeping bug
/140	HLP	25-JAN-83	Insure that B always resumes pass 1 if 2wheel
/				  Rearranged order of processing at NCPYL3 and 4
/				  Deleted JMS PRSTNP on B or T near OVSTP9
/				    and added JMP .+1 to relieve interrupts
/				    and added JMS PRSTNP on S-S only
/				Make T N be redo n copies if TW YES
/139	HLP	20-JAN-83	Reset LQP02 hit count to 1 if abort. Ref /114
/138	HLP	19-JAN-83	Introduce delays for DPs and LQP02 B4 dequeue
/137				  2.  Reset PRSTTS to 1 if it was 6 or less
/-------------19-JAN-83-------SDC SUBMISSION DECmate-II V1.0.0
/137	HLP	18-JAN-83	V136 Printer Bug THREE fix:
/				  1.  NOP the JMS PRTRID after a B or T
/				  2.  Reset PRSTTS to 1 if it was 2 (user stop)
/				  3.  Don't reset PRSTTS if talking to LQP02
/136	HLP	13-JAN-83	Eliminate extra sheet between sheets on SE YES
/				  continuous form paper to LQPSE or  LQPSE
/135	HLP	11-JAN-83	Fix "wandering footer" with AP yes when a
/				blank line occurs at natural page break
/134	HLP	10-JAN-83	Set PRINTER BUSY at GETDC
/133	HLP	07-JAN-83	If PRSTTS goes from error to busy
/				while printer code is in stop ovly,
/				set it to 2 (user stop)
/132	HLP	31-DEC-82	Patch to set status back to busy
/131	HLP	30-DEC-82	Added dispatch table for resume
/				Make non-existent printer resumable
/130	HLP	29-DEC-82	Add who-are-you at DONE2.  LQPSE won't
/				respond until it is done with the document
/				PRID to reset LQPSE if times out
/129	HLP	22-DEC-82	Fix B and T for LQPSE
/128	HLP	20-DEC-82	Missing ( on a link near OVSTB
/127	HLP	16-DEC-82	Make sure that CLQP01 is called if enter stop
/				 menu with nothing in queue (as from CX) so that
/				 LQPSE is properly reset and will feed paper next
/				 time CX is entered (BUG #273--phase II)
/126	HLP	12-DEC-82	FIX BUG #291:  wide line in CX hangs system
/				 change error code for LQP01 CANCEL to 25
/				 reset LQP01 when this error code occurs
/125	HLP	09-DEC-82	FIX BUG #285:  portion of LQP02 status msg
/				  lost if comes in while loading handler
/124	HLP	08-DEC-82	Replaced setting of TIMOUT at DONE0B
/				  with tabularized setting when enter PRTID
/123	HLP	07-DEC-82	PRTID not to wait after draft printer ID
/				Changed delay after ID from 3 to 1 second
/				so WAITPR routine in WPCUT would not timeout
/122	HLP	06-DEC-82	Fix SE & AP yes bug #270
/121	HLP	02-DEC-82	Changes for selective stop printer menu
/				Change LQPSE ASF error code from 17 to 24
/120	HLP	03-DEC-82	Use a real delay when wait for status in PRTID
/				Change PRTID timer routines to allow other jobs
/				  to be using TIMOUT at the same time
/				  WPSYS now lets TIMOUT count up continually
/119	HLP	29-NOV-82	Delete extra sheet (continuous form)
/				  at end of document
/118	HLP	23-NOV-82	Handle abort from PRWAIT (CX errors, etc.)
/117	HLP	19-NOV-82	Reset PRASF in PRTRID
/116	HLP	19-NOV-82	Dont copy PRLOCK to PRSTTS in SETSTN
/115	HLP	18-NOV-82	Reset LQPSE after printing so CX and print
/				screen will always feed paper
/114	HLP	16-NOV-82	Set back to one hammer strike if dequeue
/				so CX will be guaranteed to print
/113	HLP	16-NOV-82	Reset PRSTTS if abort, create PRSTT3
/112	HLP	03-NOV-82	PRTID not to set PRSTTS to 1 (busy)
/				PRSTTS to 1 when find a doc in queue
/				PRSTTS to 0 when find no doc in queue
/111	HLP	29-OCT-82	Fix Bug #161 STOPPED not removed on
/				  B or T with LPQSE or any DP
/110	HLP	27-OCT-82	Make malfunction a fatal error
/109	HLP	26-OCT-82	Change N command to eject if ASF attached
/108	HLP	22-OCT-82	Fix BUG 121 for LQP02 (P after unfixed ASF err)
/107	HLP	15-OCT-82	Make PRTID give an error if LQP01 does not answer restore
/				Make PRTID reload handler if paused
/				Change PRTID paused error code from 15 to 11
/106	HLP	15-OCT-82	Clear the Handler's print buffer on S-S
/105	HLP	14-OCT-82	Reset PRSTTS and PRSTT2 on S-S
/104	HLP	12-OCT-82	Changed JMS STSTTS to DCA PRSTTS at PSXIT (Bug #125)
/103	HLP	08-OCT-82	Reworked destination table in stop ovly
/				Moved stuff to make more room
/				moved reset of FLASH and BUZZ after action
/				Moved reset of LQP01/ASF error to PRSTL9 again
/				Make P and R responses to LQP01/ASF error illegal
/				Moved PRACTS to page zero
/102	HLP	07-OCT-82	Changed SNA to SNA CLA in stop overlay
/101	HLP	05-OCT-82	Change wrong doc dest error code to 10 from 24
/				  (code 24 gets clobbered by LQP02 no error report)
/100	HLP	04-OCT-82	Move reset LQPSE on ASF error code
/				  (P was hanging system)
/099	HLP	01-OCT-82	Stop-Stop to return to dequeue
/				  (so can cancel if LQP02 paused at boot)
/098	HLP	30-SEP-82	Restore Stop-stop code to join PRSTL7
/				  (LQPSE ASF error S did not reset LQP01)
/097	HLP	28-SEP-82	Fix PRTRID routine--proper exit on
/				  LQP02 paused at PRTRID call
/096	HLP	27-SEP-82	Fix bug SE alternate (again!)
/095	HLP	21-SEP-82	Add code to change document destination
/094	HLP	15-SEP-82	Eliminate blank sheets between docs
/093	HLP	14-SEP-82	Fix bug #XX-Extra sheets fed by S commands
/092	HLP	12-SEP-82	Fix bug #37-SE Alternate
/091	HLP	31-AUG-82	Fix bug--no sheet fed on N from PS menu
/090	HLP	30-AUG-82	Add recovery when connected to wrong printer
/089	HLP	28-AUG-82	Fix hang problem when boot with LSP02 paused
/				 (Bug number 33)
/088	HLP	18-AUG-82	Changes to allow B and T after ASF error
/				 Done ovly waits for LPDNFG while checking PRSTOP
/				 Code added at PRSTL9 to reset LQP01
/				 Code deltd at PRSTL2 to allow ASF errors
/PREVIOUS EDIT HISTORIES (NON HLP) DELETED 09-JAN-83 HLP

/THE FIRST LOCATION IN AN OVERLAY MUST BE THE NEGATIVE OF THE OVERLAY NUMBER

/FOR A FULLER EXPLANATION OF THE OVERLAY SCHEMES, SEE THE COMMENTS WITH
/THE SECTION PROV, IN WPRINT

/OVERLAYS NO LONGER NEED TO BE WRITTEN OUT			/C150
/SEE INITIALIZATION CODE NEAR FLD3L1				/A150


OVADR=0000-400	/BEGINNING ADDRESS FOR OVERLAYS
OVNUM=-1	/BEGINNING OVERLAY NUMBER

OLA=0000
OLB=0400
OLC=1000
OLD=1400
	XLIST

OVTYPE=OLA
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM

/ THIS OVERLAY IS USED ONLY FOR LQPS					/C211

OVJUSL=.-OVRLCA
OBJUSL=OVTYPE+OVNUM

/PLPTR currently addresses the return word in the buffer.  Bit 1 of this word
/is clear for a hard return and is set otherwise.  We save the type of the
/return for later use.

	TAD I	PLPTR		/GET THE LINE ENDING CODE
	AND	(3400)		/MASK BIT WHICH SAY TYPE OF RETURN	/C251
	DCA	PRJRET		/SAVE THE TYPE OF RETURN:
				/	0012 --> 0000 HARD RETURN
				/	1012 --> 1000 PARA MARKER
				/	1412 --> 1400 CENTERED RETURN
				/	2012 --> 2000 SOFT RETURN

	TAD	PRQPIT		/COPY THE PITCH FLAG			/A219
	DCA	PLPFLG		/COPY OF PITCH FLAG			/A219

/Call routine to set LQP02 into proportional print mode if thats what we/A080
/ are printing to and thats what we are printing.			/A080
									/A080
	DCA	PLBOLD	/Reset SP PROPORTIONAL LQP02 flag.		/A086
	JMS	PROV		/ FIRST MAKE SURE PLINIT IS LOADED	/A211
		OBPLIN		/					/A211
	JMS	PLINIT	/If proportional print to LQP02 then set printer/A080

/We now set up some variables in order to process the line.  We want the
/following conditions to hold:

/PLPTR - Points to the return character (this already holds)

/PLCNT - Is the negative of the number of characters, including the return,
/		in the line.

/PLDIR - Is minus one so that processing can proceed from right to left.

PRJL0A,								/A211
	TAD	PLPTR	/Subtract the address of the return, and one more
	CMA
	TAD   (PRLBUF)	/From the address of the first character
	DCA	PLCNT	/And save as the buffer count

	AC7777
	DCA	PLDIR	/Set the direction of printing


/If the line ends with a soft return, we now strip all trailing spaces, tabs,
/and backspaces from the line.  If the line ends with a hard return, we do
/not strip these characters.  We strip in case of soft return because the
/trailing spaces interfere with justification, and should not appear in case
/the line is underlined.  In either case, when the loop is over, the following
/conditions will hold:

/1.  PLPTR will point to the rightmost character of the line which should
/	be printed (which will be a text character in case of a soft return
/	and the one before the return for a hard return).

/2.  PLCNT will be the negative of the number of characters from the beginning
/	of the buffer to the character pointed to by PLPTR.

PRJL0,
	JMS	PLNXT	/Look at the next character
	JMP	PRGSL1	/No more characters so the line was all blank--no
			/need to bother printing the line

	AC2000		/WAS THE RETURN A SOFT RETURN?			/C268
	AND	PRJRET							/C268
	SNA CLA
	JMP	PRJL1	/NO--DON'T STRIP TRAILING SPACES!

	TAD I	PLPTR	/Get the character
	AND	P177	/Strip the mode bits
	TAD	(-SPC)	/Is it a space/tab/backspace?
	SPA SNA CLA
	JMP	PRJL0	/Yes--continue stripping the line


/The line was not blank and must be printed.  We now initialize some variables
/used to gather information about the line for printing and justification.

PRJL1,
	TAD	PLCNT
	DCA	PRLBCT	/Save the size of the line

	DCA	PLPS	/Clear position justification spacing
	DCA	PLSS	/Clear space justification spacing

	AC7777
	DCA	PRJPOS	/Initialize number of inter-position spaces
	DCA	PRJSPC	/Clear number of spaces

	DCA	PRRCH	/Clear right end of line position
	DCA	PRPASS	/Clear the pass counter

	DCA	PRJDEF	/Clear deficiency (no justification required yet)/A080

/This loop gathers information about the spacing and composition of the
/line by processing the characters from left to right.  When the loop
/completes, we will know:

/PRRCH -The length of the justifiable part of the line in print units
/	** NOTE ** This is a different definition than that used in OVJUSD **

/PRJPOS - The number of inter-position spaces in the justifiable portion
/		of the line.

/PRJSPC - The number of spaces in the justifiable portion of the line.

/The loop also marks each character in the justifiable portion of the line
/by setting bit 0 of the character.  The justifiable portion of the line is
/that part which follows the rightmost tab space.

	AC4000		/We first set the count enable flag.  This flag is
	DCA	PRJENB	/to mark justifiable characters and is examined when
			/deciding whether to count them.  It is ultimately
			/cleared when the first tab is encountered.

/At the beginning of each iteration, PLPTR points to the first character in a
/position.  Each iteration treats the entire position with all of its dead
/keys, if any.

PRJL2,
	TAD I	PLPTR	/Get the character
	AND	P177	/Strip the mode bits

	TAD	(-SPC)	/Is it a space?
	SZA CLA
	JMP	PRJL3	/No, a text--jump to treat it

/The character is a space.  If it is part of a tab, the enable flag must be
/cleared.  If the enable flag has not been cleared by this time, we increment
/the number of justifiable spaces and fall through to the text counter.

	TAD I	PLPTR	/Retrieve the space character
	CMA RAL		/AC0=0 if the space is part of a tab, 1 otherwise
	AND	PRJENB	/AC=4000 if counting should still be enabled

	SZA		/Do not count the space if we are disabled
	ISZ	PRJSPC	/Count a space in justifiable part of line
	DCA	PRJENB	/And save the new enable flag

/This section handles characters.  If the enable flag is set, we count the
/position.

PRJL3,
	TAD	PRJENB	/Get the enable flag
	SZA CLA		/IF THE FLAG IS CLEAR WE HAVE ENCOUNTERED	/A243
			/THE RIGHTMOST TAB SPACE. IF IT IS A CENTERING	/A243
			/RETURN STOP COUNTING.  OTHERWISE USE PLNRCS	/A243
	JMP	PRJL3A	/MEASURING IS STILL ENABLED			/A243

/ WE HAVE MEASURED THE JUSTIFIABLE PORTION OF THE LINE
/ WE NOW EXAMINE THE TYPE OF RETURN
/ IF IT IS A CENTERING RETURN WE WILL GOTO THE CENTERING JUSTIFICATION
/ LOGIC DIRECTLY.  IF IT IS A SOFT RETURN AND WE ARE JUSTIFYING
/ MORE TESTS ARE NECESSARY...

/ LQPSE not supported in this version and I needed the space		/d271
/d271	JMS	SKIPIF	/DO THE LQPSE JUSTIFICATION THE WAY WE		/A245
/d271		LQP02	/WE ALWAYS DID -- DON'T ALIGN TABS		/A245
/d271	JMP	PRJL3B	/OR FIX CENTERING				/A245
/ LQPSE not supported in this version and I needed the space		/d271

	TAD	PRJRET		/GET TYPE OF RETURN			/A243
	TAD	(-1400)		/SEE IF CENTERED RETURN			/C251
	SZA CLA			/					/C251
	JMP	PRJL4B		/NOT CENTERING, GO ADD PLNCRS		/C251
/ CENTERING, LQP02 ...

	TAD	(OVCTR2		/GO TO LQP02 CENTERING OVERLAY		/A243
	JMS	PROV		/					/A243
		OBCTR2		/					/A243


PRJL3A,	ISZ	PRJPOS	/Increment the number of inter-position spaces
	NOP		/In case it skips (since it is initialized to -1)

/We now find the width of the position and add it to the measure of the right
/end of the line.

PRJL3B,	JMS	PLSPCX	/Get position width--the width is returned in the AC

PRJL4,									/M239
	TAD	PRRCH	/Update the right end measure
	DCA	PRRCH

PRJL4F,									/a274

/We now enter a sub-loop which moves the buffer pointer to the first
/character of the next position.  It also marks each non-backspace character
/as justifiable or not with the enable flag.  When we reach the next position,
/we continue the main loop.  If we just treated the last position, we leave
/the main loop and continue with processing.

PRJL4C,									/A245
	TAD I	PLPTR	/Get the character
	TAD	PRJENB	/Mark it with the enable flag
	DCA I	PLPTR	/Save the character back into the buffer

	JMS	PLCHBS		/ARE THERE MORE CHARACTERS?
	JMP	PRJL5		/NO, LEAVE THE LOOP
				/ these chars should be filtered out
				/ earlier				/a274
	JMP	PRJL4C	/M274	/ yes , a multinational char		/a271
	JMP	PRJL4C	/M274	/...YES, A TECHNICAL PRECEDENCE		/A233
	JMP	PRJL4C		/...YES, IN THIS POSITION		/C245
	JMP	PRJL2		/YES, IN A NEW POSITION


/ IF WE SEE A TECHNICAL PRECEDENCE CHARACTER WE SUBTRACT THE		/A239
/ WIDTH OF THE TECHNICAL EQUIVALENT, ALREADY READ FROM THE TABLE	/A239
/ AND ADDED IN, SINCE WE ARE PROCESSING THE LINE BACKWARDS, AND		/A239
/ ADD IN THE FIXED AMOUNT OF SPACE ACCORDING TO THE PITCH		/A239

PRJL4A,	TAD	PLWIDT		/ get width of tech char		/a239
	CIA			/subtract it off			/a239
				/ and fall thru to  ADD IN  WIDTH	/a239
PRJL4D,	JMP	PRJL3B		/GO ADD IT IN		/M274		/A239
PRJL4B,	TAD	PLNRCS		/ GET CHAR WIDTH (VAI)			/A239
	JMP	PRJL4		/ GO ADD IT IN				/A239

PRJL5,
/We now determine whether or not justification is necessary.  We do not
/justify the line if one of the following conditions holds:

/1.  The line is not terminated with a soft return
/	and the line is naturally shorter than the right margin
/2.  There are no justifiable positions (PRJPOS=0).
/3.  The ruler does not require justification (PRRM=0).

/If the line is not to be justified, we simply continue with printing
/the line.

	AC2000			/ LOAD MASK FOR SOFT RETURN		/A251
	AND	PRJRET		/ IS THE RETURN A SOFT RETURN?
	SZA CLA			/ SKIP IF NOT SOFT RETURN
	JMP	PRJL5A		/ IF SOFT RETURN GO CHECK FURTHER
	TAD	PRRM		/ GET RULER RIGHT MARGIN (OR 0)
				/ USE 13 BIT ARITHMETIC FOR WIDE TRACK	/A248
	CMA CLL			/ COMPUTE WHETHER LINE IS OUTSIDE OF	/C248
	TAD	PRRCH		/ RULER
	SNL CLA			/ IF OUTSIDE RULER CONTINUE CHECKING	/C248
	JMP	PRJL9A		/ OTHERWISE JUST PRINT LINE
				/ -- NO JUSTIFICATION NEEDED


PRJL5A,			/ CONTINUE WITH JUSTIFICATION CHECKS	/C217

	TAD	PRJPOS	/Are there any justifiable positions?
	SPA SNA CLA
	JMP	PRJL9A	/No--proceed with printing the line

	TAD	PRRM	/Does the ruler specify justification?
	SNA
	JMP	PRJL9A	/No--proceed with printing the line

/We now determine how justification is to be done.  Justification is done by
/increasing or decreasing inter-position and space sizes.  The options, in
/their order of consideration, are:

/1.  The line is longer than its desired length.
/	Position spacing is decreased in decrements of one until the resulting
/	line length is less than or equal to the justified length.  We then
/	consider the other options.

/2.  The line is equal to its justified length.
/	We need do no more and continue with printing the line.

/If we reach this point in the option list, the line is shorter than its
/desired length.

/3.  There are no justifiable spaces.
/	Justification is effected solely by increasing the size of
/	inter-position spacing.

/4.  Each justifiable space can be doubled in size.
/	Justification is effected solely by increasing the size of spaces.
/	This is done because the line is grossly out of justification.

/5.  Each position width can be increased by one unit.
/	This is done. if the line is too short we continue
/	with option 6

/6.  Justification remains to be done
/	justification is effected soley by increasing the size of spaces

/ The ammount by which each inter position space is to be increased is
/indicated in PLPS; the ammount by which each space is to be increased is
/indicated in PLSS. Note that the numbers do not always come
/out even, and some spaces must be increased by one unit more than others.
/The positions or spaces suceptible to this increase are indicated by
/setting bit one of the corresponding character

/PRRM, which is in the ac is the desired right margin.

	CIA		/ subtract the desired line length
	TAD 	PRRCH	/ from the current line length

/This loop shrinks the line by decreasing inter-position spacing until either
/the line is too short or just right.  It then jumps to treat the right case.
/As each iteration begins, the AC contains the negative of the deficiency of
/the line.  The AC is positive if the line is too long, negative if it is too
/short, and zero if it is just right.

PRJL6,
	DCA	PRJDEF	/Save the negative of the deficiency

	TAD	PRRM	/Use the desired right margin
	DCA	PRRCH	/To set the current right margin

	TAD	PRJDEF	/Restore the deficiency--what is its sign?
	SNA
	JMP	PRJL9A	/The deficiency is zero--print the line
	SPA CLA
	JMP	PRJL7	/The line must be lengthed--leave the loop

/The line is too long.  We decrease inter-position size by one unit and try
/again.

	AC7777		/Decrease inter-position spacing by one unit
	TAD	PLPS
	DCA	PLPS

	TAD	PRJPOS	/Subtract one unit for each inter-position space
	CIA
	TAD	PRJDEF	/From the deficiency
	JMP	PRJL6	/And keep shrinking the line
/--------------
	PAGE

PRJL7,

/The line must be lengthed, and the amount by which is must be stretched is
/stored in PRJDEF.  We now determine which of the remaining options must be
/used.
	TAD	PLNRCS	/Get the character size into the AC
	JMS	PRMULT	/Determine units occupied by justifiable spaces
		PRJSPC

	SZA		/Are there indeed any justifiable spaces?
	JMP	PRJL8	/Yes--jump to choose between options 4, 5, and 6

/Option 3 holds--there are no justifiable spaces.  We divide the deficiency
/between the positions.

	TAD	PRJPOS	/Get the number of justifiable inter-position spaces
	JMS	PRDVID	/Divide the deficiency between them
	TAD	PLPS	/Update the amount of increased position spacing
	DCA	PLPS	/						/C268
	JMP	PRJL9A	/Continue with marking the line

/Now the amount of increased position spacing is set, and the number of left
/over units is recorded in PRJDEF.  We continue by marking those positions
/which must be sized one unit larger.



/There are justifiable spaces.  The AC now contains the number of units
/occupied by these spaces.  We first check whether option 4 holds.

PRJL8,
	TAD	PRJDEF	/Add in the negative of the deficiency.  If the AC
			/is still negative or zero, we know that the line is
			/grossly out of justification and justify it by
			/increasing space sizes.
	SPA SNA CLA
	JMP	PRJL9	/Option 4 holds--jump to implement it

/We now determine if option 5 or 6 holds.  We see what would happen if we
/increased each inter-position space by one unit.

	TAD	PRJPOS	/Get the number of positions
	TAD	PRJDEF	/Add to the negative of the deficiency
	SMA SZA
	JMP	PRJL9	/Since the AC is now positive, it would be too much to
			/increase each inter-position space by one unit.
			/Hence, option 6 holds and we jump to implement it.

/By elimination, option 5 holds.  The AC now contains the negative of the
/deficiency which the line will have when inter-position size is increased by
/one unit.

	DCA	PRJDEF	/Save the new deficiency
	ISZ	PLPS	/Increase inter-position spacing.  Although this
			/instruction could skip, it would only skip the "CLA,"
			/which is unnecessary for this branch.

/Any remaining justification must be done by increasing space sizing.

PRJL9,
	CLA

	TAD	PRJSPC	/Get the number of spaces
	JMS	PRDVID	/Divide the deficiency among the spaces
	DCA	PLSS	/Record space sizing

PRJL9A,

/DECIDE WHICH TYPE B LQP02 OVERLAY TO CALL
/ If all filler parameters (PRJDEF, PLPS, PLSS) are all zero then that
/ means that no extra filler will be added so we call the JL20 overlay.
/ If the intercharacter spacing is negative (meaning to squish the
/ characters together) or the enable flag is cleared (meaning that
/ justification is no longer enabled at the begining of the line,
/ (this flag gets cleared when a "soft space" is seen, among other
/ things) then we take the skip return for "squish-line" JL30	
/ processing.  If both the intercharacter spacing (PLPS) is positive
/ (greater than or equal to 0) and the justification flag is still set
/ (PRJENB  = 4000) then take the 1st return for "expand-line" JL20
/ justification.

	TAD	PRJDEF		/ Check the filler parameters.	
	SNA;TAD PLPS		/  if all of them are 0 then it is safe
	SNA;TAD PLSS		/  to call the JL20 overlay (null expand
	SNA CLA			/ skip if not certain yet.	
	JMP	PRJL9B		/ Return to take the JL20 overlay.

	JMS	SKIPIF		/ if an LQP02 then 			/a273
	LQP03			/skip if LQP03				/a273
	JMP	PRJL9B+1	/ return to take the JL30 overlay	/a273

	TAD	PLPS		/ Get intercharacter spacing.	
	CMA			/ complement the 4000 bit.	
	AND	PRJENB		/  and AND it with the justification bi
	SPA CLA			/					/C227
	JMP	PRJL9B		/ SPACE WARS				/A243
	JMP	PRJL9B+1	/ SPACE WARS+1				/A243


/When this routine is called, the buffer variables point to a position.  The
/routine returns the spacing needed after the position is prined.  If this is
/the last position in the line, that width is zero.  Otherwise, the width
/is half the width of this position plus half the width of the next position,
/plus any extra spacing needed for justificatin.

/The width of the position is returned in PLPOS.  The buffer variables,
/although they change during execution, are restored before return.


PLSPC,	
	XX

/PLCNT and PLPTR are changed in the subroutine PLWIDE.  They are saved here
/and restored before return.
	TAD	PLCNT	/Save the character count
	DCA	PLCNT1

	TAD	PLPTR	/And the buffer pointer
	DCA	PLPTR1

/PLWIDE returns the width of the current position (PLWIDT), and bumps the
/buffer pointer to point to the next position.  It makes a normal return if
/the current position is the last position; otherwise, it makes a skip return.
	
	JMS	PLWIDE	/Get the width of the current position
	JMP	PLSPC1	/This is the last position--return zero
	TAD	PLWIDT	/Get the width
	DCA	PLPOS	/And save it

/Before getting the width of the next position, we record the pointer to it
/so that we can examine some pertinent bits there later.

	TAD	PLPTR	/Save the buffer pointer
	DCA	PLPTR2

	JMS	PLWIDE	/Get the width of the next position
	NOP		/We don't care whether this is the last position

	TAD	PLWIDT	/Get the width
	TAD	PLPOS	/Add the widths of the two positions
	CLL RAR		/Average them
	DCA	PLPOS	/And save the width

/We now consider extra spacing requirements. If we are shadow-printing	/A086
/proportional print (PLBOLD=200) then we add an extra print unit to the	/A086
/position size if this char is bolded.					/A086

/We also consider extra spacing due to justification.  The high bit of a
/character is set if it is justifiable, the next bit is set if an extra unit
/is needed.  We do not justify unless the current and the next positions are
/both justifiable.

	TAD I	PLPTR1	/Get the current position
	AND	PLBOLD	/See if SP bolding.				/A086
	SZA CLA		/skip if no.					/A086
	ISZ	PLPOS	/1 more print unit for shadowed theme characters/A086
	TAD I	PLPTR1	/Get the current position			/A086
	AND I	PLPTR2	/And the next one
	SMA CLA		/Are we at a justifiable position?
	JMP	PLSPC2	/No--perform no justification

/If we are printing to the right, we add an extra unit of justification if
/the current position is marked to that effect.  If we are printing to the
/left, we add an extra unit of justification if the next position is marked
/to that effect.  The important bit is bit 1.  All of this is done so that
/lines will print the same regardless of direction; in this way, superscripts,
/underlines, normal text, and subscripts will all line up.

	TAD	PLDIR	/Which direction are we printing in?
	SMA CLA
	TAD I	PLPTR1	/To the right--check the current position
	SNA
	TAD I	PLPTR2	/To the left--check the next position

	RAL		/Get the extra unit bit into AC0
	SPA		/Do we need extra justification?
	ISZ	PLPOS	/Yes--add it in

/If the character is a space, we use extra space sizing.  In any case, we use
/extra position sizing.  Again, we are interested in examining the current
/position if we are printing to the right; the next position if we are
/printing to the left.

	RAR		/Restore the character
	AND	P177	/Strip the mode bits
	TAD	(-SPC)	/Is it a space?
	SNA CLA

	TAD	PLSS	/Yes--add extra space sizing
	TAD	PLPS	/Add extra position sizing
	TAD	PLPOS	/Add to the previously calculated position size


/The width of the current position is now in PLPOS.  Restore the buffer
/variables and return.

PLSPC1,
	DCA	PLPOS	/Save the position size

PLSPC2,
	TAD	PLCNT1	/Restore the character count
	DCA	PLCNT

	TAD	PLPTR1	/And the buffer pointer
	DCA	PLPTR

	JMP I	PLSPC	/And return


PLCNT1,	0	/Used to store the character count upon call

PLPTR1,	0	/The buffer pointer to the current position
/THE FOLLOWING TEMP IS SHARED WITH THE PLREST SUBROUTINE RETURN ADDRESS
/FOR SPACE SAVINGS PURPOSES.  THIS SHOULD BE OK AS PLREST IS AN INITIALIZATION
/ROUTINE AND SHOULD NOT BE IN USE THE SAME TIME THAT PLSPC IS IN USE...BUT
/LET THE READER BEWARE OF THIS POTENTIAL TIME BOMB...HLP/A268
PLPTR2,		/The buffer pointer to the next position


PLREST,	XX

	DCA	PLDIR	/Save the direction of printing

	TAD	PRLBCT	/Get the saved buffer count
	DCA	PLCNT	/And restore it

/(PRLBUF) is the address of the first location in the buffer; PLCNT is the
/negative of the number of characters in it.  Therefore, if we negate PLCNT,
/subtract one from the result, and add to (PRLBUF), we have the address of
/the last location of the buffer.  PLPTR is supposed to point to the first
/buffer address to be printed, which is the first or last depending on the
/direction of printing.

	TAD	PLDIR	/Get the direction of printing
	SMA CLA		/Are we printing right-to-left?
	JMP	PLRES1	/No--jump for this condition

	TAD	PLCNT	/Yes--get the negative of the number of
			/characters in the buffer
	CMA

/At this point, the AC=0 if we are printing left-to-right, and is equal to
/the offset from the first character of the last character otherwise.  By
/adding this value to the first buffer address, we derive the desired
/value for PLPTR.

PLRES1,
	TAD   (PRLBUF)	/Add the first buffer address
	DCA	PLPTR	/Save as the pointer into the buffer

	JMP I	PLREST	/And return

PLSPCX,	XX			/ RETURN ADDRESS			/A080
	TAD	PLPTR		/ Save the character pointers.		/A080
	DCA	PLSPX1		/  for when we return.			/A080
	TAD	PLCNT		/ Save also the character count.	/A080
	DCA	PLSPX2		/  ...					/A080
	JMS	PLWIDE		/ Get width of current posn.		/A080
	NOP			/ Dont care if this is the last posn.	/A080
	TAD	PLSPX2		/ Restore the character count.		/A080
	DCA	PLCNT		/  ...					/A080
	TAD	PLSPX1		/ Also restore the character pointer.	/A080
	DCA	PLPTR		/  ...					/A080
/									/A086
/If this posn is bolded (@PLPTR 200 bit is set) and we are printing	/A086
/shadowed theme (PLBOLD=200) then add an extra print unit to posn width	/A086
/									/A086
	TAD I	PLPTR		/ get current character.		/A086
	AND	PLBOLD		/ see if supposed to add an xtra p.u.	/A086
	SZA CLA			/ Skip if not supposed to up the size.	/A086
	AC0001			/ 1 more for the proportional shadow.	/A086
	TAD	PLWIDT		/ Return the posn width in the AC.	/A080
	JMP I	PLSPCX		/ Return to caller.			/A080
									/A080
PLSPX1,	0			/ Temps for save across the call to	/A080
PLSPX2,	0			/   PLWIDE since it destroys them.	/A080
/---------------
	PAGE

OVTYPE=OLB
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM


/At this point, all of the branches for the various options converge if
/justification was indeed necessary.  PLSS and PLPS have been properly set,
/and PRJDEF now contains the negative of the number of inter-positions or
/spaces which must be increased by one more unit.  We now mark such characters
/by setting their bit 1.

OVJL10=.-OVRLCA		/LQP01 JUSTIFICATION LOGIC.			/A080
OBJL10=OVTYPE+OVNUM

/Now adjust the right margin to the start of the last character posn.	/A080
/It is currently set to the end of the last char posn. and we will	/A080
/ move the print head the width of all posns plus all added xtra 'cept	/A080
/ half the 1st char width and half the last char width. so now we	/A080
/ adjust the right margin by half the width of the 1st and last posns.	/A080

/ We also adjust the left margin by half the width of the 1st character	/A080
/ to cause proportional characters to have a smooth left margin.	/A080

	AC0001		/ Compute the width of the 1st character posn.	/A080
	JMS	PLRRCH	/   ...						/A080
	DCA	PLRTSZ	/ Save size of half of right margin character.	/A080
	AC7777		/  and half the width of the last character	/A080
	JMS	PLRRCH	/   position					/A080
	CIA		/ Decrement it from the right margin (for when	/A080
	TAD	PRRCH	/  we are printing right to left).		/A080
	DCA	PRRCH	/ update.					/A080
	TAD	PRJDEF	/ Do we need to justify (more)?			/A080
	SNA CLA		/ Skip if yes.					/A080
	JMP	P1LINE	/ Go print the line.				/A080
	AC7777
	JMS	PLREST	/Restore the buffer variables (PLPTR and PLCNT)

/We do not want to mark the last position in the line as extra justifiable,
/since the information in that line is ignored.  Hence, we enter the following
/loop in the right place to ignore the first position.

/We have decided that the current position must not be marked.  Find the next
/position.

PRJL11,
	JMS	PLCHBS	/Is there another character?
	JMP	P1LINE	/No--print the line
	JMP	PRJL11	/A Multinational char				/a271
	JMP	PRJL11	/A TECHNICAL PRECEDENCE CHR			/A233
	JMP	PRJL11	/Yes, in this position--find the next position
			/Fall through if yes in a new position...

/Now, we decide if the current position should be marked.  If there are no
/justifiable spaces, then we mark all positions; otherwise, we mark only
/spaces.

PRJL12,
	TAD	PRJSPC	/Are there any justifiable spaces?
	SZA CLA		/Skip if there are not
	TAD I	PLPTR	/Get the current character
	AND	P177	/And strip the mode bits

/At this point, the AC=0 if all positions are to be marked, and contains the
/current character is only spaces are to be marked.  When we subtract the
/space value, the AC will be zero or negative only if the current position
/should be marked.

	TAD	(-SPC)	/Subtract the space value
	SMA SZA CLA	/Skip if the position should be marked
	JMP	PRJL11	/Don't mark this position--find the next one

/Now, we mark the position unless we have run out of positions which should
/be marked.

	ISZ	PRJDEF	/Are any more positions to be marked?
	JMP	PRJL13	/Yes--mark them
	JMP	P1LINE	/No--jump to print the line

/We have decided to mark all the characters in the current position.

PRJL13,
	AC2000		/Set the marking bit
	TAD I	PLPTR	/And mark the position
	DCA I	PLPTR

PRJL14,	JMS	PLCHBS	/Any more characters?
	JMP	P1LINE	/No--continue by printing the line
	JMP	PRJL14	/YES, A Multinational PRECEDENCE CHR		/a271
	JMP	PRJL14	/YES, A TECHNICAL PRECEDENCE CHR		/A233
	JMP	PRJL13	/Yes, in this position--continue marking them
	JMP	PRJL12	/Yes, in a new position--jump to treat them	

/All necessary justification calculations have been performed and printing
/may commence.  This loop is iterated once for each pass through the line.
/There are four passes in all.

PRLIN0,

/At this point, the link is set if a half-line of spacing must be done.

	SZL		/Skip if spacing is not needed
	TAD	(PRNHL)	/Get a half-line of spacing
	JMS	PRMOVE	/Transmit the move

	ISZ	PRPASS	/Increment the pass and continue with the next
			/iteration

P1LINE,

/We now decide which direction to print in.  PRCCH contains the position
/of the print head, and we want to start at the end of the line it is
/closest to.  We assume that the left end of the line is zero.  Although this
/may not always be true (due to leading spaces or tabs) the approximation is
/a small price to pay for the space savings it yields.

	TAD	PRRCH	/Get the location of the right end of the line
	CLL RAR		/Divide by two to find the middle
	CIA		/Negate in order to
	TAD	PRCCH	/compare with the current head position
	SMA CLA

/We skip if we are closer to the right margin and wish to print to the
/right.

	AC7776		/ Fall thru to set AC to -1.
	IAC		/ Set AC to +1 or -1 depending upon print direction.


/At this point, the AC=+1 if we are printing to the right; AC=-1 if we
/are printing to the left.

	JMS	PLREST	/ Set buffer variables.

/Now set the print margin to PRRCH if printing right to left or to	/A080
/ PLRTSZ if printing left to right.					/A080
/									/A080
	TAD	PLDIR	/ Get print direction.				/A080
	SPA CLA		/ Skip if printing left to right.		/A080
	TAD	PRRCH	/ Get right print margin.			/A080
	SNA		/ Skip if print margin already computed.	/A080
	TAD	PLRTSZ	/ Get left print margin.			/A080
	JMS	PRESCS	/Transmit the move
		PCMRT
	DCA	PRCCH	/And save as the new head position

/This loop handles printing the line.  One iteration is performed for each
/position.  The loop as a whole is entered once for each pass.

PRLIN1,

/Determine the spacing which will follow printing this position.  The result,
/which includes spacing due to justification, is stored in PLPOS.

	JMS	PLSPC	/Get the spacing

/We now enter an inner loop which prints all of the characters in the
/position.

PRLIN2,

/First, we process the mode bits.  If the character is not to be printed
/during this pass, the regular return is made; otherwise, the skip return.

	TAD I	PLPTR	/Get the character
	AND	(1600)	/Isolate the mode bits
	JMS	PRLMOD	/Process the mode bits
	JMP	PRLIN5	/Wrong pass for this character--don't print it

/Now, we set the spacing which will occur after this character is printed.
/This is performed within the inner loop, instead of once for the entire
/position, because there is no need to set spacing for characters which are
/not even printed.  Also, the routine which sets up the size updates the
/head position as if the motion had already occurred, which it shortly will.

	TAD	PLPOS	/Get character size and update head position
	JMS	PRLSCS	/Set spacing and update the head position

/We now check if the current character is one for which substitution must be
/made.  The values in PRQSB1 and PRQSB2 have been preprocessed so that this
/testing works.

	JMS	PRTST	/Call code in overflow area.			/M080

/We have dealt with the character by either printing it or ignoring it because
/it is currently the wrong pass.  We now look for the next character of this
/position.  There are three possibilities:

/1.  There are no more characters in the line--leave the main loop and begin
/	another pass if necessary

/2.  There are no more characters in the position--leave this inner loop
/	and iterate the main loop for another position

/3.  There is another character in this position--set things so a backspace
/	will be performed during the next mode bit processing and continue
/	in the inner loop.

PRLIN5,
	JMS	PLCHBS	/Are there more characters?
	JMP	PRLIN6	/No--wrap up this pass
	JMP	PRLMN5	/YES,	a MULTINATIONAL precedence char		/a271
	JMP	PRLIN5	/YES, A TECHNICAL PRECEDENCE CHR		/A233
	JMP	PRLIN7	/Yes, in this position.  Jump out of line to deal
			/with the backspace.  The code jumps back in line
			/to PRLIN2.
	JMP	PRLIN1	/Yes, in a new position--deal with the next position

/We have completed the pass.  Finish up the loose ends and determine
/whether another pass is needed.

PRLIN6,
	AC7777		/Force the mode routine to reset and complete
	JMS	PRLMOD	/any pending underlining

	DCA	PLASPC	/Clear accumulated, unperformed spacing.  It is not
			/necessary to clear immediate saved spacing because
			/it was cleared as a side effect of mode restoration.

	TAD	(CR)	/Transmit a carriage return
	JMS	PRCHAR

/We now must decide whether to do inter-line spacing and whether to do
/another pass.

	TAD	PRPASS	/Get the current pass number
	CLL RAR		/Encode it
	CML

/At this point, the passes are encoded as:

/1. Superscript		AC=0, LINK=1	Spacing needed
/2. Underline		AC=0, LINK=0	No spacing needed
/3. Normal		AC=1, LINK=1	Spacing needed
/4. Subscript		AC=1, LINK=0	No spacing needed

	SNA SZL CLA	/This skips if we were on the last pass
	JMP	PRLIN0	/Do another pass--processing finished at top of loop
	JMP	PRGSPC	/The line is completed--continue with spacing routine

/This code is out of line from the line printing routine on a previous
/page.  When it is invoked, a backspace has just been discovered.  The current
/character size is subtracted from the most recently saved character spacing.
/This has the effect of cancelling out the head motion associated with the
/last character printed.

PRLIN7,
	TAD	PLPOS	/Get the current character size
	CIA
	TAD	PLOLNC	/Subtract from the most recent character spacing
	DCA	PLOLNC	/And save it

	JMP	PRLIN2	/Continue in-line with the inner loop

/This routine expects the size of the next position to be printed in the AC
/upon invocation.  This size is always positive.  After putting the proper
/sign on the spacing, it transmits the size if it has changed since the last
/invocation of PRLSCS.  It also updates the current head position.


PRLSCS,	
	XX

	JMS	PRMULT	/Multiply by the sign of the pass
		PLDIR
	DCA	T1	/And save the spacing

	TAD	T1	/Recover the position size
	TAD	PRCCH	/Add to the head position
	DCA	PRCCH

	TAD	T1	/Recover the position size
	CIA
	TAD	PRLST1	/Compare with the last transmitted size
	SNA CLA
	JMP I	PRLSCS	/No change--return

	TAD	T1	/Recover the position size

/Both text and space sizes must be set since we don't know whether we're
/dealing with a text or a space.

	JMS	PRESCS	/Set text size
		PCCSIZ

	JMS	PRESCS	/Set space size
		PCWSIZ

	DCA	PRLST1	/Save as the last transmitted size
	JMP I	PRLSCS	/And return

/we have found a mulktinational precedence char character in the buffer
/ just remind PRTST to deal with it when we find the real char

PRLMN5,	AC7777		/ set flag to -1				/a271
	DCA	MNCFLG	/ flag kept in page zero			/a271
	JMP	PRLIN5	/ jump back to get the multinat char		/a271

PRLST1,	-1			/ LAST TRANSMITTED SPACE SIZE
PLRTSZ,	0	/ Save for 1/2 size of 1st character posn.		/A080
/---------------
	PAGE

/PRLMOD processes the mode bits which are passed to it in the AC upon
/invocation.  It makes a normal return if the mode bits indicate that the
/character should not print during this pass, and makes a skip return
/otherwise.  The mode bits considered by this routine are in AC2,3,4 at the
/time of call:

/AC 2 3
/   0 0		print normally
/   0 1		print with underscore
/   1 0		print superscripted
/   1 1		print subscripted

/AC 4
/   0		not boldface
/   1		boldface


PRLMOD,
	XX

/It is not necessary to give the mode bits the full treatment each time--we
/need only do that every time they change.  The location PRLSWT is patched
/with a jump to the section of the routine appropriate for the mode bits
/should they not change.  First, we determine whether the mode bits have
/indeed changed.  We take the patched jump if they haven't; otherwise, we
/give them the full treatment.

/Notice that if we are called with AC=7777, this will be treated as a new
/set of bits which don't belong to any pass.  The net effect is to complete
/any pending underlining and reset some variables.  This trick is used when
/finishing a pass and wishing to reset for the next one.

	CIA		/Negate the mode bits
	TAD	PRLMDB	/Compare with the old ones
	SNA

PRLSWT,
	XX		/The mode bits haven't changed since last time, so
			/we can take this jump which was patched with a jump
			/to the section appropriate to this type of bits.

/The mode bits have changed.  We recover the new bits, save them, and proceed
/to deal with them.

	CIA		/Recover the new bits
	TAD	PRLMDB
	DCA	PRLMDB	/And save them

/If the underline flag is set, we invoke PRUNDL to perform accumulated
/underlining.  Notice that the net effect is that underlining is performed
/in spurts when the mode changes.

	TAD	PRUFLG	/Check the underlining flag
	SZA CLA
	JMS	PRUNDL	/Do underlining if necessary
	DCA	PRUFLG	/Clear the flag

/Now, we determine whether or not the current character belongs to this pass.
/We branch accordingly.

	TAD	PRLMDB	/Get the mode bits
	CLL BSW		/And move them into the lower two bits of the AC
	RTR
	TAD	(-2)	/After these manipulations...
	SMA SZA
	AC7775

/...the AC has the following values...

/AC=0		superscript
/AC=-1		underline
/AC=-2		normal
/AC=-3		subscript

/...while PRPASS, which identifies the current pass, has these values...

/PRPASS=0	superscript
/PRPASS=1	underline
/PRPASS=2	normal
/PRPASS=3	subscript

/...so we need only compare the two values.

	TAD	PRPASS	/Are we in the right pass?
	SZA CLA
	JMP	PRLMO4	/No--jump to handle it

/We are in the right pass.  The first we must do is set the hit count.  We
/begin by putting the bold bit into the link.

	TAD	PRLMDB	/Get the mode bits
	BSW		/And put the bold bit into the link
	RTR
	CLA

/We must concern ourselves with three values:
/1.  The bold bit (now in the link)
/2.  The two wheel flag (PRQ2W)
/3.  The darkness value (PRQOVP)

/If two-wheel printing is specified, the bold bit takes on a different
/significance.

	TAD	PRQ2W	/Get the two wheel flag
	SNA		/If AC=0, no two-wheel
	JMP	PRLMO1	/Jump to handle regular printing

/This section deals with two-wheel printing.
/If PRQ2W is negative, this is the first pass.  Only non-bold text is printed,
/	with a hit count equal to the darkness value.
/If PRQ2W is positive, this is the second pass.  Only bold text is printed,
/	with a hit count equal to the darkness value.
/If text is not to be printed, the hit count is set negative.

	SMA CLA

/If this is the first pass, the skip occurs.  In this pass, we want to print
/only the non-bold text; i.e., print only if the link is clear.  If this is
/the second pass, the skip does not occur.  In thispass, we want to print
/only the bold text; i.e., print only if the link is set.

/Now, if this is the second pass and we complement the link, we will want to
/print then only if the link is clear and the two cases become identical.
	
	CML		/Second pass--complement the link and the two cases
			/become identical.

/Now we print only if the link is clear.

	SZL		/Skip if we need to print during this two-wheel pass
	AC7777		/Otherwise, get a -1 into the AC
	CLL

/At this point, we rejoin the code for the non-wheel case.  The possibilities
/are as follows:

/1.  Not two wheel, not bold:  AC=0, LINK=0
/2.  Not two-wheel, bold:      AC=0, LINK=1
/3.  Two-wheel, printing       AC=0, LINK=0
/4.  Two-wheel, not printing:  AC=-1,LINK=0

/So, after performing an RAL, we have the following corresponding cases:

/1.  Not two-wheel, not bold:  AC=0
/2.  Not two-wheel, bold:      AC=1
/3.  Two-wheel, printing:      AC=0
/4.  Two-wheel, not printing:  AC=-2

/Upon adding the darkness, we will have the proper hit count for each case.

PRLMO1,
	RAL		/Get the hit count				/M019
	TAD	PRQOVP	/Add in the darkness value

	JMS	PRESCS	/And send it
		PCBOLD
		CLA

/This is the point to which the routine branches if the mode bits haven't
/changed and the last mode bits indicated the character belonged to the
/current pass.  The first thing which is always done for the proper pass
/is to perform any spacing which has accumulated while characters which were
/not in this pass were printing.  There are several things to note about
/the variables which record this motion:

/PLOLNC is the amount that accumulated on the last character only.  It is
/	kept separate because these accumualted spacing variables are used
/	in underlining also, and when underlining we do not want to underline
/	the most recent character.

/PLASPC is the amount that has accumulated on all previous characters.

/When a backspace is encountered, the current position size PLPOS is
/	subtracted from PLOLNC.  If we were in the wrong pass, it is as if
/	no spacing had ever been included in PLOLNC; if we are in the wrong
/	pass, a backspace is performed the next time this section is reached.

/This branch is not used for characters which belong to the underlining pass;
/	rather, the spacing is allowed to accumulate and it is performed all
/	at once when an underline is produced.

PRLMO2,
	TAD	PLOLNC	/We want to move this distance in addition to the
			/distance in PLASPC which PLHMOV will perform
			/automatically
	JMS	PLHMOV	/Do the spacing
	DCA	PLOLNC	/PLHMOV clears PLASPC automatically; we also want
			/to clear this value to indicate the motion has
			/been performed

/As noted above, if we are printing the underline pass, we make believe we
/are not printing and merely accumulate space.  When the mode changes again,
/the underlining will be performed as above.

	AC7777
	TAD	PRPASS	/Are we printing the underline pass?
	SNA CLA
	JMP	PRLMO3	/Yes--jump to treat it

/We must print a character during this pass.  A skip return is called for.

	ISZ	PRLMOD	/Prepare a skip return
	TAD	(S1-S2)	/Set the switch so that until the mode changes,
			/characters will be treated as they deserve to
			/be printed
	JMP	PRLMO6	/Jump to set the switch and return

/This point is reached if the mode bits just changed and underlining was
/enabled.  We set the flag to indicate underline is in progress.  The next
/time the mode changes, the underlining routine will underline the space
/which has accumulated since this time.

PRLMO3,
	AC7777
	DCA	PRUFLG	/Set the flag to indicate underlining in progress


/This is the section to which characters of the wrong mode and underlined
/characters (during the underline pass) are directed.

PRLMO4,

/If the underline flag is set, this is the underline pass and the current
/character is in underline mode.  We therefore clear the mode bits of
/the character so it will be print in the next (regular) pass as well.

	TAD	PRUFLG	/Get the underline flag
	SNA CLA
	JMP	PRLMO5	/Not underlining--don't fool with the mode bits

	TAD I	PLPTR	/Get the character
	AND	(6377)	/Clear the pass-significant mode bits
	DCA I	PLPTR	/And replace it in the buffer

/The spacing occupied by this character is updated.  Finally, we set the
/switch for succeeding characters of the same mode and make a regular return.

PRLMO5,
	TAD	PLOLNC	/Add the spacing of the last character
	TAD	PLASPC	/To the accumulated, unperformed spacing
	DCA	PLASPC	/And save it away

	TAD	PLPOS	/Save the current position spacing
	DCA	PLOLNC	/As the spacing of the last character

PRLMO6,
	TAD	(S2)	/Set the switching value
	DCA	PRLSWT
	JMP I	PRLMOD	/And return


PRLMDB,	-1	/The mode bits of the last character are recorded here.
		/After each pass they are set to -1 to force reconsideration
		/at the beginning of each new pass.

		/mode for printing during the current pass.


PRUFLG,	0	/The underline flag--it is non-zero if underlining is
		/in progress; zero otherwise.


S1=JMP PRLMO2	/The switch value to direct unchanged-mode characters which
		/are in the correct pass

S2=JMP PRLMO4	/The switch value to direct unchanged-mode characters which
		/are in the wrong pass



/This routine performs horizontal motion.  It adds the amount of motion
/in the AC to the amount in PLASPC (accumulated, unperformed horizontal
/motion), places the correct sign on them, performs the move, updates PRCCH
/(the head position) and clears PLASPC.

PLHMOV,
	XX

	TAD	PLASPC	/Add accumulated space to the amount in the AC
	MQL		/And save it

	TAD	PLDIR	/Get the direction of printing
	RAL		/Save the sign of the motion in the LINK
	ACL		/Recover the amount of motion
	SZL
	CIA		/Negate if motion to the left
	
	SZA		/Transmit motion only if non-zero
	JMS	PRESCS
		PCMRT	/If the skip is taken, this instruction will only	
			/be a harmless AND

	TAD	PRCCH	/Update head position
	DCA	PRCCH
	DCA	PLASPC	/Clear accumulated motion
	JMP I	PLHMOV	/And return


ACL=7701	/An instruction to load the MQ into the AC.  The assembler
		/doesn't know about it for some reason.

/The following routine returns half the position size of the 1st or	/A080
/ last posn in the line. it is called with AC=1 for 1st and 		/A080
/ AC=7777 for last.							/A080

PLRRCH,	XX		/ Entry point.					/A080
	JMS	PLREST	/ Set buffer pointers.				/A080
	JMS	PLWIDE	/ Get character width.				/A080
	NOP		/ dont care if no more in the line.		/A080
	TAD	PLWIDT	/ Get character width.				/A080
	CLL RAR		/ divide by 2.					/A080
	JMP I	PLRRCH	/ return to caller.				/A080
/---------------
	PAGE

OVTYPE=OLB
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM


/***********************************************************************/
/									/
/	OV2L10--LQP02/03 NORMAL JUSTIFICATION OVERLAY			/
/		USED WHEN THERE IS NO JUSTIFICATION NEEDED		/
/		OR WHEN JUSTIFICATION CAN BE ACCOMPLISHED USING		/
/		THE JUSTIFICATION COMMAND DECFIL, WHICH ONLY		/
/		ALLOWS FOR EXPANDING THE LINE.  IF THE LINE NEEDS TO	/
/		BE SQUISHED, WE WILL USE OV3L10.			/
/									/
/***********************************************************************/

OV2L10=.-OVRLCA			/ LQP02 "EXPAND-LINE" JUSTIFICATION LOGIC/A080
OB2L10=OVTYPE+OVNUM
IFNZRO OV2L10-OVJL10 <TEMPLATE ERROR>					/A143

	TAD	PRJDEF		/ GET ADDITIONAL SPACING REMAINDER
	CMA			/ MAKE POSITIVE				/C254
	SPA			/ SKIP IF THERE IS A DEFICENCY.
	CLA			/ PRJDEF WILL BE 0 AT OV2L10 WHEN LINE
				/ IS EXACTLY CORRECT SIZE
				/  IS EXACTLY CORRECT SIZE.
	DCA	PRJDEF		/ SAVE REMAINDER.
	AC0001			/ WE START IN COLUMN ONE		/A243
	DCA	P2PSN		/ INITIALIZE THE POSITION COUNTER	/A239
	DCA	P2LPR		/ SAVE CHARACTER REMAINDER.
	TAD	PLPS		/ COMPUTE SPACE SPACEING TO INCLUDE ANY
	TAD	PLSS		/  CHARACTER SPACING.
	DCA	PLSS		/
	TAD	PRJSPC		/ DOES LINE CONTAIN SPACES?
	SZA CLA			/ SKIP IF NO.
	JMP	P2JL11		/ GO CONVERT AND OUTPUT.
	TAD	PRJDEF		/ OUTPUT REMAINING SPACING IN CHARACTERS
	DCA	P2LPR		/  INSTEAD OF IN SPACING.
	DCA	PRJDEF		/
	DCA	PLSS		/ NO SPACE SPACEING IF NO SPACES.

P2JL11,	TAD	PLPS		/ See if any justification to
	TAD	P2LPR		/  be done. if not then don't
	TAD	PLSS		/  bother to output the justif-
	TAD	PRJDEF		/  action escape sequence.
	SNA CLA			/ Skip if there is justification
	JMP	P2JL12		/ Jmp if no justicication needed
	TAD	(JSTIFY-1	/
	DCA	NUMPTR		/ ADDRESS 'ASCOUT' OUTPUT - 1
	TAD	PLPS		/ GET THE FIRST PARAMETER
	CLL RAL			/ *2					/C220
	TAD	PLPS		/ *3					/C220
	CLL RAL			/ *6					/C220
	JMS	ASCOUT		/ SAVE IN BUFFER			/C220
	TAD	P2LPR		/ GET CHARACTER REMAINDER (IF ANY).
	JMS	ASCOUT		/					/C220
	TAD	PLSS		/ GET SPACE SIZE INCREASE
	CLL RAL			/ *2					/C220
	TAD	PLSS		/ *3					/C220
	CLL RAL			/ *6					/C220
	JMS	ASCOUT		/ SAVE IN BUFFER			/C220
	TAD	PRJDEF		/ GET ADDITIONAL SPACING REMAINDER
	JMS	ASCOUT		/ STORE REMIANDER			/C220
	TAD	(JSTIFY		/ POINT TO NUMERIC PARAMETERS		/C220
	DCA	NUMPTR		/					/C220
	TAD	(XSJSFY		/ POINT TO JUSTIFICATION STRING		/C220
	DCA	XSADX		/
	JMS	CSISTR		/ CSISTR OUPUTS THE ESC [, FOLLOWED BY THE
/				/ STRING ADDRESSED BY XSADX
P2JL12,
	AC0001
	JMS	PLREST		/ RESET BUFFER VARIABLES FOR SCAN
	DCA	UNDERL		/ RESET UNDERLINE FLAG
	DCA	OLDPOS		/ CLEAR THE SUPER/NORMAL/SUBSCRIPT
	DCA	NEWMOD		/ RESET THE NEW MODE FLAG

P2LIN1,	ISZ	P2PSN		/ COUNT THIS POSITION			/A239
P2LIN2,				/ HERE IF NOT 1ST CHR OF DEAD KEY SEQ	/A265
	TAD I	PLPTR		/					/A239
	AND	(2177)		/ MASK MODE BITS 0,2,3,4		/A254
	TAD	(-TSPC)		/ SEE IF A TAB SPACE			/A239
	SNA CLA			/					/A239
	JMP	P2LIN4		/ IS TAB SPACE				/A239
	TAD I	PLPTR		/ GET THE CHARACTER
	JMS	TCLQP		/ CHECK FOR & PROCESS TECHNICAL CHRS	/A233
	JMS	PRMODE		/ PROCESS THE MODE BITS
				/ SKIP NEXT INSTRUCTION IF TW HOP	/A116
	JMS	PR2TST		/ PRINT THE CHR

P2LIN3,			/LABEL TO PROCESS NEXT CHR			/A239
	JMS	PLCHBS		/ ARE THERE MORE CHARACTERS?
	JMP	P2LINX		/ NO, WRAP UP THE LINE
	JMP	P2LIN1		/ YES, A Multinational PRECEDENCE CHR	/A271
	JMP	P2LIN1		/ YES, A TECHNICAL PRECEDENCE CHR	/A233
	SKP			/ YES, IN THE SAME POSITION
	JMP	P2LIN1		/ YES, IN A NEW POSITION
	TAD	(BS		/ SEND A BACKSPACE
	JMS	PRCHAR
	JMP	P2LIN2		/ PART OF DEAD KEY SEQUENCE		/C265


P2LIN4,			/TAB SPACE SEEN					/A239
	TAD I	PLPTR		/ GET THE CHARACTER			/A256
	JMS	PRMODE		/ RESET MODE BEFORE TEST FOR TAB SPACE	/A256
	NOP			/ MAYBE TW YES				/A256
	TAD	P2PSN		/ GET CURRENT COLUMN POSITION		/A239
	TAD	PRMCMG		/ ADD INDENT VALUE IN COLUMNS		/C243
	JMS	PRESCS		/ POSITION HEAD TO THIS COLUMN		/A239
		PCCOLA		/ ABSOLUTELY				/A239
		CLA							/A239
	JMP	P2LIN3		/ GET NEXT CHR				/A239

P2LINX,
	JMS	PRMODE	/ADJUST ANY SUPER/SUBSCRIPT V-SPACE		/A099
	NOP			/ THIS LOCATION SKIPPED IF TW HOP	/A116
	DCA	PRTWHC		/ CLEAR ANY UNEXECUTED HOP AT END OFLINE/A116
	DCA	PRTWDP		/ AND ANY ACCUMULATED EXTRA DECIPOINTS	/A116
	TAD	(CR)		/ Transmit a carriage return
	JMS	PRCHAR
	JMP	PRGSL1		/ LINE COMPLETE - DO VERTICAL SPACING


P2LPR,	0			/ CHARACTER REMAINDER (USED ONLY WHEN
				/ LINE TO JUSTIFY CONTAINS NO SPACES).
P2PSN,	0			/ POSITION COUNTER			/A239


TCLQP,	XX			/ CHECK FOR & PROCESS TECH CHR		/A233
				/ CHAR TO PROCESS IS IN AC
				/ IF A TECH PRECENCE CHR THEN IGNORE IT,
				/ AND REPLACE

	AND	P177		/ MASK
	TAD	(-23)		/ SEE IF A TECH PRECEDENCE CHR

/d271	SZA			/
/d271	IAC			/
/d271	SZA			/
/d271	IAC			/
/d271	SZA CLA			/
/d271	JMP	TCLQPX		/ NO, GO EXIT
/d271
/d271				/ IS A TECHNICAL PRECE
/d271	JMS	PLNXT		/ GET THE NEXT CHR
/d271	HLT			/ THERE HAS TO BE ONE!
/d271				/ IF THERE ISN'T WE MAY BE PROCESSING
/d271				/ FROM RIGHT TO LEFT, WHICH IS A NO-NO
/d271				/ FOR PRINTING TECHNICAL CHARACTERS
/d271	TAD I	PLPTR		/ GET CHR IN BUFFER
/d271	AND	(7600)		/ SAVE ONLY THE MODE BITS
/d271	TAD	P177		/ LOAD THE CODE FOR THE REQUIRED SPACE
/d271	DCA I	PLPTR		/ REPLACE IN BUFFER

	SNA			/ test for technical precedence char	/a271
	JMP	WASTEC		/ go deal with it			/a271
	IAC			/ increment to test for multinational char/a271
	SNA			/ was it a multinat precedence char	/a271	
	JMP	WASMUL		/ was go deal withit			/a271
	IAC			/ increment to test for line drawing	/a271			
				/ precedence char			/a271
	SNA CLA			/ skip if no multec char found		/a271
	JMP 	WASTEC		/ jump if it was line precedence char	/a271
TCLQPX,	TAD I	PLPTR		/ RELOAD CHR				/a271
	JMP I	TCLQP		/ AND RETURN				/a271

WASMUL,	AC7777			/ set ac to flag mutinational		/a271
WASTEC,	JMS	BHOOK		/ call the blastr routine		/a271
	MCLQPE			/ to load reqd space or 8 bit char	/a271
	JMP	TCLQPX		/ exit					/a271
/-----------------------
	PAGE

PRMODE,	XX
	DCA	PRMODB		/ SAVE THE CHARACTER
	TAD	PRMODB		/ NOW OPERATE ON SUPER/SUB SSCT BITS
	CLL BSW
	AND	(0014
/				/ACC = 0, 4, 8, OR 12
	TAD	(PRVECT		/ ADD ADDRESS OF THE MATRIX
	DCA	PRJUMP		/ SAVE TO INDIRECT JUMP THROUGH
	JMP I	PRJUMP		/ EXECUTE THE APPROPRIATE ROUTINE	/M046
/									/D046
PRJUMP,	0
NEWPOS,	0			/ NEW VERTICAL SELECT
OLDPOS,	0			/ OLD VERTICAL SELECT
NEWHIT,	0			/ NEW HIT COUNT /			/A046
/ moved to page zero OLDHIT,	0			/ OLD HIT COUNT	/A046
PRMODB,	0
NEWMOD,	0			/ CHANGE HIT COUNT WHEN START PRINT
/
/
/	ENTER FROM  NORMAL   SUPER   SUBSCR
PRVECT,
	JMP NORMAL;	000;	001;	101;				/C148
	JMP SETUND;	000;	001;	101;				/C148
	JMP SUPER;	101;	000;	102;				/C148
	JMP SUBSC;	001;	002;	000
/
////////////////////////////////////////////////////////////////
/	THE FOLLOWING EITHER SETS OR RESETS THE UNDERLINE FLAG
/
SETUND,
	JMS	VERT	/ ACC = 0, SELECT 0
/									/D046
	TAD	UNDERL		/ IF UNDERLINE = OFF
	SNA CLA
	DCA	NEWMOD		/ THEN CHANGE PRINT MODE
	IAC			/ AND SET UNDERLINE = ON
	JMP	DOPRNT		/ AND DO PRINTING

SUBSC,	IAC			/ NEWPOS WILL BE SELECT 2
SUPER,	IAC			/ NEWPOS WILL BE SELECT 1
NORMAL,	JMS	VERT		/ SELECT 0 VERTICAL
RSTUND,
/									/D046
	TAD	UNDERL		/ IF UNDERLINE = ON
	SZA CLA
	DCA	NEWMOD		/ THEN CHANGE PRINT MODE
DOPRNT,
	DCA	UNDERL		/ AND SET/RESET UNDERLINE
/									/D046
PRINT,
	TAD	PRMODB		/ GET THE CHARACTER
	BSW			/ AND PUT THE BOLD BIT INTO THE LINK
	RTR
	CLA
	TAD	PRQ2W		/ GET THE TWO WHEEL FLAG
	SNA			/ IF AC=0, NO TWO WHEEL
	JMP	PRNT1		/ JUMP TO HANDLE REGULAR PRINTING
	SMA CLA
	CML			/ SECOND PASS--CM LINK AND TWO CASES
				/ BECOME IDENTICAL
	SNL			/ SKIP IF WE DON'T NEED TO PRINT THIS PASS/C116
	JMP	PRNT1		/ TW MODE, PRINTING

/***********************************************************************/
/									/
/	PRMTWN--TWO WHEEL, NOT PRINTING					/
/		A SECTION OF CODE ADDED TO SPEED UP TWO WHEEL		/
/		PRINTING IN THE MONOSPACE CASE (NOT THEME OR		/
/		PROPORTIONAL MODE)					/
/									/
/		PART OF PRMODE ROUTINE A116				/
/									/
/***********************************************************************/

		/ PRMODE, TW NOT PRINTING
	TAD	PLPFLG		/ GET PROPORTIONAL FLAG
	SNA CLA
	JMP	PRTWPN		/ IS PROPORTIONAL, NOT PRINTING

		/ TWO WHEEL, NOT PRINTING,  NOT PROPORTIONAL
	TAD	PRMODB		/ GET THE CHARACTER
	TAD	(-SPC)		/ SEE IF SPACE				/C258
	AND	P177		/ MASK MODE BITS			/A258
	SNA CLA			/ SKIP IF NOT SPACE
	JMP	PRMTW1		/ IS SPACE, PRINT BUT DON'T UNDERLINE
				/ THIS SPACE WILL BE OUTPUT
	ISZ	PRTWHC		/ INCREMENT THE HOP COUNT
				/ FOR THIS NON PRINTING NON SPACE CHR
	TAD	PLPS		/ ACCUMULATE EXTRA DECIPOINTS/6
	TAD	PRTWDP
	DCA	PRTWDP
	ISZ	PRMODE		/ BUMP RETURN ADDRESS
PRMTW1,	DCA	UNDERL		/ RESET UNDERLINE
	JMP	PRNT2		/ GO SEE IF NEED SUPER/SUB/UNDERL SEQS

PRTWPN,		/ TWO WHEEL, PROPORTIONAL, NOT PRINTING
/	AC7777			/ FORCE CODE TO DISABLE HAMMER
/	CLL			/ CLEAR BOLD ATTRIBUTE
	AC7777 CLL
	SKP			/ NO TWHOP IF PPNL			/A242

PRNT1,
	JMS	PRTWH		/ GO OUTPUT ANY TW HOP STUFF		/A116

/ THE FOLLOWING INSTRUCTION IS RISKY SINCE PRTWH CALL PRESCS ETC.
/LINK COULD BE CLOBBERED IN THESE ROUTINES...
	RAL			/ GET HIT COUNT
	TAD	PRQOVP		/ ADD IN THE DARKNESS VALUE
	DCA	NEWHIT		/ SAVE AS NEW BOLD MODE			/A046
	TAD	NEWHIT		/ GET IT BACK				/A046
	TAD	OLDHIT		/ COMPARE AGAINST OLD BOLD MODE		/A046
	SZA CLA
	DCA	NEWMOD		/ IF DIFFERENT, DO ESCAPE STRING	/A046
/									/D046
PRNT2,	TAD	NEWMOD		/
	SZA CLA			/ IF NEWMOD=0, THEN HAVE TO CHANGE MODE
	JMP I	PRMODE		/ NO CHANGE, RETURN			/C116
	ISZ	NEWMOD		/ ELSE DO : FLAG CHANGE MADE
	TAD	NEWHIT		/          GET NEW MODE
	JMS	PRESCS		/          SEND IT
		PCBOLD
	CIA			/          MAKE NEGATIVE FOR NEXT COMPARE
	DCA	OLDHIT		/ SAVE NEW HIT CNT AS OLD HIT COUNT
	JMP I	PRMODE		/ EXIT

/***********************************************************************/
/									/
/	PRTWH---IF ARE IN TW AND THERE IS HOPPING TO BE DONE		/
/		THEN PRTWHC WILL BE NONZERO, SO WE MUST COMMAND		/
/		THE LQP02 OF SOME HORIZONTAL MOTION.  IF WE ARE		/
/		JUSTIFYING THIS LINE THEN PRTWDP MAY OR MAY NOT		/
/		BE ZERO DEPENDING ON HOW THE JUSTIFICATION ALGORTHM	/
/		CAME OUT.  IF PRTWHC IS ZERO THEN PRTWDP IS ZERO.	/
/									/
/***********************************************************************/

PRTWH,	XX			/A116
	CLA RAL			/ GET LINK				/A258
	DCA	PRSAVL		/ SAVE LINK				/A258
	TAD	PRTWHC		/ GET HOP COUNT
	SNA			/ SKIP OUTPUT IF ZERO
	JMP	PRTWHX		/ GO RESTORE THE LINK!			/A262
	JMS	PRESCS		/ ELSE OUTPUT ACCUMULATE HOP AMOUNT
		PCMRT		/
	CLA
	DCA	PRTWHC		/ CLEAR THE COUNT
	JMS	PRESCS
		PCSPUM		/ SET PUM MODE
	TAD	PRTWDP		/ GET DECIPOINT/6 COUNT
	TAD	PRTWDP		/ AND TURN IT INTO
	TAD	PRTWDP
	CLL RAL			/ DECIPOINTS BY MULT BY SIX
	JMS	PRESCS		/ AND OUTPUT EXTRA DECIPOINT MOVEMENT
		PCMRT
	CLA
	DCA	PRTWDP		/ RESET EXTRA DECIPOINT COUNT		/A258
	JMS	PRESCS		/ AND RESET PUM MODE
		PCRPUM
PRTWHX,									/A262
	TAD	PRSAVL		/ GET SAVED LINK			/A258
	CLL RAR			/ RESTORE LINK				/A258
	JMP I	PRTWH		/ AND RETURN

PRSAVL,	0			/ STORAGE FOR LINK			/A258

PRTWHC,	0			/ NUMBER OF PRINTABLE CHARACTER UNITS TO HOP OVER

PRTWDP,	0			/ EXTRA DECIPOINTS/6 TO HOP OVER
/-------------------
	PAGE

OVTYPE=OLB
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM


/***********************************************************************/
/									/
/	OVCTR2--LQP02/03 CENTERING JUSTIFICATION OVERLAY		/
/									/
/***********************************************************************/

OVCTR2=.-OVRLCA		/ LQP02/03 CENTERING JUSTIFICATION OVLY		/A243
OBCTR2=OVTYPE+OVNUM

/ FIRST OUTPUT THE NON JUSTIFIABLE PART OF THE LINE.  WE NEED TO DO THIS
/ INCASE THE LINE CONTAINS TABBED TEXT, WHICH WILL BE TABBED RATHER THAN
/ JUSTIFIED.


	AC0001
	JMS	PLREST		/ RESET BUFFER VARIABLES FOR SCAN
	DCA	UNDERL		/ RESET UNDERLINE FLAG
	DCA	OLDPOS		/ CLEAR THE SUPER/NORMAL/SUBSCRIPT
	DCA	NEWMOD		/ RESET THE NEW MODE FLAG
	AC0001			/ WE START IN COLUMN ONE
	DCA	CTRPSN		/ RESET THE POSITION COUNTER

/IF THERE ARE NO TAB SPACES WE MUST DETECT THIS AND DO OUR POSITIONING
/IMMEDIATELY

	TAD	SOFTPT		/ SEE IF ANY TAB SPACES
	SNA CLA
	JMP	CTRIN5		/ NO, GO OUTPUT POSITIONING COMMAND

CTRIN1,	ISZ	CTRPSN		/ COUNT THIS POSITION
CTRIN2,				/ HERE IF NOT 1ST CHR OF DEAD KEY SEQ	/A265
	TAD I	PLPTR		/
	AND	(2177)		/ MASK MODE BITS 0,2,3,4		/A254
	TAD	(-TSPC)		/ SEE IF A TAB SPACE
	SNA CLA			/
	JMP	CTRIN4		/ IS TAB SPACE
	TAD I	PLPTR		/ GET THE CHARACTER
	JMS	TCLQP		/ CHECK FOR & PROCESS TECHNICAL CHRS
	JMS	PRMODE		/ PROCESS THE MODE BITS
				/ SKIP NEXT INSTRUCTION IF TW HOP
	JMS	PR2TST		/ PRINT THE CHR

CTRIN3,			/LABEL TO PROCESS NEXT CHR			/A239
	JMS	PLCHBS		/ ARE THERE MORE CHARACTERS?
	JMP	CTRINX		/ NO, WRAP UP THE LINE
	JMP	CTRIN1		/ YES, A multinational PRECEDENCE CHR	/A271
	JMP	CTRIN1		/ YES, A TECHNICAL PRECEDENCE CHR	/A233
	SKP			/ YES, IN THE SAME POSITION
	JMP	CTRIN1		/ YES, IN A NEW POSITION
	TAD	(BS		/ SEND A BACKSPACE
	JMS	PRCHAR
	JMP	CTRIN2		/ PART OF DEAD KEY SEQUENCE		/C265

CTRIN4,			/TAB SPACE SEEN					/A239
	TAD I	PLPTR		/ GET THE CHARACTER			/A256
	JMS	PRMODE		/ RESET MODE BEFORE TEST FOR TAB SPACE	/A256
	NOP			/ MAYBE TW YES				/A256
	TAD	CTRPSN		/ GET CURRENT COLUMN POSITION
	TAD	PRMCMG		/ ADD INDENT VALUE IN COLUMNS
	JMS	PRESCS		/ POSITION HEAD TO THIS COLUMN
		PCCOLA		/ ABSOLUTELY
		CLA

/ WE CHECK TO SEE IF WE HAVE REACHED THE LAST TAB SPACE.  IF SO IT
/ IS TIME TO ISSUE THE CENTERING POSITIONING COMMAND.  AFTER THAT
/ WE WILL AGAIN OUTPUT THE LINE USING THE SAME LOGIC UNTIL DONE

	TAD	PLPTR		/ COMPARE BUFFER POINTER
	CIA
	TAD	SOFTPT		/ WITH POINTER TO LAST TAB SPACE
	SZA CLA			/ SKIP IF TIME TO CENTER
	JMP	CTRIN3		/ NO, JUST GO BACK

/ WE HAVE FOUND THE RIGHTMOST TAB SPACE.  NOW DETERMINE IF WE HAVE
/ENOUGH ROOM TO CENTER.  IF THE MEASURED LENGTH OF THE LINE EXCEEDS
/OUR MEASURED WIDTH, TOUGH LUCK, WE WILL JUST VIOLATE THE RIGHT MARGIN

/IT WOULD BE NICE TO USE PUM MODE TO PERFORM THE CENTERING CALCULATION
/BUT THAT IT NOT PRACTICAL UNLESS WE INVENT SOME DOUBLE PRECISION
/MULTIPLY AND ASCOUT ROUTINES FOR THAT, SINCE THE MAX PN IN PUM MODE
/IS 720 TIMES THE LENGTH OF THE CARRIAGE IN INCHES ... 9510 FOR LQP02,
/MUCH MORE FOR A WIDE TRACK PRINTER
/THUS WE WILL ATTEMPT TO CENTER ONLY TO THE NEAREST COLUMN

CTRIN5,	TAD	PRRCH		/ GET THE LENGTH OF THE JUSTFBL PORTION
	CIA			/ NEGATE
	DCA	PRJDEF		/ PASS DIVIDEND TO PRDVID
	TAD	PLNRCS		/ GET DIVISOR
	JMS	PRDVID		/ DIVIDE
	CIA			/ NEGATE QUOTIENT
	DCA	PRJDEF		/ SAVE HERE TEMPORARILY

/SEE IF THERE IS A CENTERING MARK IN THE RULER.  IF SO USE A
/SLIGHTLY DIFFERENT CALCULATION...

	TAD	RULRCM		/ SEE IF THERE IS A CENTERING MARK
	SNA
	JMP	CTRIN6		/ NO CENTERING MARK IN RULER

	TAD	RULRCM		/ ADD IN A 2ND COPY
	JMP	CTRIN7		/ JUMP AHEAD

CTRIN6,	TAD	RULRLM		/ GET LEFT MARGIN IN COLUMN UNITS
	TAD	RULRRM		/ ADD RIGHT MARGIN IN COLUMN UNITS
CTRIN7,	TAD	PRJDEF		/ GET NEGATIVE WIDTH OF LINE IN COLUMNS
	SPA
	CLA			/ HERE IF NOT ENUF SPACE
	CLL RAR			/ DIVIDE BY 2 DISCARD REMAINDER
	TAD	PRMCMG		/ GET MULTICOLUMN MARGIN IN COLUMNS
	IAC			/ PRINT IN THE NEXT COLUMN!
	JMS	PRESCS		/ ABSOLUTLY POSITION TO THIS POSITION
		PCCOLA		/ IN PRINT UNITS
		CLA
	JMP	CTRIN3		/ GET NEXT CHR

CTRINX,
	JMS	PRMODE	/ADJUST ANY SUPER/SUBSCRIPT V-SPACE
	NOP			/ THIS LOCATION SKIPPED IF TW HOP
	DCA	PRTWHC		/ CLEAR ANY UNEXECUTED HOP AT END OFLINE
	DCA	PRTWDP		/ AND ANY ACCUMULATED EXTRA DECIPOINTS
	TAD	(CR)		/ Transmit a carriage return
	JMS	PRCHAR
	JMP	PRGSL1		/ LINE COMPLETE - DO VERTICAL SPACING

CTRPSN,	0			/ COUNTER FOR TAB SPACE POSITIONS


IFZERO .-TCLQP&4000 <TOO MUCH CODE ABOVE>
	*TCLQP	/FOR TEMPLATE MATCH					/A243
TCLQP,	XX			/ CHECK FOR & PROCESS TECH CHR		/A233
				/ CHAR TO PROCESS IS IN AC
				/ IF A TECH PRECENCE CHR THEN IGNORE IT,
				/ AND REPLACE

	AND	P177		/ MASK
	TAD	(-23)		/ SEE IF A TECH PRECEDENCE CHR
	SNA			/ test for technical precedence char	/a271
	JMP	WASTEC		/ go deal with it			/a271
	IAC			/ increment to test for multinational char/a271
	SNA			/ was it a multinat precedence char	/a271	
	JMP	WASMUL		/ was go deal withit			/a271
	IAC			/ increment to test for line drawing	/a271			
				/ precedence char			/a271
	SNA CLA			/ skip if no multec char found		/a271
	JMP 	WASTEC		/ jump if it was line precedence char	/a271
TCLQPX,	TAD I	PLPTR		/ RELOAD CHR				/a271
	JMP I	TCLQP		/ AND RETURN				/a271

WASMUL,	AC7777			/ set ac to flag mutinational		/a271
WASTEC,	JMS	BHOOK		/ call the blastr routine		/a271
	MCLQPE			/ to load reqd space or 8 bit char	/a271
	JMP	TCLQPX		/ exit					/a271
/-------------------
	PAGE

PRMODE,	XX
	DCA	PRMODB		/ SAVE THE CHARACTER
	TAD	PRMODB		/ NOW OPERATE ON SUPER/SUB SSCT BITS
	CLL BSW
	AND	(0014
/				/ACC = 0, 4, 8, OR 12
	TAD	(PRVECT		/ ADD ADDRESS OF THE MATRIX
	DCA	PRJUMP		/ SAVE TO INDIRECT JUMP THROUGH
	JMP I	PRJUMP		/ EXECUTE THE APPROPRIATE ROUTINE	/M046
/									/D046
PRJUMP,	0
NEWPOS,	0			/ NEW VERTICAL SELECT
OLDPOS,	0			/ OLD VERTICAL SELECT
NEWHIT,	0			/ NEW HIT COUNT /			/A046
/moved to page zero OLDHIT,	0			/ OLD HIT COUNT /A046
PRMODB,	0
NEWMOD,	0			/ CHANGE HIT COUNT WHEN START PRINT
/
/
/	ENTER FROM  NORMAL   SUPER   SUBSCR
PRVECT,
	JMP NORMAL;	000;	001;	101;				/C148
	JMP SETUND;	000;	001;	101;				/C148
	JMP SUPER;	101;	000;	102;				/C148
	JMP SUBSC;	001;	002;	000;				/C148
/
////////////////////////////////////////////////////////////////
/	THE FOLLOWING EITHER SETS OR RESETS THE UNDERLINE FLAG
/
SETUND,
	JMS	VERT	/ ACC = 0, SELECT 0
/									/D046
	TAD	UNDERL		/ IF UNDERLINE = OFF
	SNA CLA
	DCA	NEWMOD		/ THEN CHANGE PRINT MODE
	IAC			/ AND SET UNDERLINE = ON
	JMP	DOPRNT		/ AND DO PRINTING

SUBSC,	IAC			/ NEWPOS WILL BE SELECT 2
SUPER,	IAC			/ NEWPOS WILL BE SELECT 1
NORMAL,	JMS	VERT		/ SELECT 0 VERTICAL
RSTUND,
/									/D046
	TAD	UNDERL		/ IF UNDERLINE = ON
	SZA CLA
	DCA	NEWMOD		/ THEN CHANGE PRINT MODE
DOPRNT,
	DCA	UNDERL		/ AND SET/RESET UNDERLINE
/									/D046
PRINT,
	TAD	PRMODB		/ GET THE CHARACTER
	BSW			/ AND PUT THE BOLD BIT INTO THE LINK
	RTR
	CLA
	TAD	PRQ2W		/ GET THE TWO WHEEL FLAG
	SNA			/ IF AC=0, NO TWO WHEEL
	JMP	PRNT1		/ JUMP TO HANDLE REGULAR PRINTING
	SMA CLA
	CML			/ SECOND PASS--CM LINK AND TWO CASES
				/ BECOME IDENTICAL
	SNL			/ SKIP IF WE DON'T NEED TO PRINT THIS PASS/C116
	JMP	PRNT1		/ TW MODE, PRINTING

/***********************************************************************/
/									/
/	PRMTWN--TWO WHEEL, NOT PRINTING					/
/		A SECTION OF CODE ADDED TO SPEED UP TWO WHEEL		/
/		PRINTING IN THE MONOSPACE CASE (NOT THEME OR		/
/		PROPORTIONAL MODE)					/
/									/
/		PART OF PRMODE ROUTINE A116				/
/									/
/***********************************************************************/

		/ PRMODE, TW NOT PRINTING
	TAD	PLPFLG		/ GET PROPORTIONAL FLAG
	SNA CLA
	JMP	PRTWPN		/ IS PROPORTIONAL, NOT PRINTING

		/ TWO WHEEL, NOT PRINTING,  NOT PROPORTIONAL
	TAD	PRMODB		/ GET THE CHARACTER
	TAD	(-SPC)		/ SEE IF SPACE				/C258
	AND	P177		/ MASK MODE BITS			/A258
	SNA CLA			/ SKIP IF NOT SPACE
	JMP	PRMTW1		/ IS SPACE, PRINT BUT DON'T UNDERLINE
				/ THIS SPACE WILL BE OUTPUT
	ISZ	PRTWHC		/ INCREMENT THE HOP COUNT
				/ FOR THIS NON PRINTING NON SPACE CHR
	TAD	PLPS		/ ACCUMULATE EXTRA DECIPOINTS/6
	TAD	PRTWDP
	DCA	PRTWDP
	ISZ	PRMODE		/ BUMP RETURN ADDRESS
PRMTW1,	DCA	UNDERL		/ RESET UNDERLINE
	JMP	PRNT2		/ GO SEE IF NEED SUPER/SUB/UNDERL SEQS

PRTWPN,		/ TWO WHEEL, PROPORTIONAL, NOT PRINTING
/	AC7777			/ FORCE CODE TO DISABLE HAMMER
/	CLL			/ CLEAR BOLD ATTRIBUTE
	AC7777 CLL
	SKP			/ NO TWHOP IF PPNL			/A242

PRNT1,
	JMS	PRTWH		/ GO OUTPUT ANY TW HOP STUFF		/A116

/ THE FOLLOWING INSTRUCTION IS RISKY SINCE PRTWH CALL PRESCS ETC.
/LINK COULD BE CLOBBERED IN THESE ROUTINES...
	RAL			/ GET HIT COUNT
	TAD	PRQOVP		/ ADD IN THE DARKNESS VALUE
	DCA	NEWHIT		/ SAVE AS NEW BOLD MODE			/A046
	TAD	NEWHIT		/ GET IT BACK				/A046
	TAD	OLDHIT		/ COMPARE AGAINST OLD BOLD MODE		/A046
	SZA CLA
	DCA	NEWMOD		/ IF DIFFERENT, DO ESCAPE STRING	/A046
/									/D046
PRNT2,	TAD	NEWMOD		/
	SZA CLA			/ IF NEWMOD=0, THEN HAVE TO CHANGE MODE
	JMP I	PRMODE		/ NO CHANGE, RETURN			/C116
	ISZ	NEWMOD		/ ELSE DO : FLAG CHANGE MADE
	TAD	NEWHIT		/          GET NEW MODE
	JMS	PRESCS		/          SEND IT
		PCBOLD
	CIA			/          MAKE NEGATIVE FOR NEXT COMPARE
	DCA	OLDHIT		/ SAVE NEW HIT CNT AS OLD HIT COUNT
	JMP I	PRMODE		/ EXIT

/***********************************************************************/
/									/
/	PRTWH---IF ARE IN TW AND THERE IS HOPPING TO BE DONE		/
/		THEN PRTWHC WILL BE NONZERO, SO WE MUST COMMAND		/
/		THE LQP02 OF SOME HORIZONTAL MOTION.  IF WE ARE		/
/		JUSTIFYING THIS LINE THEN PRTWDP MAY OR MAY NOT		/
/		BE ZERO DEPENDING ON HOW THE JUSTIFICATION ALGORTHM	/
/		CAME OUT.  IF PRTWHC IS ZERO THEN PRTWDP IS ZERO.	/
/									/
/***********************************************************************/

PRTWH,	XX			/A116
	CLA RAL			/ GET LINK				/A258
	DCA	PRSAVL		/ SAVE LINK				/A258
	TAD	PRTWHC		/ GET HOP COUNT
	SNA			/ SKIP OUTPUT IF ZERO
	JMP	PRTWHX		/ GO RESTORE THE LINK!			/A262
	JMS	PRESCS		/ ELSE OUTPUT ACCUMULATE HOP AMOUNT
		PCMRT		/
	CLA
	DCA	PRTWHC		/ CLEAR THE COUNT
	JMS	PRESCS
		PCSPUM		/ SET PUM MODE
	TAD	PRTWDP		/ GET DECIPOINT/6 COUNT
	TAD	PRTWDP		/ AND TURN IT INTO
	TAD	PRTWDP
	CLL RAL			/ DECIPOINTS BY MULT BY SIX
	JMS	PRESCS		/ AND OUTPUT EXTRA DECIPOINT MOVEMENT
		PCMRT
	CLA
	DCA	PRTWDP		/ RESET EXTRA DECIPOINT COUNT		/A258
	JMS	PRESCS		/ AND RESET PUM MODE
		PCRPUM
PRTWHX,									/A262
	TAD	PRSAVL		/ GET SAVED LINK			/A258
	CLL RAR			/ RESTORE LINK				/A258
	JMP I	PRTWH		/ AND RETURN

PRSAVL,	0			/ STORAGE FOR LINK			/A258

PRTWHC,	0			/ NUMBER OF PRINTABLE CHARACTER UNITS TO HOP OVER

PRTWDP,	0			/ EXTRA DECIPOINTS/6 TO HOP OVER
/-------------------
	PAGE

OVTYPE=OLB
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM


OV3L10=.-OVRLCA			/ LQP02 "SQUISH-LINE" JUSTIFICATION LOGIC/A080
OB3L10=OVTYPE+OVNUM
IFNZRO OV3L10-OVJL10 <TEMPLATE ERROR>

	AC0001
	JMS	PLREST		/ RESET BUFFER VARIABLES FOR SCAN
	DCA	UNDERL		/ RESET UNDERLINE FLAG
	DCA	OLDPOS		/ CLEAR THE SUPER/NORMAL/SUBSCRIPT
	DCA	NEWMOD		/ RESET THE NEW MODE FLAG
	AC0001			/ WE START IN COLUMN ONE		/A243
	DCA	PNJPSN		/ CLEAR POSITION COUNTER		/A239

/FIRST OUTPUT THE NON JUSTIFIABLE PART OF THE LINE IN NORMAL MODE	/A239
/THE JUSTIFIABLE PART OF THE LINE IS THAT PART TO THE RIGHT OF		/A239
/THE RIGHTMOST TAB SPACE.  IN THE NON JUSTIFIABLE PART OF THE LINE	/A239
/WE WANT THE TABS TO LINE UP SO WE USE THE POSITION TO ABSOLUTE COL CMD	/A239

PNJ1,	ISZ	PNJPSN		/ COUNT THIS POSITION			/A239

PNJ2,	TAD	SOFTPT		/ SEE IF BUFFER POINTER IS		/A239
	SNA			/ ZERO					/A239
	JMP	P3LIN0		/ YES, THE WHOLE LINE IS JUSTIFIABLE	/A239

				/ SEE IF BUFFER POINTER IS PAST		/A239
	CIA			/ THE LAST SOFT SPACE			/A239
	TAD	PLPTR		/ IF SO WE ARE DONE WITH NON JUSTIFIED	/A239
	SMA SZA  CLA		/ PORTION OF THE LINE			/A239
	JMP	P3LIN0		/ GO PROCESS JUSTIFIED PORTION		/A239

	TAD I	PLPTR		/ GET THE CHARACTER			/A239
	AND	(2177)		/ MASK MODE BITS 0,2,3,4		/A254
	TAD	(-TSPC)		/ SEE IF A TAB SPACE			/A239
	SNA CLA			/					/A239
	JMP	PNJ4		/ IS TAB SPACE				/A239
	JMS	TCLQPA		/ CHECK FOR & PROCESS TECHNICAL CHARS	/A244
	JMS	PRMODE		/ PROCESS THE MODE BITS			/A239
	JMS	PR2TST		/ PRINT THE CHR				/A239

PNJ3,	JMS	PLCHBS		/ ARE THERE MORE CHARACTERS?		/A239
	JMP	P3LIN5		/ WE SHOULD NEVER GET HERE BUT...	/A244
	JMP	PNJ1		/ A multinational PRECEDENCE CHR	/a271
	JMP	PNJ1		/ A TECHNICAL PRECEDENCE CHR		/C244
	SKP			/ YES, IN THE SAME POSITION		/A239
	JMP	PNJ1		/ YES, IN A NEW POSITION		/A239

	TAD	(BS)		/ PUT OUT A BACKSPACE			/A239
	JMS	PRCHAR		/ PUT OUT A BACKSPACE			/A239
	JMP	PNJ2		/ GET NEXT CHR IN THIS POSITION		/A239

PNJ4,				/ TAB SPACE SEEN			/A239
	TAD I	PLPTR		/ GET THE CHARACTER			/A256
	JMS	PRMODE		/ RESET MODE BEFORE TEST FOR TAB SPACE	/A256
	TAD	PNJPSN		/ GET COLUMN POSITION			/A239
	TAD	PRMCMG		/ GET INDENT				/C244
	JMS	PRESCS		/ POSITION HEAD TO THIS COLUMN		/A239
		PCCOLA		/					/A239
		CLA		/					/A239
	JMP	PNJ3		/ NO, GET NEXT CHR			/A239

P3LIN0,	JMS	PRESCS		/ SET PUM MODE
		PCSPUM
	ISZ	PRPUMM		/ set the PUM mode flag			/a272

/WE MUST POSITION THE HEAD TO THE START OF THE FIRST CHARACTER
/IN THE JUSTIFIED PORTION.  IN PUM MODE THAT WILL BE AT HALF OF THE
/WIDTH OF THE FIRST CHARACTER.  SINCE THE LQP02 DIVIDES THE MOTION
/BY SIX WE WILL MULTIPLY BY THREE...

	JMS	PLSPCX		/ GET WIDTH AND RESTORE POINTERS	/A239
				/ PLWIDT  is returned in AC
	TAD	PLWIDT		/ Compute *2
	TAD	PLWIDT		/ Compute *3
P3LIN1,	DCA	P2HEAD		/ Save amount to move print head prior
				/  to printing the next character.

/NOW WE PROCESS THE JUSTIFIABLE PORTION BY PRINTING ALL CHARACTERS
/ in the current print position and then moving the print head by half
/ of the current print position + half of the next print position +
/ any justification spacing. We then move on to the next print position.

	JMS	PLSPC	/Get spacing to center of next char posn.
	TAD I	PLPTR	/Save current character for it's justify bit.
	DCA	P3TEMP	/ We'll use it later for intra-char spacing.

P3LIN2,	JMS	TCLQPA	/Get the character and test for mnc/tech	/c271
	JMS	PRMODE	/Process the mode bits and print character.
	JMS	PR2TSP		/ CALL ROUTINE TO TEST FOR SPACE	/C211
	TAD	NEWHIT		/ TEST TO SEE IF BOLD ATTRIBUTE
	TAD	PRQOVP		/ ONLY BIT 11 OF INTEREST
	AND	PRQSP		/ AND WITH MENU BIT			/C244
	RAR			/ PUT BIT IN LINK			/C244
	SNL CLA			/ SKIP IF SHADOWING THIS CHR		/C244
	JMP	P3LIN3		/ NO, MERGE BELOW

	AC0006		/ move print head 1/120th to the right.
	TAD	P2HEAD	/  ...
	DCA	P2HEAD	/  ...
	JMP	PR2REP		/ PRINT THE CHR AGAIN (SHADOW)	/c273	/C211
P3CONT,
/d273	TAD	(-6)	/ move print head back to orig posn.
	TAD	P2HEAD	/  ...
	DCA	P2HEAD	/  ...
P3LIN3,	JMS	PLCHBS	/Are there more characters?
	JMP	P3LIN5	/No--wrap up this LINE
	JMP	P3LI3A	/YES, multinational PRECEDENCE			/a271
	JMP	P3LI3A	/YES, TECHNICAL PRECEDENCE			/C244
	JMP	P3LIN2	/Yes--overstrike them.
			/FALL THROUGH IF YES IN A NEW POSITION		/A233
P3LI3A,
	AC4000		/If char we just printed is justifyable then
	AND I	PLPTR	/ add in extra spacing if needed.
	SNA CLA		/Skip if char is justifyable. check for xtra sp
	JMP	P3LIN4	/Ignore additional spacing for this char posn.
	TAD	PRJDEF	/See if any deficiency left.
	SMA CLA		/Skip if yes.
	JMP	P3LIN4	/Jmp if no more inter-character/space spacing.
	ISZ	PRJDEF	/Allocate an increment.
	AC0001		/If here then allocate it. Skip if no more to do
	JMP	P3LIN4		/ GO TO NEXT PAGE

P3LI4,	JMS	TCLQPA	/ deal with the precedence char and get the real/a271
	JMP	P3LI3A	/ go print it					/a271

PNJPSN,			/THIS LABEL IS USED IN NON JUSTIFIABLE PORTION	/A239
P3TEMP,	0		/THIS LABEL IS USED IN JUSTIFIABLE PORTION ONLY


/ TCLQPA IS IDENTICAL TO TCLQP BUT MUST BE FREE TO RESIDE
/ HERE SINCE THERE ARE TOO MANY LINKS IF WE *TCLQP IT
TCLQPA,	XX			/ CHECK FOR & PROCESS TECH CHR		/A233
	TAD I	PLPTR		/ GET CHARACTER				/A239
				/ IF A TECH PRECENCE CHR THEN IGNORE IT,
				/ AND REPLACE

	AND	P177		/ MASK
	TAD	(-23)		/ SEE IF A TECH PRECEDENCE CHR
	SNA			/ test for technical precedence char	/a271
	JMP	WSTECA		/ go deal with it			/a271
	IAC			/ increment to test for multinational char/a271
	SNA			/ was it a multinat precedence char	/a271	
	JMP	WSMULA		/ was go deal withit			/a271
	IAC			/ increment to test for line drawing	/a271			
				/ precedence char			/a271
	SNA CLA			/ skip if no multec char found		/a271
	JMP 	WSTECA		/ jump if it was line precedence char	/a271
TCLQPY,	TAD I	PLPTR		/ RELOAD CHR				/a271
	JMP I	TCLQPA		/ AND RETURN				/a271

WSMULA,	AC7777			/ set ac to flag mutinational		/a271
WSTECA,	JMS	BHOOK		/ call the blastr routine		/a271
	MCLQPE			/ to load reqd space or 8 bit char	/a271
	JMP	TCLQPY		/ exit					/a271
/------------------------
	PAGE

/***********************************************************************/
/									/
/	PRMODE--LQP02/03 ROUTINE TO OPERATE ON MODE BITS AND POSITION	/
/		CARRIAGE FIRST FOR PROPER SUPER/SUB/NORMAL VERTICAL	/
/		POSITION, OUTPUT PRIMARY AND SECONDARY SGR SEQUENCES	/
/		FOR BOLDNESS, UNDERLINE, AND HAMMER MUTING IF TW YES	/
/		AND NOT PRINTING THE CHR ON THIS PASS			/
/									/
/		THIS ROUTINE IS DUPLICATE THROUGH SEVERAL OF THE	/
/		OVERLAYS.  THUS IT MUST ORIGINATE AT THE SAME LOCATION	/
/		IN EACH OVERLAY OR ELSE THERE WILL BE AN ASSEMBLER ERROR/
/									/
/		THIS COPY IS A LITTLE DIFFERENT FROM OTHER COPIES	/
/		IN THAT IT USES THE HAMMER MUTING FOR TW RATHER THAN	/
/		THE FASTER HOPPING IN THE OTHER COPIES			/
/		THUS IT DOES NOT HAVE A SKIP RETURN			/
/									/
/***********************************************************************/
PRMODE,	XX
	DCA	PRMODB		/ SAVE THE MODE BITS
	TAD	PRMODB		/ NOW OPERATE ON THEM
	CLL BSW
	AND	(0014		/ KILL BOLD BIT
/				/ACC = 0, 4, 8, OR 12
	TAD	(PRVECT		/ ADD ADDRESS OF THE MATRIX
	DCA	PRJUMP		/ SAVE TO INDIRECT JUMP THROUGH
	JMP I	PRJUMP		/ EXECUTE THE APPROPRIATE ROUTINE
PRJUMP,	0
NEWPOS,	0			/ NEW VERTICAL SELECT
OLDPOS,	0			/ OLD VERTICAL SELECT
NEWHIT,	0			/ NEW HIT COUNT
/d273 moved to page zero OLDHIT,	0			/ OLD HIT COUNT
PRMODB,	0
NEWMOD,	0			/ CHANGE HIT COUNT WHEN START PRINT
/
/
/	ENTER FROM  NORMAL   SUPER   SUBSCR
PRVECT,
	JMP NORMAL;	000;	001;	101
	JMP SETUND;	000;	001;	101
	JMP SUPER;	101;	000;	102
	JMP SUBSC;	001;	002;	000

SETUND,/	THE FOLLOWING EITHER SETS OR RESETS THE UNDERLINE FLAG
	JMS	VERT		/ ACC = 0, SELECT 0
	TAD	UNDERL		/ IF UNDERLINE = OFF
	SNA CLA
	DCA	NEWMOD		/ THEN CHANGE PRINT MODE
	IAC			/ AND SET UNDERLINE = ON
	JMP	DOPRNT		/ AND DO PRINTING

SUBSC,	IAC			/ NEWPOS WILL BE SELECT 2
SUPER,	IAC			/ NEWPOS WILL BE SELECT 1
NORMAL,	JMS	VERT		/ SELECT 0 VERTICAL
RSTUND,
	TAD	UNDERL		/ IF UNDERLINE = ON
	SZA CLA
	DCA	NEWMOD		/ THEN CHANGE PRINT MODE
DOPRNT,
	DCA	UNDERL		/ AND SET/RESET UNDERLINE
PRINT,
	TAD	PRMODB	/Get the mode bits
	BSW		/And put the bold bit into the link
	RTR
	CLA
	TAD	PRQ2W	/Get the two wheel flag
	SNA		/If AC=0, no two-wheel
	JMP	PRNT1A	/Jump to handle regular printing
	SMA CLA
	CML		/Second pass--complement the link and the two cases
			/become identical.
	SZL		/Skip if we need to print during this two-wheel pass
	AC7777 CLL		/ ELSE LOAD -1 INTO THE AC
PRNT1A,
	RAL			/ GET HIT COUNT
	TAD	PRQOVP		/ ADD IN THE DARKNESS VALUE
	DCA	NEWHIT		/ SAVE AS NEW BOLD MODE
	TAD	NEWHIT		/ GET IT BACK
	TAD	OLDHIT		/ COMPARE AGAINST OLD BOLD MODE
	SZA CLA
	DCA	NEWMOD		/ IF DIFFERENT, DO ESCAPE STRING
	TAD	NEWMOD		/
	SZA CLA			/ IF NEWMOD=0, THEN HAVE TO CHANGE MODE
	JMP	OLDMDA		/ NO CHANGE
	ISZ	NEWMOD		/ ELSE DO : FLAG CHANGE MADE
	TAD	NEWHIT		/          GET NEW MODE
	JMS	PRESCS		/          SEND IT
		PCBOLD
	CIA			/          MAKE NEGATIVE FOR NEXT COMPARE
	DCA	OLDHIT		/          SAVE IT
OLDMDA,
	JMP I	PRMODE

/***********************************************************************/
/									/
/	CONTINUE JUSTIFICATION HERE FROM OTHER PAGE			/
P3LIN4,	TAD	PLPOS	/ Compute head movement for this print posn.
	DCA	P3TEMP	/ Save in temp.
	TAD	P3TEMP	/ Compute *1
	CLL RAL		/ Compute *2
	TAD	P3TEMP	/ Compute *3
	CLL RAL		/ Compute *6
	DCA	P3TEMP	/ Save, just incase.
	TAD	P3TEMP	/ Get this head movement.
	TAD	P2HEAD	/ Accumulate head movement.
	SMA		/ Skip if overflow.
	JMP	P3LIN1	/ Process next print posn.
	CLA		/ Get last (ok) movement command.
	TAD	P2HEAD	/  ...
	JMS	PRESCS	/ Move the head to that posn.
		PCMRT	/  ...
	CLA		/ Get this posn width.
	TAD	P3TEMP	/  and reset movement to this width.
	JMP	P3LIN1	/Print next posn.

P3LIN5,	DCA	P2HEAD	/ Reset accumulated head movement.
	JMS	PRMODE	/ADJUST ANY SUPER/SUBSCRIPT V-SPACE		/A099
	JMS	PRESCS	/ reset PUM mode.
		PCRPUM	/  ...
	DCA	PRPUMM	/ clear the PUM mode flag			/a272
	TAD	(CR)	/Transmit a carriage return
	JMS	PRCHAR
	JMP	PRGSL1		/ LINE COMPLETE - DO VERTICAL SPACING


PR2REP,			/ repeat last char				/a273
	AC7777			/ get flag value			/a273
	DCA	REPCHAR		/ set flag				/a273
	JMS	PR2TSP		/ send it				/a273
	TAD	(-6)
	JMP	P3CONT		/ return to mainline			/a273

PR2TSP,	XX			/ TEST FOR SPACE			/A211
	TAD I	PLPTR		/ GET CHR
	AND	P177		/ MASK
	TAD	(-SPC)		/ SEE IF SPACE
	SZA CLA			/ YES, SKIP PR2TST
	JMS	PR2TST		/ ELSE DO PR2TST
	DCA	REPCHAR		/ clear repchar for space not required	/a273
	JMP I	PR2TSP		/ RETURN
/-------------------
	PAGE

OVTYPE=OLC
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM

/When PLWIDE is called, the buffer variables point to the first
/character in a position.  The routine returns the width of the position by
/storing it in PLWIDT.  This is the width from the proportional table if
/proportional printing is in effect, or the standard character size otherwise.

/If the position is a dead key sequence, the width of the widest character
/in the sequence is returned.

/If the position is the last in the line, a normal return is made.  Otherwise,
/a skip return is made.

/Upon return, the buffer variables point to the first character in the
/next position.


PLWIDE,
	XX
	DCA	PLWIDT	/Clear the position width

/This loop runs through the sequence CHAR1 BS CHAR2 BS ... BS CHARn which
/makes up the position.  The width of the position is the width of the
/widest character in the sequence.

PLWID0,

/If we are not doing proportional printing, the width of all the characters
/is always PLNRCS.

	TAD	PLPFLG	/Are we printing proportional?
	SNA CLA		/ FIX THIS SKIP SO WE WILL PRINT TO DP		/A123
	JMP	PLWID1	/Yes--retrieve the character width
	JMS	MNGETC	/ get the char pointers to the right position	/a274
	CLA		/ don't care if it is a tech char		/a274
	CLA		/ clear if it is a multinational char		/a274
PLWDA1,									/a274
	TAD	PLNRCS	/No--get the character width
	JMP	PLWID3	/And jump to join the proportional width code

PLWID1,
/SAVE THE REAL CHR IN A TMP.  CHECK TO SEE IF IT IS A REPLACEMENT	/A218
/CHR.  IF SO READ WIDTH FROM A DIFFERENT TABLE POSITION BUT LEAVE	/A218
/CHR CODE IN PRLBUF ALONE.						/A218

	JMS	RXTST		/TEST FOR REPLACEMENT CHRS		/A218
	JMP	PLWR1		/IS R1					/A218
	JMP	PLWR2		/IS R2					/A218
	JMS	MNGETC		/GET NON REPLACEMENT CHR		/c271
	JMP	PLWDA1		/go get reqd space			/a274
				/ skip return				/a274
/ check here for 8 bit chars						/a271
	AND	P177		/ get rid of the mode bits		/a271
	TAD	(200)		/ add in 200 for 8th bit		/a271
	ISZ	PLWMUL		/ skip if multinational detected	/a271
	AND	P177		/ no so take out the 8th bit		/a271	
PLWID5,	DCA	PLWTM		/ SAVE IN ROUTINE VARIABLE		/A218

/We want to recover the width OF THE CHAR FROM THE PROPORTIONAL width table
/The lower two bits of the char indicate which of the word the width
/is in. The remainder of the width identify the word. Se the table 
/documentation for more info.
/First we set up things so that we will be able to retreive the proper three
/bits from the information word

	AC0003		/ get a bit map into the ac	
	AND	PLWTM	/Get the lower two bits of the character
	CMA		/Convert them into a counter
	DCA	T1	/And save the counter

/Now we recover the information word from the table.

/d271	JMS	SKIPIF							/A211
/d271		LQPSE							/C217
/d271	TAD	(P2STBL-PSTBL)	/DIFFERENCE IN BASE TABLE		/A211
/d271	TAD	(PSTBL-7)	/-7 FOR OFFSET AT SPACE-1%4		/C218
/d271	DCA	T3		/SAVE TABLE BASE POINTER		/A211
	TAD	PLWTM		/GET THE CHR				/C218
	AND	(374)	/MASK THE MODE BITS AND 2 LS CHR BITS		/C194
	CLL	RTR	/DIVIDE BY 4 (CHARACTERS PER TABLE ENTRY)
			/normalizing the ascii space code to PSTBL
	TAD	(LQPTBL-7)	/ADD TABLE BASE POINTER				/A211
	DCA	T3	/Save to indirect through
	TAD I	T3	/And get the information word

/Now that we have the information word, we must extract the correct three
/bits from it. We simply rotate the bits around the number of times specified
/by the counter saved in T1. The R3L instruction does not use the link	

PLWID2,
	R3L		/ rotate the next three bytes
	ISZ	T1	/ have we rotated enough
	JMP	PLWID2	/ not yet
	AND	(7	/ mask the three lower bits

/ We now have the code for the desired space in the AC. We now scale it back
/ up to the desired proportional spacing.

	IAC		/ADD BIAS TO THE CODE				/C211
	CLL RAL		/Multiply by two
	DCA	T3	/And save the width

/PLWIDT contains the width of the widest character encountered so far in the
/position.  If the new width is larger, update PLWIDT.

	TAD	T3
	CIA		/Negate the new width
	TAD	PLWIDT	/Compare with the current largest width

	SMA CLA		/If the AC is negative, the new width is larger
	JMP	PLWID4	/No update is necessary
	
	TAD	T3	/Recover the new width

/The largest width found so far in the position is in the AC.  This was
/determined either by comparison (in the proportional case) or because
/all widths are the same (in the non-proportional case).  In either case,
/update PLWIDT.

PLWID3,
	DCA	PLWIDT	/Record the current largest width
	DCA	PLWMUL	/ CLEAR THE MULTINATIONAL FLAG			/A274

/We now determine whether the character sequence continues.  If it does,
/we iterate.  If not, we return the width of the position--making a regular
/return if this position is the last position, making a skip return otherwise.

PLWID4,
	JMS	PLCHBS	/Are there more characters?
	JMP I	PLWIDE	/No--make a regular return
	JMP	PLWD4	/YES, A multinational PRECEDENCE		/a271
	JMP	PLWD4	/YES, A TECHNICAL PRECEDENCE			/A233
	JMP	PLWID0	/Yes, in this position--iterate

/The end of the position's character sequence has been found.  Make a skip
/return.
PLWD4,
	ISZ	PLWIDE	/This is not the last position--make a skip return
	JMP I	PLWIDE


PLWR1,	TAD	(37-177)		/USE TABLE PSN BEFORE SPACE	/A218
					/FOR R1				/A218
PLWR2,	TAD	P177			/USE TABLE PSN 177 FOR R2	/A218
	JMP	PLWID5			/RE-ENTER ROUTINE ABOVE		/A218

PLWIDT,	0	/The width of the position pointed to by the buffer variables
		/when PLWIDE is invoked.  The return value of the routine.

PLWTM,	0	/THE CHARACTER VALUE USED TO INDEX THE TABLE		/A218

/**********************************************************************/
/									/
/	PRTST---REPLACEMENT CHR ROUTINE					/
/		THIS IS THE BASIC ROUTINE FOR OUTPUTTING THE		/
/		ACTUAL CHARACTERS TO THE PRINTER.  BEFORE WE CAN	/
/		OUTPUT A CHARACTER WE HAVE TO KNOW WHETHER		/
/		IT IS:							/
/		1)	THE REQUIRED SPACE CODE				/
/		2)	EITHER REPLACEMENT CHR (R1 OR R2)		/
/		3)	A MULITEC CHARACTER REQUIRES 8 BITS		/
/		IF SO, SPECIAL TREATMENT IS REQUIRED			/
/									/
/***********************************************************************/

PRTST,	XX	/ REPLACEMENT CHR ROUTINE	
		/ THIS ROUTINE IS FOR BOTH THE LQP02 AND LQPSE
	ISZ	REPCHAR		/ examine repeat char flag		/a273
	JMP	PRTST1		/ continue if not			/a273
	TAD	LSTCHA		/ get the last char			/a273
	JMP	PRTST2		/ just send it again			/a273
PRTST1,									/a273
	TAD I 	PLPTR	/GET CHARACTER
	AND 	P177	/STRIP OFF MODE BITS
	TAD	(-RQSP)	/IS IT THE REQUIRED SPACE?			/A217
	SNA	CLA	/						/A217
	JMP	PRC3	/YES, IS REQUIRED SPACE				/A217
	JMS	RXTST		/TEST FOR REPLACEMTN CHRS		/A218
	JMP	PRC1		/IS R1					/C218
	JMP	PRC2		/IS R2					/C218
	TAD I	PLPTR		/ GET THE CHARACTER			/C218
	AND	P177		/ watch those top bits			/a271
	TAD	(200)		/SET MULTINATIONAL BIT FOR 8 BIT PRINT	/A271
	ISZ	MNCFLG		/IS IT A MULITEC CHAR			/A271
	AND	P177		/NO DONT ADD 200			/A271
PRTST3,									/a273
	DCA	LSTCHA		/ save this char			/a273
	TAD	LSTCHA		/ get it back again			/a273
PRTST2,									/a273
	JMS	PRCHAR		/AND PRINT IT
	DCA	MNCFLG		/ CLEAR THE MULTINATIONAL CHAR FLAG	/A271
	DCA	REPCHAR		/ clear the repchar flag		/a273
	JMP I	PRTST		/EXIT
	
PRC1,	JMS 	PRESCS	/DO S1 SUBSTITUTION
		PCSUB1
	JMP I	PRTST	/EXIT

PRC2,	JMS	PRESCS	/DO S2 SUBSTITUTION
		PCSUB2	
	JMP I	PRTST	/EXIT

PRC3,

/WE HAVE DETECTED THE REQUIRED SPACE.  WE CANNOT SIMPLY OUTPUT		/A217
/A SPACE CODE INSTEAD OF THE CODE FOR THE REQUIRED SPACE SINCE		/A217
/THE AMOUNT OF MOTION THAT THE SPACE MOVES IS PROGRAMMABLE IF WE	/A217
/ARE JUSTIFYING.  THE JUSTIFICATION LOGIC PRESUMED THAT THE SPACE	/A217
/WIDTH IS CONTAINED IN PLNRCS.  THUS WE OUTPUT THAT AMOUNT OF		/A217
/HORIZONTAL MOTION...							/A217

/HERE WE USED TO OUTPUT SPACE BACKSPACE TO TRIGGER UNDERLINE		/A268
/BUT WE HAD PROBLEMS WITH JUSTIFICATION OF REQ'D SPACE SO CODE WAS DLTD	/A268


/FOR THE LQPSE WE MUST OUTPUT IN PRINT UNITS				/A218
/FOR THE LQP02 WE MUST OUTPUT IN COLUMN UNITS, ERGO:			/A218

/d273 delete these LQPSE bits to gain room for this edit 
/d273	JMS	SKIPIF							/A218
/d273		LQPSE							/A218
/d273	JMP	PRC4		/LQP02/3				/A218

/THIS IS REQUIRED SPACE TO THE LQPSE					/A218
/d273	TAD	PLNRCS		/GET STANDARD WIDTH ACCORDING TO PITCH	/A218
/d273	JMS	PLHMOV		/CALL THE LQPSE HORZ MOTION ROUTINE	/A218
/d273	JMP I	PRTST		/RETURN					/A218

PRC4,			/REQUIRED SPACE IN PRTST			/A217
/d273	TAD	PLDIR		/GET DIRECTION FLAG			/A217
/d273	JMS	PRESCS		/CALL ROUTINE FOR HORZ MOVE		/A217
/d273		PCMRT		/HORIZONTAL MOTION HAI COLUMNS		/A217
/d273		CLA							/A217
/d273	JMP I	PRTST		/EXIT					/A217
	TAD	(240)		/get an eight bit space			/a273
	JMP	PRTST3		/ go output it				/a273



/****************************************************************************
/ RXTST	        Replacement chars R1 R2
/****************************************************************************

RXTST,	XX		/ Normal exit if R1
			/ Skip exit if   R2
			/ else double skip

	TAD I	PLPTR		/GET CHR				/A218
	AND	P177		/STRIP MODE BITS			/A218
	TAD	PRQSB1		/ADD NEGATIVE OF VALUE STORED		/A218
	SNA			/					/A218
	JMP I	RXTST		/IS R1, RETURN				/A218
	ISZ	RXTST		/BUMP RETURN IF NOT R1			/A218
	TAD	PRQSB2		/ADD NEGATIVE OF DIFFERENCE		/A218
	SZA CLA			/					/A218
	ISZ	RXTST		/BUMP RETURN IF NOT R2			/A218
	JMP I	RXTST		/RETURN					/A218


/THIS IS THE REPLACEMENT CHARACTER ROUTINE FOR THE LQP02

PR2TST,	XX
	TAD	P2HEAD	/ Get amount to move print head
	SZA		/ don't move print head if no where to go
	JMS	PRESCS	/  move the print head
		PCMRT	/  harmless "and" if executed
	CLA		/ reset head movement saver
	DCA	P2HEAD	/
	JMS	PRTST	/ print char & do substitution
	JMP I	PR2TST	/ Return to caller

LSTCHA,	0		/ last character printed			/a273
REPCHAR,0		/ repeat char flag				/a273
P2HEAD,	0		/ Amount to pre-move print head
/------------------------------
	PAGE


	/XLIST
OBTABL=OVTYPE+OVNUM

/***********************************************************************/a271
/ LQPTBL     space reseved for the LQP proportional print tables	/a271
/    		must resided here see WPBLTB				/a271
/***********************************************************************/a271

LQPTBL,	ZBLOCK	77		/ 63 words reserved			/a271


/***********************************************************************/
/									/
/	VERT -- ADJUST VERTICAL POSITION WITHIN THE LINE		/
/		TRANSMITS 0, 1, OR 2 PLU OR PLD SEQUENCES		/
/		DEPENDING ON THE PREVIOUS VERTICAL ATTRIBUTE		/
/		AND THE NEXT VERTICAL ATTRIBUTE				/
/									/
/		THIS ROUTINE USED TO CALL PRESCS WITH PCMPUP		/
/		WHICH GENERATED AN E[1e WHILE GOING FROM A SUPER
/		TO A SUB.  IN JUSTIFIED TEXT WE ARE USING PUM MODE	/
/		SO THIS BECOMES A VERY SMALL MOTION, SO THIS WAS	/
/		REWRITTEN TO GENERATE TWO $L OR $K SEQUENCES WHEN	/
/		GOING FROM SUPER TO SUB OR VICE VERSA...REV148		/
/									/
/***********************************************************************/

OBVERT=OVNUM+OVTYPE							/A247

VERT,	XX
	DCA	NEWPOS		/ SET THE NEW VERTICAL SELECT
	TAD	PRJUMP		/ GET JUMP POINT
	IAC			/ POINT TO VERTICAL MOTION (0)
	TAD	OLDPOS		/ MOTION DEPENDING ON OLD VERTICAL
	DCA	VERTT1		/ SAVE ADDRESS
	AC0100			/ SET AC TO A MASK			/A148
	AND I	VERTT1		/ READ THE TABLE AND MASK		/A148
	BSW			/ SWAP INTO LSB POSITION		/A148
	DCA	VERTFG		/ SAVE AS THE DIRECTION FLAG		/A148
	TAD I	VERTT1		/ READ TABLE AGAIN			/A148
	AND	P77		/ MASK OFF FLAG BIT			/A148
	CMA			/ NEGATE BUT DON'T ADD ONE		/A148
	DCA	VERTT1		/ SAVE AS A COUNTER			/A148
VERT1,	ISZ	VERTT1		/ BUMP COUNTER				/A148
	JMP	VERT2		/ NEED TO OUTPUT SOMETHING		/A148
	TAD	NEWPOS		/ MAKE NEW POSITION THE OLD ONE
	DCA	OLDPOS
	JMP I	VERT

VERT2,	TAD	(ESC		/ LOAD ESCAPE				/A148
	JMS	PRCHAR		/ OUTPUT IT				/A148
	TAD	VERTFG		/ GET FLAG--ZERO OR ONE			/A148
	TAD	("K&177)	/ THIS GENERATES A "K OR A "L		/A148
	JMS	PRCHAR		/ OUTPUT IT				/A148
	JMP	VERT1		/ RETURN TO LOOP			/A148

VERTFG,	0			/ 0 FOR "K, 1 FOR "L			/A148

VERTT1,	0


/ INITIALIZE ROUTINE FOR LQP02 JUSTIFICATION

PLINIT,	XX		/ LQP02 LINE JUSTIFY INIT ROUTINE		/A211
	OBPLIN=OVNUM+OVTYPE	/ BLOCK ID FOR THIS SUBROUTINE		/A211

	JMS	BHOOK		/ CALL CODE FOR PLINIT THROUGH BLASTR	/A271
	PLINIE			/ table entry for PLINA			/a271
/ now put the correct justification table in				/a271
	JMS	SKIPIF		/ check for an LQP03			/a271
	LQPSE								/a271
	JMP	PLIN1		/ no keep checking			/a271
	JMP	PLIN3		/ go get the table entry		/a271
PLIN1,	JMS	SKIPIF		/ check for an LQP02			/a271
	LQP03			/					/a271
	JMP	PLIN2		/ must be an LQPSE 			/a271
	IAC			/ ac=2 :: LQP03				/a271
PLIN2,	IAC			/ ac=1 :: LQP02				/a271
PLIN3,	TAD	(LQPTBE)	/ get the base table entry		/A271
	DCA	PLILQP		/ SAVE IT as a parameter		/a271
	JMS	BHOOK		/ call the blaster to load the table 	/a271
PLILQP,	0			/ put the table entry here		/a271
	
	JMP I	PLINIT		/ RETURN FROM PLINIT			/C211

/ THIS IS THE LOGIC TO DETERMINE WHICH TYPE B OVERLAY TO LOAD	/A243
/EITHER LQPSE, LQP02 NORMAL, OR LQP02 SQUISH...				/A243

PRJL9B,				/					/M227
	TAD	(OB2L10-OB3L10)	/ NORMAL JUSTIFICATION
	TAD	(OB3L10-OBJL10)	/ SQUISH LINE JUSTIFICATION
PRJL9C,	TAD	(OBJL10)	/ LQPSE
	DCA	PRJLBO		/ SAVE BLOCK OFFSET			/A143
	TAD	(OVJL10		/ (SAME AS OV2L10 AND OV3L10)		/A143
	JMS	PROV							/A143
PRJLBO,		XX		/	BLOCK OFFSET			/A143

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

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

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM
OVJUSD=.-OVRLCA
OBJUSD=OVTYPE+OVNUM

/THIS OVERLAY IS USED FOR MATRIX PRINTERS AND DD HOST

/THIS OVERLAY IS RESPONSIBLE FOR JUSTIFYING (IF NECESSARY) AND PRINTING
/THE LINE OF TEXT WHICH HAS BEEN ASSEMBLED IN PRLBUF BY PRGTLN
/EXTERNAL ARGUMENT USED BY JUSTIFICATION OVERLAYS:

/PLPTR - A POINTER INTO THE LINE BUFFER.  INITIALLY, IT POINTS AT THE LAST
/         CHARACTER IN THE LINE, WHICH IS THE RETURN.

/PRLBUF - A LITERAL WHICH IS THE ADDRESS OF THE BEGINNING OF THE BUFFER; IT
/         IS THE ADDRESS AT WHICH THE FIRST CHARACTER IS STORED.

/PRQPIT - THE PITCH VALUE.  IT IS ZERO IF PROPORTIONAL PITCH IS SPECIFIED,
/         NON-ZERO OTHERWISE.

/PRRM   - THE JUSTIFICATION FLAG.  IT IS ZERO IF THE LINE IS NOT TO BE
/         JUSTIFIED; OTHERWISE, IT THE LENGTH OF THE LINE IN PRINT UNITS.

/PLNRCS - CHARACTER SIZE.  IT IS THE SIZE OF A CHARACTER IN PRINT UNITS.

/PRCCH  - PRINT HEAD POSITION.  INITIALLY, IT IS THE POSITION THE PRINT
/         HEAD IS IN.

/SOME DEFINITIONS WILL MAKE THE COMMENTS EASIER TO FOLLOW:

/CHARACTER - ONE OF THE ASCII VALUES WHICH FILL THE LINE BUFFER.  THE
/     POSSIBLE CHARACTERS ARE BACK SPACE, TAB, SPACE, AND TEXT.  THE
/     LAST POSITION IN THE LINE BUFFER IS FILLED BY A RETURN, WHICH IS
/     NOT A CHARACTER.

/DEAD KEY SEQUENCE - A SEQUENCE OF TEXT DELIMITED BY BACK SPACES
/     (I.E., TEXT1 BS TEXT2 BS TEXT3).  SUCH SEQUENCES ARE PRINTED WITH
/     THE CHARACTERS SUPERIMPOSED.

/POSITION - ALL THE CHARACTERS WHICH MAP TO THE SAME PHYSICAL PLACE ON
/     THE PRINTED PAGE ARE SAID TO BE THE SAME POSITION.  THEREFORE,
/     ALL THE CHARACTERS IN A DEAD KEY SEQUENCE ARE A POSITION.  A CHARACTER
/     WHICH IS NOT PART OF A DEAD KEY SEQUENCE IS A POSITION.  IN THIS
/     CODE, WE JUSTIFY BY POSITIONS; WE FIND THE WIDTH OF POSITIONS.  IT
/     IS AN IMPORTANT CONCEPT.

/WIDTH - THE SPACE OCCUPIED BY A POSITION WHEN IT IS PRINTED.  IN
/     NON-PROPORTIONAL PRINTING, THE WIDTH IS STANDARD (PLNRCS).  IN
/     PROPORTIONAL PRINTING, THE WIDTH VARIES DEPENDING ON THE CHARACTERS
/     IN THE POSITION.

/TEXT - ANY PRINTABLE ASCII CHARACTER


/WE ALSO MAKE SOME ASSUMPTIONS:

/1.  THE ONLY CHARACTERS IN THE BUFFER ARE RETURN, BACK SPACE, TAB, SPACE,
/    AND TEXT.

/2.  THE ONLY PLACE BACK SPACES OCCUR ARE BETWEEN TEXT.

/ THIS OVERLAY IS USED FOR MATRIX PRINTERS AND DD HOST			/A211
/PLPTR currently addresses the return word in the buffer.  Bit 1 of this word
/is clear for a hard return and is set otherwise.  We save the type of the
/return for later use.

	AC2000			/GET A MASK FOR THE SOFT RETURN BIT
	AND I	PLPTR		/SEE IF SOFT RETURN
	DCA	PRJRET		/RECORD THE TYPE OF RETURN.
				/PRJRET=2000 FOR SOFT RETURN
				/PRJRET=0000 FOR HARD,CENTERING, OR PARA MARKER

	AC0001			/ INSURE PROPORTIONAL PRINTING OFF	/A219
	DCA	PLPFLG		/ PROPORTIONAL PRINTING OFF--OVJUSD	/A219

									/A080
	DCA	PLBOLD	/Reset SP PROPORTIONAL LQP02 flag.		/A086

/We now set up some variables in order to process the line.  We want the
/following conditions to hold:

/PLPTR - Points to the return character (this already holds)

/PLCNT - Is the negative of the number of characters, including the return,
/		in the line.

/PLDIR - Is minus one so that processing can proceed from right to left.

PRJD0A,								/A211
	TAD	PLPTR	/Subtract the address of the return, and one more
	CMA
	TAD   (PRLBUF)	/From the address of the first character
	DCA	PLCNT	/And save as the buffer count

	AC7777
	DCA	PLDIR	/Set the direction of printing


/If the line ends with a soft return, we now strip all trailing spaces, tabs,
/and backspaces from the line.  If the line ends with a hard return, we do
/not strip these characters.  We strip in case of soft return because the
/trailing spaces interfere with justification, and should not appear in case
/the line is underlined.  In either case, when the loop is over, the following
/conditions will hold:

/1.  PLPTR will point to the right most character of the line which should
/	be printed (which will be a text character in case of a soft return
/	and the one before the return for a hard return).

/2.  PLCNT will be the negative of the number of characters from the beginning
/	of the buffer to the character pointed to by PLPTR.

PRJD0,
	JMS	PLNXT	/Look at the next character
	JMP	PRGSL1	/No more characters so the line was all blank--no
			/need to bother printing the line

	TAD	PRJRET		/WAS IT A SOFT RETURN?
	SNA CLA
	JMP	PRJD1		/NO, NO NEED TO STRIP TRAILING SPACES

	TAD I	PLPTR	/Get the character
	AND	P177	/Strip the mode bits
	TAD	(-SPC)	/Is it a space/tab/backspace?
	SPA SNA CLA	/skip if positive AND non-zero
	JMP	PRJD0	/Yes--continue stripping the line

/The line was not blank and must be printed.  We now initialize some variables
/used to gather information about the line for printing and justification.

PRJD1,
	TAD	PLCNT
	DCA	PRLBCT	/Save the stripped size of the line

	DCA	PLPS	/Clear position justification spacing
	DCA	PLSS	/Clear space justification spacing

	AC7777
	DCA	PRJPOS	/Initialize number of inter-position spaces
	DCA	PRJSPC	/Clear number of spaces

	DCA	PRRCH	/Clear right end of line position
	DCA	PRPASS	/Clear the pass counter

	DCA	PRJDEF	/Clear deficiency (no justification required yet)/A080

/This loop gathers information about the spacing and composition of the
/line by processing the characters from left to right.  When the loop
/completes, we will know:

/PRRCH - The offset of the right end of the line from the left margin in
/		elementary print units.

/PRJPOS - The number of inter-position spaces in the justifiable portion
/		of the line.

/PRJSPC - The number of spaces in the justifiable portion of the line.

/The loop also marks each character in the justifiable portion of the line
/by setting bit 0 of the character.  The justifiable portion of the line is
/that part which follows the rightmost tab space.

	AC4000		/We first set the count enable flag.  This flag is
	DCA	PRJENB	/to mark justifiable characters and is examined when
			/deciding whether to count them.  It is ultimately
			/cleared when the first tab is encountered.

/At the beginning of each iteration, PLPTR points to the first character in a
/position.  Each iteration treats the entire position with all of its dead
/keys, if any.

PRJD2,
	TAD I	PLPTR	/Get the character
	AND	P177	/Strip the mode bits

	TAD	(-SPC)	/Is it a space?
	SZA CLA
	JMP	PRJD3	/No, a text--jump to treat it

/The character is a space.  If it is part of a tab, the enable flag must be
/cleared.  If the enable flag has not been cleared by this time, we increment
/the number of justifiable spaces and fall through to the text counter.

	TAD I	PLPTR	/Retrieve the space character
	CMA RAL		/AC0=0 if the space is part of a tab, 1 otherwise
	AND	PRJENB	/AC=4000 if counting should still be enabled

	SZA		/Do not count the space if we are disabled
	ISZ	PRJSPC	/Increment the space count if we are enabled
	DCA	PRJENB	/And save the new enable flag

/This section handles characters.  If the enable flag is set, we count the
/position.

PRJD3,
	TAD	PRJENB	/Get the enable flag
	SZA CLA		/If the flag is clear, don't count the position

	ISZ	PRJPOS	/Increment the number of inter-position spaces
	NOP		/In case it skips (since it is initialized to -1)


/ NOW GET THE WIDTH OF THE POSITION.  IN THE CASE OF THE DP OR HOST
/ WE CAN SIMPLY GET THE VALUE PLNRCS.  IF AND WHEN MATRIX PRINTERS
/ CAN DO PROPORTIONAL PRINTING WE WILL HAVE TO DO SOMETHING DIFFERENT,
/ POSSIBLY JMS PLSPCX AS IS DONE FOR LQPS

	TAD	PLNRCS	/GET POSITION WIDTH				/C211

	TAD	PRRCH	/Update the right end measure
	DCA	PRRCH

/We now enter a sub-loop which moves the buffer pointer to the first
/character of the next position.  It also marks each non-backspace character
/as justifiable or not with the enable flag.  When we reach the next position,
/we continue the main loop.  If we just treated the last position, we leave
/the main loop and continue with processing.

PRJD4,
	TAD I	PLPTR	/Get the character
	TAD	PRJENB	/Mark it with the enable flag
	DCA I	PLPTR	/Save the character back into the buffer

PRJD4A,	JMS	PLCHBS	/Are there more characters?
	JMP	PRJD5	/No--leave the loop
	JMP	PRJD4A	/YES, A multinational PRECEDENCE		/A271
	JMP	PRJD4A	/YES, A TECHNICAL PRECEDENCE			/A233
	JMP	PRJD4	/Yes, in this position--continue the inner loop
	JMP	PRJD2	/Yes, in a new position--continue the outer loop


PRJD5,		/THE LINE HAS BEEN COMPLETELY MEASURED

/THIS SECTION PRINTS LINES TO A DRAFT PRINTER.
/MULTIPLE HITS AND UNDERLINING ARE HANDLED
/BY MAKING MULTIPLE PASSES THROUGH THE LINE.

/First, we determine whether or not justification is needed.

	TAD	PRBIF		/ GET BOLD INTERPRETATION FLAG		/A152
	SZA CLA								/A152
	AC2000			/ MASK AC1				/A152
	CMA			/ EITHER CLEAR IT OR LEAVE ALONE	/A152
	DCA	PRBIFM		/ SAVE AS BIT MASK			/A152

	DCA	PLSSC		/ CLEAR THE JUSTIFICATION REMAINDER
	DCA	LPUPAS		/ ZERO THE PASS COUNTER FOR UNDERLINES

	TAD	PRJRET		/ IS IT A SOFT RETURN?
	SNA CLA
	JMP	DPLIN0		/ NO, NO JUSTIFICATION NEED BE DONE

	TAD	PRJSPC	/Are there any justifiable spaces?
	SNA CLA
	JMP	DPLIN0	/No--no justification can be done

	TAD	PRRM	/Does the ruler specify justification?
	SNA
	JMP	DPLIN0	/No--no need to do justification

/The AC now contains the desired justified line length.  We subtract that
/from the current line length to obtain the amount of deficiency.

	CIA
	TAD	PRRCH	/Subtract from  the current line length	
	SMA
	JMP	DPLIN0	/Line is already long enough or too long
	DCA	PRJDEF	/Save the negative of the deficiency

/We now divide the deficiency among the spaces.  The remainder is the negative
/of the number of additional space units which must be inerted, minus one.

	TAD	PRJSPC	/Divide the deficiency between the spaces
	JMS	PRDVID
	DCA	PLSS	/Save as the increased spacing to do

	TAD	PRJDEF	/Get the remainder
	DCA	PLSSC	/Save as the correction factor


DPLIN0,	CLA
	TAD	PRLBCT	/RESTORE THE CHARACTER COUNT FOR THE LINE
	DCA	PLCNT

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

	TAD	PLSSC	/SAVE THE JUSTIFICATION REMAINDER
	DCA	LPSSC

	TAD	PLSS	/SAVE THE JUSTIFICATION VALUE
	DCA	LPSS

	AC0001
	DCA	PLDIR	/SET THE DIRECTION OF MOTION

/GO SET UP THE UPPER FIVE BITS IN THE EACH CHARACTER IN THE LINE.
/THIS MASSAGES EACH CHARACTER IN THE LINE AND SETS UP THE BITS FOR EACH
/CHARACTER'S ATTRIBUTES. THEY ARE AS FOLLOWS: BIT 0 IS FOR A JUSTIFIABLE SPACE
/WHICH MEANS IT MAY HAVE OTHER SPACES ADDED TO IT TO SPACE JUSTIFY A LINE.
/BITS 1 & 2 ARE THE HIT BITS. BIT 1 IS FOR BOLD, BIT 2 IS FOR DOUBLE DARK. THEY
/MEAN THAT A CHARACTER MIGHT BE HIT FROM 1 TO 4 TIMES DEPENDING ON THE BINARY
/COUNT IN BITS 1 & 2. 0 0 MEANING ONE HIT, 0 1 MEANS TWO HITS, 1 0 MEANS THREE
/HITS, AND 1 1 MEANS FOUR HITS. THIS IS FROM THE PRINT MENU (DA=DARK OR NORMAL)
/AND THE BOLD BIT FROM THE EDITOR.

/BITS 3 & 4 ARE DECODED AS FOLLOWS:
/ 0 0 IS NORMAL, 0 1 IS UNDERLINE, 1 0 IS SUPERSCRIPT, AND 1 1 IS SUBSCRIPT.

	JMS	DPLIN1

/NOW LOAD THE B OVERLAY WHICH CONTAINS THE SUBROUTINES,
/AND THE C OVERLAY WHERE THENCE WE SHALL GO....

	CLA		/GOING TO PROV WITH A CLEARED AC ONLY LOADS.
	JMS	PROV
		OBDPL1

	TAD	(OVDPL1
	JMS	PROV
		OBDPL2	/GO TO OVERLAY C

/THE FOLLOWING DPLN JUSTIFICATION VARIABLES MUST APPEAR IN THE FIRST	/A215
/OF THE DPLN JUSTIFICATION OVERLAYS TO AVOID FORWARD REFERENCES TO	/A215
/OVERLAY VARIABLES WHICH ARE NOT LOADED YET ...				/A215

LPSS,	0	/Saves the value of PLSS between passes
LPSSC,	0	/Saves the value of PLSSC  between passes
PLSSC,	0	/Remainder
LPPASS,	0	/After a pass, is non-zero if another pass is needed
LPUPAS,	0	/Pass # (used to count how many times to bold the undrlns)/A092
PRBIFM,	0	/ MASK FOR #DARKNESS PASSES IF PRBIF>0			/A152
SISOFG,	0	/SHIFT IN SHIFT OUT FLAG. SET WHEN NEEDED FOR CODE 23
CHGSET,	0	/FLAG FOR CHANGING TO ORIGINAL G SET AFTER PRINTING
TCHBLD,	0	/FLAG FOR TECH CHARACTERS AND ELIMINATING BOLD INTERPRETATION.
CURPOS,	0	/CURRENT POSITION. +1 UP 1/2; 0 IS ON LINE;-1 IS	/A222
		/DOWN A HALF OF A LINE					/A222
PPUNDL,	0	/UNDERLINE PRINTED FLAG
LBADR,	"B&177+4000
/---------------
	PAGE

/IN ORDER TO FACILITATE THE MULTIPLE PASS STRATEGY, THE MODE BITS OF
/EACH CHARACTER MUST BE REARRANGED.  UPON CALL, THE MODE BITS OF EACH
/CHARACTER ARE:

/AC  2  3			AC  4
/    0  0   NORMAL		    0     NOT BOLD
/    0  1   UNDERSCORE		    1     BOLD
/    1  0   SUPERSCRIPTED
/    1  1   SUBSCRIPT


/THE MODE SETTINGS WHICH THIS CODE UNDERSTANDS ARE:

/AC  0
/    0   THIS CHARACTER IS NOT A SPACE
/    1   THIS CHARACTER IS A REAL SPACE THAT IS JUSTIFIABLE

/AC  1  2
/    0  0   ONE HIT (NORMAL TEXT)
/    0  1   TWO HITS (NON-BOLDED, EXTRA DARK TEXT)
/    1  0   THREE HITS (BOLDED, NON-EXTRA DARK TEXT)
/    1  1   FOUR HITS (BOLDED, EXTRA DARK TEXT)

/NOTICE THAT, IN ESSENCE, AC1 IS THE BOLD BIT AND AC2 IS THE DARKNESS BIT.
/THE COMBINATION OF AC1 AND AC2 ARE CALLED THE HIT BITS; TAKEN TOGETHER,
/THEY INDICATED ONE LESS THAN THE NUMBER OF PASSES IN WHICH A CHARACTER
/SHOULD BE PRINTED TO OBTAIN THE DESIRED BOLDNESS/DARKNESS.


/THE COMBINATIONS OF AC BITS 3 AND 4 ARE FOR UNDERLINING, SUPERSCRIPTING,
/AND SUBSCRIPTING. THE COMBINATIONS ARE AS FOLLOWS;
/AC  3  4
/    0  0   NO SUBSCRIPT/SUPERSCRIPT, OR UNDERLINING.
/    0  1   UNDERLINE
/    1  0   SUPERSCRIPT
/    1  1   SUBSCRIPT

/THIS LOOP PROCESSES EACH CHARACTER IN THE LINE IN TURN AND REARRANGES ITS
/MODE BITS. IT PRESERVES BIT 0 WHICH WAS PREVIOUSLY DONE.

DPLIN1,	XX
DPLI1A,	DCA	MODBTS	/CLEAR THE MODE BITS OF THE WORD TO BE BUILT	/A215

/FIRST DO SUPER AND SUB BITS						/A215
	TAD I	PLPTR	/GET THE WORD FROM THE BUFFER
	AND	(1400)	/MASK OFF SUPER AND SUB BITS			/A215
	CLL RAR		/SLIDE THEM OVER TO THE RIGHT ONE POSITION	/A215
	JMS	ADDBTS	/ADD THEM TO MODBTS				/A215

/NOW DO DARKNESS BIT							/A215
	TAD	PRQOVP	/CHECK FOR DARKNESS FLAG			/A215
	SZA CLA		/SKIP IF NOT EXTRA DARK				/A215
	TAD	(1000)	/SET THE DARKNESS BIT				/A215
	JMS 	ADDBTS	/ADD THE DARKNESS BIT				/A215

/NOW DO BOLD BIT							/A215
	TAD I	PLPTR	/GET THE CHARACTER AND CHECK FOR BOLD		/A215
	AND	(200)	/BOLD BIT MASK					/A215
	R3L		/POSITION TO BIT 1				/A215
	JMS	ADDBTS	/ADD THE BOLD BIT				/A215

/NOW DO THE JUSTIFICATION BIT. SPACES WITH BIT 0 SET CONTRIBUTE TO
/JUSTIFICATION. KEEP BIT ZERO ONLY IF CHARACTER IS A SPACE.
	TAD I	PLPTR	/GET THE CHARACTER
	AND	P177
	TAD	(-SPC)
	SZA CLA
	JMP	DPLI1B	/NOT A SPACE
	TAD I	PLPTR	/GET BIT 0 BACK
	AND	(4000)
	JMS	ADDBTS

/NOW STRIP THE OLD MODE BITS AND INSTALL THE NEW MODE BITS		/A215
DPLI1B,	TAD I	PLPTR	/GET CHR BACK					/C215
	AND	P177	/STRIP OLD MODE BITS
	TAD	MODBTS	/GET NEW MODE BITS FROM ADDBTS			/A215
	DCA I	PLPTR	/SAVE THE NEW CHARACTER WITH THE MODE BITS	/C215

/WE HAVE NOW COMPLETELY PREPROCESSED THE CHARACTER.
/GET ANOTHER AND CONTINUE THIS LOOP
	JMS	PLNXT	/POINT TO THE NEXT CHARACTER
	JMP I	DPLIN1	/THERE ARE NO MORE--LEAVE THE LOOP		/C117
	JMP	DPLI1A	/CONTINUE THE LOOP

ADDBTS,	XX
	TAD	MODBTS
	DCA	MODBTS	/EXIT WITH CLEAR AC
	JMP I	ADDBTS

MODBTS,	0	/STORAGE FOR MODEBITS

/RESET POINTERS FOR THE PRINT LINE

LPRSTP,	TAD	PRMCLM	/GET CURRENT MULTICOLUMN MARGIN			/A212
	JMS	LPIND	/INDENT THE MARGIN				/A143

	TAD	LPSSC	/RESET THE EXTRA JUSTIFY SPACE COUNT
	DCA	PLSSC

	TAD	LPSS	/RESET THE JUSTIFICATION VALUE
	DCA	PLSS

	TAD   (PRLBUF)	/RESET THE POINTER TO THE BEGGINING OF THE BUFFER
	DCA	PLPTR

	TAD	PRLBCT	/RESET THE CHARACTER COUNT
	DCA	PLCNT

	DCA	LPPASS	/CLEAR THE NEXT PASS DETECTION TEMPORARY--IF THIS
			/IS NON-ZERO AT THE END OF THE PASS, ANOTHER PASS
			/IS NECESSARY
	DCA	TCHBLD	/CLEAR THIS FLAG
	JMP	DPLIN3

/HERE FOR A CONTROL CHARACTER 21. SEE IF TEXT IS TO HOST. IF SO, THEN
/GET NEXT CHARACTER AND PRINT IT. IF NOT, CHECK FOR PROPER "G" SET SELECTED.
/IF LOCATION PCHBFO CONTAINS EITHER AN ASCII "A" OR "B", THEN PRINT
/SO,CHR,SI. IF PCHBFO DOES NOT CONTAIN EITHER "A" OR "B", THEN CHANGE TO
/B SET, PRINT SO,CHR,SI, AND RETURN TO THE OLD CHARACTER SET.

/CHECK TO SEE IF NEXT CHARACTER HAS UNDL ATTRIBUTES.
/IF SO THEN DON'T DO A THING UNTIL UNDERLINE HAS GONE.

DPLI4E,	JMS	SKNHST	/SKIP IF NOT HOST				/A235
	JMP	DPLI4M	/IS HOST					/A235

	JMS	NCFNDL
	JMP	DPLIN9	/RETN 1:  IS UNDERLINE DON'T CHANGE G SET.
	TAD	PCHFBO	/RETN 2:  NO UNDL  SEE IF CHARACTER SET CHANGE IS NEEDED.
	TAD	(-"B+200) /IF CHARACTER IS B OR A, THEN NO CHANGE NEEDED.
	SZA
	IAC
	SNA CLA
	JMP	DPLI4F	/IS A. OR B. AS ABOVE

	AC7777		/SET FLAG TO INDICATE THAT WE HAVE CHANGED.
	DCA	CHGSET
	TAD	(LBADR)	/HAVE TO CHANGE.
	JMS	PRESCS
		PCSTG1
DPLI4F,	AC7777
	DCA	SISOFG	/SET FLAG TO SPAN CHARACTER WITH SO,CHR,SI
	JMP	DPLIN8	/EXIT AND DECREMENT THE HIT BITS

DPLI4M,	JMS	PGCHAR	/GET NEXT CHARACTER				/A235
	TAD	(-57)	/MAGIC NUMBER TO TRANSFORM THE GNOME TO A DWARF	/A235

DPLI4J,	AND	P377	/MAKE 7 BITS					/MRCM/A235
	JMS	PRCHAR							/A235
	JMP	DPLIN9	/EXIT TO NEXT ONE.				/A235

/HERE IF CODE 22

DPLI4C,	JMS	SKNHST	/SKIP IF NOT HOST				/A234
	JMP	DPLI4N	/YES						/A234

DPLI4G,	JMS	NCFNDL
	JMP	DPLIN9	/RETN 1:  IS UNDERLINE DON'T CHANGE G SET.
	TAD I	PLPTR	/RETN 2:  NO UNDL  SEE IF CHARACTER SET CHANGE IS NEEDED.
	AND	P177	/MASK OFF MODE BITS
	TAD	(XSSS2-22)
	JMS	PRESCS
		PCSS	/CHANGE TO G2 OR G3
	CLA
	JMP	DPLIN8	/EXIT AND DECREMENT THE HIT BITS

DPLI4N,	JMS	PGCHAR	/GET CHARACTER					/A234
	JMS	PSETP	/ADJUST BUFFER ADDRESS				/A234
	SNA CLA								/A234
	JMP	DPLI4K							/A234
	TAD I	T1	/GET ADDRESS OF CHAR IN BUFFER			/A234
DPLI4D,	DCA	T1							/A234
DPLI4K,	TAD I	T1	/GET CHARACTER					/A234
	JMP	DPLI4J	/PRINT IT.					/A234

/HERE IF CODE 23

DPLI4H,	JMS	SKNHST	/SKIP IF NOT HOST				/A234
	SKP								/A234
	JMP	DPLI4G	/NO						/A234

	JMS	PGCHAR							/A234
	JMS	PSETP	/ADJUST BUFFER ADDRESS				/A234
	SNA CLA								/A234
	JMP	DPLI4K	/CHARACTER					/A234
	TAD I	T1	/GET ADDRESS OF CHARACTER			/A234
	IAC		/BUT WHAT WE NEED IS NEXT LOCATION		/A234
	JMP	DPLI4D							/A234
/---------------
	PAGE

	OVTYPE=OLB
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM
OVDPL1=.-OVRLCA
OBDPL1=OVTYPE+OVNUM

LPSUPR,	TAD	CURPOS	/SEE IF REPOSITIONING NEEDED			/A222
	SPA		/IF +1, NOT NEEDED, IF 0, GO UP 1;IF -1, GO UP 2/A222
	JMS	MOVEUP	/GO UP TWO BECAUSE NOW AT SUBSCRIPT POSITION	/A222
	SZA CLA		/ARE WE THERE ALREADY?				/A222
	JMP	DPLIN5	/YES, EXIT AND PRINT CHARACTER			/A222
	JMS	MOVEUP	/MOVEUP CLEARS AC SO DO IT AGAIN		/A222
	JMP	DPLIN5	/EXIT AFTER TWO HALF MOVES UP.			/A222

LPSUB,	TAD	CURPOS	/SEE IF WE NEED TO GO DOWN THE PAGE		/A222
	SPA		/+1, DOWN 2; 0, DOWN 1; -1, ALREADY THERE	/A222
	JMP	DPLIN5	/EXIT						/A222
	SZA		/DOWN 1 OR 2					/A222
	JMS	MOVEDN	/GO DOWN ONE HALF LINE				/A222
	JMS	MOVEDN	/GO DOWN ANOTHER HALF LINE			/A222
	JMP	DPLIN5	/EXIT						/A222

MOVEDN,	XX		/MOVE DOWN ONE HALF LINE			/A222
	AC7777		/SUBTRACT ONE FROM CURRENT POSITION		/A222
	TAD	CURPOS							/A222
	DCA	CURPOS	/CORRECTED BY SUBTRACTING 1			/A222
	JMS	PRESCS	/CALL TO WPRINT					/A222
		PCPLD	/ESCAPE SEQUENCE AND MOVE DOWN			/A222
	CLA
	JMP I	MOVEDN	/EXIT						/A222

MOVEUP,	XX								/A222
	AC0001
	TAD	CURPOS	/GET CURRENT POSITION				/A222
	DCA	CURPOS	/TRIPLE PRECISION FLOATING DEPOSIT		/A222
	JMS	PRESCS	/CALL TO WPRINT					/A222
		PCPLU	/UP						/A222
	CLA
	JMP I	MOVEUP	/EXIT						/A222

CFUNDL,	XX
	TAD I	PLPTR
	AND	(0200)	/MASK UNDL BIT AND SUB BIT.
	SNA CLA
	JMP	CFUND1	/NO UNDERLINE, RETURN +2
	TAD I	PLPTR	/MAYBE UNDERLINE OR SUB
	AND	(0400)	/LOOK AT SUB BIT
	SZA CLA
CFUND1,	ISZ	CFUNDL	/BUMP RETURN TO +2. NO UNDERLINE ATTRIBUTES ON CHAR.
	JMP I	CFUNDL	/EXIT EITHER PLUS 1 OR 2

/THIS IS THE CHECK FOR UNDERLINE SUBROUTINE. IF THE SUCCEEDING CHARACTER IN
/THE LINE HAS AN UNDERLINE ATTRIBUTE, THEN TAKE NORMAL EXIT. IF NO UNDERLINE
/ATTRIBUTE, THEN TAKE EXIT +2.

NCFNDL,	XX		/CHECK NEXT CHARACTER FOR UNDERLINE ATTRIBUTES.
	AC7776		/SET SWITCH TO -2
	DCA	TCHBLD	/FOR A CONTROL CHARACTER, TECH CHARACTER COMBINATION
	ISZ	PLPTR	/IF RETURN +1, YES; IF RETURN +2, NO.
	JMS	CFUNDL
	SKP		/YES, UNDL ATTRIBUTES
	ISZ	NCFNDL	/NO UNDL ATTRIBUTES
	AC7777		/BACK POINTER UP
	TAD	PLPTR
	DCA	PLPTR
	JMP I	NCFNDL

/HERE TO PRINT UNDERLINES.
/PRINT THE UNDERLINE WHEN ENCOUNTERED UNTIL THE HIT COUNT EQUALS THE
/NUMBER IN "LPUPAS". LPUPAS STARTS AT ZERO AND INCREMENTS AT THE END OF
/EACH LINE. WHEN THE HIT COUNTS EQUAL THE COUNT IN LPUPAS, THEN REMOVE
/THE UNDERLINE ATTRIBUTE FROM THE CHARACTER AND CONTINUE ON NORMALLY.

PUNDL,	TAD	(UNDL)
	MQL		/LOAD MQ WITH UNDL, THE CONTENTS OF THE MQ GET PRINTED
	AC7777
	DCA	PPUNDL	/SET FLAG THAT SAYS WE PRINTED AN UNDERLINE
	TAD I	PLPTR	/NOW CHECK THE HIT COUNT AGAINST LPUPAS
	AND	(3000)	/MASK HIT BITS
	R3L		/PUT TO BITS 10,11
	CMA IAC		/NEGATE
	TAD	LPUPAS
	SZA CLA		/SKIP IF EQUAL
	JMP	PUNDL1	/NOT EQUAL, CONTINUE TO NEXT CHARACTER		/C246
	TAD I	PLPTR	/HITS EQUAL LPUPAS
	AND	(7577)	/REMOVE UNDERLINE ATTRIBUTE
	DCA I	PLPTR	/PUT BACK STRIPPED CHARACTER

PUNDL1,	DCA	PRBIC	/CLEAR BOLD INTERPRETATION FLAG			/A246
	TAD	PRBIF	/THIS IS TO GET THE CORRECT UNDERLINE IN THE	/A246	
	SZA CLA		/CORRECT FONT. MUST CHANGE FONTS IF NECESSARY	/A246
	JMS	LPBI							/A246
	JMP	DPLI5D							/A246

/THESE ROUTINES ARE USED TO SPAN A CHARACTER WITH SO,CHR,SI

/PRINT SHIFT OUT ROUTINE

PRSO,	XX		/CHECK TO SEE IF PRINT SO, CHAR, SI
	TAD	SISOFG	/IS SO,CHR,SI FLAG SET?
	SNA CLA
	JMP	PRSO1
	TAD	(SO)	/GET SHIFT OUT
	JMS	PRCHAR
PRSO1,	CLA
	JMP I	PRSO

PRSI,	XX		/DID WE PRINT SO?
	TAD	SISOFG
	SNA CLA
	JMP I	PRSI	/NO JUST EXIT

	TAD	(SI)	/GET SHIFT IN.
	JMS	PRCHAR
	CLA
	DCA	SISOFG	/CLEAR THE FLAG THAT GOT US HERE.
	TAD	CHGSET	/SEE IF WE MUST RESTORE THE OLD G SET.
	SNA CLA
	JMP I	PRSI	/NO EXIT

	DCA	CHGSET	/CLEAR IT
	TAD	(PCHFBO)
	JMS	PRESCS
		PCSTG1
	CLA
	JMP I	PRSI	/EXIT

PSETP,	XX								/A235
	AND	P177	/ADJUST CHARACTER TO SEVEN BITS			/A235
	TAD	(TCKBTB-41)	/ADJUST ADDRESS TO BEGINNING OF TABLE	/A235
	DCA	T1							/A235
	TAD I	T1							/A235
	AND	(7400)	/SEE IF IT IS THE CHARACTER OR AN ADDRESS	/MRCM/A235
	JMP I	PSETP							/A235
/------------------------
	PAGE

/***********************************************************************/
/									/
/	TCKBTB--TECHNICAL CHARACTER TO KEYBOARD CONVERSION TABLE	/
/		USED TO CONVERT TECHNICAL CHARACTERS BACK TO THE	/
/		ASCII KEY CODE WHICH WAS TYPED WHEN THEY WERE INSERTED	/
/		INTO THE WPS DOCUMENT.  USED WHEN DD=CHST, REAL HOST	/
/		APPLICATION.						/
/									/
/		NOTE THAT THERE ARE 94 ENTRIES IN THIS TABLE IN		/
/		THE RANGE FROM 41-176 OCTAL				/
/									/
/		THE LOGIC LOOKS AT THE PRECEDENCE CODE.			/
/		IF IT IS 21, SUBTRACT 57 AND OUTPUT THE NEXT CHARACTER.	/
/		IF IT IS 22 OR 23 IT READS THIS TABLE./
/		IF THE ENTRY FOUND IS AN ASCII CHR IT JUST OUTPUTS	/
/		THAT CHR.						/
/		IF THE ENTRY FOUND IS GREATER THAN 377 IT IS A POINTER	/MRCM
/		TO A TWO WORD TABLE.  THE FIRST WORD IS THE CHARACTER	/
/		TO OUTPUT IF THE PRECENCE CODE WAS 22, THE SECOND WORD	/
/		IS THE CHARACTER TO OUTPUT IF THE PRECENCE CODE WAS 23.	/
/									/
/***********************************************************************/

TCKBTB,	IFDEF ENGLSH <
	61	/41 - RADICAL
	41	/42 - TOP LEFT RADICAL
	70	/43 - HORIZONTAL CONNECTOR
	46	/44 - TOP INTEGRAL
	67	/45 - BOTTOM INTEGRAL
	52	/46 - VERTICAL CONNECTOR
	TCK47	/47 - SECTION (22) OR TOP LEFT BRACKET (23)
	55	/50 - BOTTOM LEFT BRACKET
	53	/51 - TOP RIGHT BRACKET
	75	/52 - BOTTOM RIGHT BRACKET
	50	/53 - TOP LEFT PARENTHESIS
	71	/54 - BOTTOM LEFT PARENTHESIS
	51	/55 - TOP RIGHT PARENTHESIS
	70	/56 - BOTTOM RIGHT PARENTHESIS
	63	/57 - LEFT MIDDLE CURLY BRACE

	TCK60	/60 - DEGREE (22) OR RIGHT MIDDLE CURLY BRACE (23)
	TCK61	/61 - PLUS/MINUS (22) OR TOP LEFT SUMMATION (23)
	66	/62 - BOTTOM LEFT SUMMATION
	176	/63 - TOP SLANT SUMMATION CONNECTOR
	140	/64 - BOTTOM SLANT SUMMATION CONNECTOR
	TCK65	/65 - MU (22) OR TOP RIGHT SUMMATION (23)
	TCK66	/66 - PARAGRAPH (22) OR BOTTOM RIGHT SUMMATION (23)
	TCK67	/67 - MIDDLE DOT (22) CENTER SUMMATION (23)
	54	/70 - LEFT SQUARE BRACKET (ASCII)
	42	/71 - CENTERED DOT
	56	/72 - RIGHT SQUARE BRACKET (ASCII)
	45	/73 - PLUS/MINUS
	74	/74 - LESS THAN OR EQUAL
	134	/75 - NOT EQUAL
	76	/76 - GREATER THAN OR EQUAL
	174	/77 - SMALL FULL INTEGRAL


	100	/100 - THEREFORE (3 DOTS)
	126	/101 - VARIATION, PROPORTIONAL TO
	102	/102 - INFINITY
	47	/103 - DIVIDED BY
	127	/104 - CAPITAL DELTA
	101	/105 - NABLA, DEL
	104	/106 - CAPITAL PHI
	121	/107 - CAPITAL GAMMA
	116	/110 - CONGRUENT, VARIES AS, IS APPROXIMATE TO
	132	/111 - SIMILAR OR APPROXIMATELY EQUAL
	122	/112 - CAPITAL THETA
	166	/113 - TIMES, CROSS PRODUCT
	107	/114 - CAPITAL LAMBDA
	175	/115 - IF AND ONLY IF
	135	/116 - IMPLIES
	130	/117 - IDENTICAL TO

	173	/120 - CAPITAL PI
	103	/121 - CAPITAL PSI
	157	/122 - DEGREE
	123	/123 - CAPITAL SIGMA
	113	/124 - SECTION SYMBOL
	110	/125 - PARAGRAPH SYMBOL
	62	/126 - RADICAL
	114	/127 - CAPITAL OMEGA
	125	/130 - CAPITAL XI
	131	/131 - CAPITAL UPSILON
	77	/132 - IS INCLUDED IN
	57	/133 - INCLUDES
	112	/134 - INTERSECTION
	152	/135 - UNION
	72	/136 - LOGICAL AND
	73	/137 - LOGICAL OR

	106	/140 - LOGICAL NOT
	141	/141 - LOWER CASE ALPHA
	142	/142 - LOWER CASE BETA
	170	/143 - LOWER CASE CHI
	167	/144 - LOWER CASE DELTA
	145	/145 - LOWER CASE EPSILON
	144	/146 - LOWER CASE PHI
	161	/147 - LOWER CASE GAMMA
	150	/150 - LOWER CASE ETA
	151	/151 - LOWER CASE IOTA
	162	/152 - LOWER CASE THETA
	153	/153 - LOWER CASE KAPPA
	147	/154 - LOWER CASE LAMBDA
	155	/155 - LOWER CASE MU
	156	/156 - LOWER CASE NU
	115	/157 - PARTIAL DERIVATIVE

	133	/160 - LOWER CASE PI
	143	/161 - LOWER CASE PSI
	160	/162 - LOWER CASE RHO
	163	/163 - LOWER CASE SIGMA
	164	/164 - LOWER CASE TAU
	000	/165 - SPARE
	166	/166 - FUNCTION
	154	/167 - LOWER CASE OMEGA
	165	/170 - LOWER CASE XI
	171	/171 - LOWER CASE UPSILON
	172	/172 - LOWER CASE ZETA
	105	/173 - ARROW LEFT
	111	/174 - ARROW UP
	124	/175 - ARROW RIGHT
	117	/176 - ARROW DOWN


TCK47,	113	/ 22 - 047 -- SECTION
	137	/ 23 - 047 -- TOP LEFT BRACKET

TCK60,	157	/ 22 - 060 -- DEGREE
	64	/ 23 - 060 -- RIGHT MIDDLE CURLY BRACE

TCK61,	45	/ 22 - 061 -- PLUS/MINUS
	136	/ 23 - 061 -- TOP LEFT SUMMATION

TCK65,	155	/ 22 - 065 -- MU
	43	/ 23 - 065 -- TOP RIGHT SUMMATION

TCK66,	110	/ 22 - 066 -- PARAGRAPH
	44	/ 23 - 066 -- BOTTOM RIGHT SUMMATION

TCK67,	42	/ 22 - 067 -- MIDDLE DOT
	65	/ 23 - 067 -- CENTER SUMMATION
	>


	IFDEF ITALIAN <
	351	/41 - RADICAL
	61	/42 - TOP LEFT RADICAL
	136	/43 - HORIZONTAL CONNECTOR
	67	/44 - TOP INTEGRAL
	350	/45 - BOTTOM INTEGRAL
	70	/46 - VERTICAL CONNECTOR
	TCK47	/47 - SECTION (22) OR TOP LEFT BRACKET (23)
	51	/50 - BOTTOM LEFT BRACKET
	53	/51 - TOP RIGHT BRACKET
	55	/52 - BOTTOM RIGHT BRACKET
	71	/53 - TOP LEFT PARENTHESIS
	347	/54 - BOTTOM LEFT PARENTHESIS
	60	/55 - TOP RIGHT PARENTHESIS
	340	/56 - BOTTOM RIGHT PARENTHESIS
	42	/57 - LEFT MIDDLE CURLY BRACE

	TCK60	/60 - DEGREE (22) OR RIGHT MIDDLE CURLY BRACE (23)
	TCK61	/61 - PLUS/MINUS (22) OR TOP LEFT SUMMATION (23)
	137	/62 - BOTTOM LEFT SUMMATION
	176	/63 - TOP SLANT SUMMATION CONNECTOR
	140	/64 - BOTTOM SLANT SUMMATION CONNECTOR
	TCK65	/65 - MU (22) OR TOP RIGHT SUMMATION (23)
	TCK66	/66 - PARAGRAPH (22) OR BOTTOM RIGHT SUMMATION (23)
	TCK67	/67 - MIDDLE DOT (22) CENTER SUMMATION (23)
	73	/70 - LEFT SQUARE BRACKET (ASCII)
	45	/71 - CENTERED DOT
	72	/72 - RIGHT SQUARE BRACKET (ASCII)
	65	/73 - PLUS/MINUS
	74	/74 - LESS THAN OR EQUAL
	52	/75 - NOT EQUAL
	76	/76 - GREATER THAN OR EQUAL
	247	/77 - SMALL FULL INTEGRAL


	62	/100 - THEREFORE (3 DOTS)
	126	/101 - VARIATION, PROPORTIONAL TO
	102	/102 - INFINITY
	47	/103 - DIVIDED BY
	127	/104 - CAPITAL DELTA
	101	/105 - NABLA, DEL
	104	/106 - CAPITAL PHI
	121	/107 - CAPITAL GAMMA
	116	/110 - CONGRUENT, VARIES AS, IS APPROXIMATE TO
	127	/111 - SIMILAR OR APPROXIMATELY EQUAL
	122	/112 - CAPITAL THETA
	166	/113 - TIMES, CROSS PRODUCT
	107	/114 - CAPITAL LAMBDA
	46	/115 - IF AND ONLY IF
	44	/116 - IMPLIES
	130	/117 - IDENTICAL TO

	75	/120 - CAPITAL PI
	103	/121 - CAPITAL PSI
	157	/122 - DEGREE
	123	/123 - CAPITAL SIGMA
	113	/124 - SECTION SYMBOL
	110	/125 - PARAGRAPH SYMBOL
	151	/126 - RADICAL
	114	/127 - CAPITAL OMEGA
	125	/130 - CAPITAL XI
	131	/131 - CAPITAL UPSILON
	41	/132 - IS INCLUDED IN
	362	/133 - INCLUDES
	112	/134 - INTERSECTION
	152	/135 - UNION
	115	/136 - LOGICAL AND
	155	/137 - LOGICAL OR

	106	/140 - LOGICAL NOT
	141	/141 - LOWER CASE ALPHA
	142	/142 - LOWER CASE BETA
	170	/143 - LOWER CASE CHI
	172	/144 - LOWER CASE DELTA
	145	/145 - LOWER CASE EPSILON
	144	/146 - LOWER CASE PHI
	161	/147 - LOWER CASE GAMMA
	150	/150 - LOWER CASE ETA
	151	/151 - LOWER CASE IOTA
	162	/152 - LOWER CASE THETA
	153	/153 - LOWER CASE KAPPA
	147	/154 - LOWER CASE LAMBDA
	73	/155 - LOWER CASE MU
	156	/156 - LOWER CASE NU
	72	/157 - PARTIAL DERIVATIVE

	354	/160 - LOWER CASE PI
	143	/161 - LOWER CASE PSI
	160	/162 - LOWER CASE RHO
	163	/163 - LOWER CASE SIGMA
	164	/164 - LOWER CASE TAU
	000	/165 - SPARE
	166	/166 - FUNCTION
	154	/167 - LOWER CASE OMEGA
	165	/170 - LOWER CASE XI
	171	/171 - LOWER CASE UPSILON
	167	/172 - LOWER CASE ZETA
	105	/173 - ARROW LEFT
	111	/174 - ARROW UP
	124	/175 - ARROW RIGHT
	117	/176 - ARROW DOWN


TCK47,	113	/ 22 - 047 -- SECTION
	260	/ 23 - 047 -- TOP LEFT BRACKET

TCK60,	157	/ 22 - 060 -- DEGREE
	47	/ 23 - 060 -- RIGHT MIDDLE CURLY BRACE

TCK61,	65	/ 22 - 061 -- PLUS/MINUS
	66	/ 23 - 061 -- TOP LEFT SUMMATION

TCK65,	73	/ 22 - 065 -- MU
	63	/ 23 - 065 -- TOP RIGHT SUMMATION

TCK66,	110	/ 22 - 066 -- PARAGRAPH
	64	/ 23 - 066 -- BOTTOM RIGHT SUMMATION

TCK67,	45	/ 22 - 067 -- MIDDLE DOT
	50	/ 23 - 067 -- CENTER SUMMATION
	>

	IFDEF V30NOR <
	351	/41 - RADICAL
	61	/42 - TOP LEFT RADICAL
	136	/43 - HORIZONTAL CONNECTOR
	67	/44 - TOP INTEGRAL
	350	/45 - BOTTOM INTEGRAL
	70	/46 - VERTICAL CONNECTOR
	TCK47	/47 - SECTION (22) OR TOP LEFT BRACKET (23)
	51	/50 - BOTTOM LEFT BRACKET
	53	/51 - TOP RIGHT BRACKET
	55	/52 - BOTTOM RIGHT BRACKET
	71	/53 - TOP LEFT PARENTHESIS
	347	/54 - BOTTOM LEFT PARENTHESIS
	60	/55 - TOP RIGHT PARENTHESIS
	340	/56 - BOTTOM RIGHT PARENTHESIS
	42	/57 - LEFT MIDDLE CURLY BRACE

	TCK60	/60 - DEGREE (22) OR RIGHT MIDDLE CURLY BRACE (23)
	TCK61	/61 - PLUS/MINUS (22) OR TOP LEFT SUMMATION (23)
	137	/62 - BOTTOM LEFT SUMMATION
	176	/63 - TOP SLANT SUMMATION CONNECTOR
	140	/64 - BOTTOM SLANT SUMMATION CONNECTOR
	TCK65	/65 - MU (22) OR TOP RIGHT SUMMATION (23)
	TCK66	/66 - PARAGRAPH (22) OR BOTTOM RIGHT SUMMATION (23)
	TCK67	/67 - MIDDLE DOT (22) CENTER SUMMATION (23)
	73	/70 - LEFT SQUARE BRACKET (ASCII)
	45	/71 - CENTERED DOT
	72	/72 - RIGHT SQUARE BRACKET (ASCII)
	65	/73 - PLUS/MINUS
	74	/74 - LESS THAN OR EQUAL
	52	/75 - NOT EQUAL
	76	/76 - GREATER THAN OR EQUAL
	247	/77 - SMALL FULL INTEGRAL


	62	/100 - THEREFORE (3 DOTS)
	126	/101 - VARIATION, PROPORTIONAL TO
	102	/102 - INFINITY
	47	/103 - DIVIDED BY
	127	/104 - CAPITAL DELTA
	101	/105 - NABLA, DEL
	104	/106 - CAPITAL PHI
	121	/107 - CAPITAL GAMMA
	116	/110 - CONGRUENT, VARIES AS, IS APPROXIMATE TO
	127	/111 - SIMILAR OR APPROXIMATELY EQUAL
	122	/112 - CAPITAL THETA
	166	/113 - TIMES, CROSS PRODUCT
	107	/114 - CAPITAL LAMBDA
	46	/115 - IF AND ONLY IF
	44	/116 - IMPLIES
	130	/117 - IDENTICAL TO

	75	/120 - CAPITAL PI
	103	/121 - CAPITAL PSI
	157	/122 - DEGREE
	123	/123 - CAPITAL SIGMA
	113	/124 - SECTION SYMBOL
	110	/125 - PARAGRAPH SYMBOL
	151	/126 - RADICAL
	114	/127 - CAPITAL OMEGA
	125	/130 - CAPITAL XI
	131	/131 - CAPITAL UPSILON
	41	/132 - IS INCLUDED IN
	362	/133 - INCLUDES
	112	/134 - INTERSECTION
	152	/135 - UNION
	115	/136 - LOGICAL AND
	155	/137 - LOGICAL OR

	106	/140 - LOGICAL NOT
	141	/141 - LOWER CASE ALPHA
	142	/142 - LOWER CASE BETA
	170	/143 - LOWER CASE CHI
	172	/144 - LOWER CASE DELTA
	145	/145 - LOWER CASE EPSILON
	144	/146 - LOWER CASE PHI
	161	/147 - LOWER CASE GAMMA
	150	/150 - LOWER CASE ETA
	151	/151 - LOWER CASE IOTA
	162	/152 - LOWER CASE THETA
	153	/153 - LOWER CASE KAPPA
	147	/154 - LOWER CASE LAMBDA
	73	/155 - LOWER CASE MU
	156	/156 - LOWER CASE NU
	72	/157 - PARTIAL DERIVATIVE

	354	/160 - LOWER CASE PI
	143	/161 - LOWER CASE PSI
	160	/162 - LOWER CASE RHO
	163	/163 - LOWER CASE SIGMA
	164	/164 - LOWER CASE TAU
	000	/165 - SPARE
	166	/166 - FUNCTION
	154	/167 - LOWER CASE OMEGA
	165	/170 - LOWER CASE XI
	171	/171 - LOWER CASE UPSILON
	167	/172 - LOWER CASE ZETA
	105	/173 - ARROW LEFT
	111	/174 - ARROW UP
	124	/175 - ARROW RIGHT
	117	/176 - ARROW DOWN


TCK47,	113	/ 22 - 047 -- SECTION
	260	/ 23 - 047 -- TOP LEFT BRACKET

TCK60,	157	/ 22 - 060 -- DEGREE
	47	/ 23 - 060 -- RIGHT MIDDLE CURLY BRACE

TCK61,	65	/ 22 - 061 -- PLUS/MINUS
	66	/ 23 - 061 -- TOP LEFT SUMMATION

TCK65,	73	/ 22 - 065 -- MU
	63	/ 23 - 065 -- TOP RIGHT SUMMATION

TCK66,	110	/ 22 - 066 -- PARAGRAPH
	64	/ 23 - 066 -- BOTTOM RIGHT SUMMATION

TCK67,	45	/ 22 - 067 -- MIDDLE DOT
	50	/ 23 - 067 -- CENTER SUMMATION
	>

	IFDEF V30SWE <
	351	/41 - RADICAL
	61	/42 - TOP LEFT RADICAL
	136	/43 - HORIZONTAL CONNECTOR
	67	/44 - TOP INTEGRAL
	350	/45 - BOTTOM INTEGRAL
	70	/46 - VERTICAL CONNECTOR
	TCK47	/47 - SECTION (22) OR TOP LEFT BRACKET (23)
	51	/50 - BOTTOM LEFT BRACKET
	53	/51 - TOP RIGHT BRACKET
	55	/52 - BOTTOM RIGHT BRACKET
	71	/53 - TOP LEFT PARENTHESIS
	347	/54 - BOTTOM LEFT PARENTHESIS
	60	/55 - TOP RIGHT PARENTHESIS
	340	/56 - BOTTOM RIGHT PARENTHESIS
	42	/57 - LEFT MIDDLE CURLY BRACE

	TCK60	/60 - DEGREE (22) OR RIGHT MIDDLE CURLY BRACE (23)
	TCK61	/61 - PLUS/MINUS (22) OR TOP LEFT SUMMATION (23)
	137	/62 - BOTTOM LEFT SUMMATION
	176	/63 - TOP SLANT SUMMATION CONNECTOR
	140	/64 - BOTTOM SLANT SUMMATION CONNECTOR
	TCK65	/65 - MU (22) OR TOP RIGHT SUMMATION (23)
	TCK66	/66 - PARAGRAPH (22) OR BOTTOM RIGHT SUMMATION (23)
	TCK67	/67 - MIDDLE DOT (22) CENTER SUMMATION (23)
	73	/70 - LEFT SQUARE BRACKET (ASCII)
	45	/71 - CENTERED DOT
	72	/72 - RIGHT SQUARE BRACKET (ASCII)
	65	/73 - PLUS/MINUS
	74	/74 - LESS THAN OR EQUAL
	52	/75 - NOT EQUAL
	76	/76 - GREATER THAN OR EQUAL
	247	/77 - SMALL FULL INTEGRAL


	62	/100 - THEREFORE (3 DOTS)
	126	/101 - VARIATION, PROPORTIONAL TO
	102	/102 - INFINITY
	47	/103 - DIVIDED BY
	127	/104 - CAPITAL DELTA
	101	/105 - NABLA, DEL
	104	/106 - CAPITAL PHI
	121	/107 - CAPITAL GAMMA
	116	/110 - CONGRUENT, VARIES AS, IS APPROXIMATE TO
	127	/111 - SIMILAR OR APPROXIMATELY EQUAL
	122	/112 - CAPITAL THETA
	166	/113 - TIMES, CROSS PRODUCT
	107	/114 - CAPITAL LAMBDA
	46	/115 - IF AND ONLY IF
	44	/116 - IMPLIES
	130	/117 - IDENTICAL TO

	75	/120 - CAPITAL PI
	103	/121 - CAPITAL PSI
	157	/122 - DEGREE
	123	/123 - CAPITAL SIGMA
	113	/124 - SECTION SYMBOL
	110	/125 - PARAGRAPH SYMBOL
	151	/126 - RADICAL
	114	/127 - CAPITAL OMEGA
	125	/130 - CAPITAL XI
	131	/131 - CAPITAL UPSILON
	41	/132 - IS INCLUDED IN
	362	/133 - INCLUDES
	112	/134 - INTERSECTION
	152	/135 - UNION
	115	/136 - LOGICAL AND
	155	/137 - LOGICAL OR

	106	/140 - LOGICAL NOT
	141	/141 - LOWER CASE ALPHA
	142	/142 - LOWER CASE BETA
	170	/143 - LOWER CASE CHI
	172	/144 - LOWER CASE DELTA
	145	/145 - LOWER CASE EPSILON
	144	/146 - LOWER CASE PHI
	161	/147 - LOWER CASE GAMMA
	150	/150 - LOWER CASE ETA
	151	/151 - LOWER CASE IOTA
	162	/152 - LOWER CASE THETA
	153	/153 - LOWER CASE KAPPA
	147	/154 - LOWER CASE LAMBDA
	73	/155 - LOWER CASE MU
	156	/156 - LOWER CASE NU
	72	/157 - PARTIAL DERIVATIVE

	354	/160 - LOWER CASE PI
	143	/161 - LOWER CASE PSI
	160	/162 - LOWER CASE RHO
	163	/163 - LOWER CASE SIGMA
	164	/164 - LOWER CASE TAU
	000	/165 - SPARE
	166	/166 - FUNCTION
	154	/167 - LOWER CASE OMEGA
	165	/170 - LOWER CASE XI
	171	/171 - LOWER CASE UPSILON
	167	/172 - LOWER CASE ZETA
	105	/173 - ARROW LEFT
	111	/174 - ARROW UP
	124	/175 - ARROW RIGHT
	117	/176 - ARROW DOWN


TCK47,	113	/ 22 - 047 -- SECTION
	260	/ 23 - 047 -- TOP LEFT BRACKET

TCK60,	157	/ 22 - 060 -- DEGREE
	47	/ 23 - 060 -- RIGHT MIDDLE CURLY BRACE

TCK61,	65	/ 22 - 061 -- PLUS/MINUS
	66	/ 23 - 061 -- TOP LEFT SUMMATION

TCK65,	73	/ 22 - 065 -- MU
	63	/ 23 - 065 -- TOP RIGHT SUMMATION

TCK66,	110	/ 22 - 066 -- PARAGRAPH
	64	/ 23 - 066 -- BOTTOM RIGHT SUMMATION

TCK67,	45	/ 22 - 067 -- MIDDLE DOT
	50	/ 23 - 067 -- CENTER SUMMATION
	>


IFDEF DUTCH <
	61	/41 - RADICAL
	41	/42 - TOP LEFT RADICAL
	70	/43 - HORIZONTAL CONNECTOR
	46	/44 - TOP INTEGRAL
	67	/45 - BOTTOM INTEGRAL
	52	/46 - VERTICAL CONNECTOR
	TCK47	/47 - SECTION (22) OR TOP LEFT BRACKET (23)
	55	/50 - BOTTOM LEFT BRACKET
	53	/51 - TOP RIGHT BRACKET
	75	/52 - BOTTOM RIGHT BRACKET
	50	/53 - TOP LEFT PARENTHESIS
	71	/54 - BOTTOM LEFT PARENTHESIS
	51	/55 - TOP RIGHT PARENTHESIS
	70	/56 - BOTTOM RIGHT PARENTHESIS
	63	/57 - LEFT MIDDLE CURLY BRACE

	TCK60	/60 - DEGREE (22) OR RIGHT MIDDLE CURLY BRACE (23)
	TCK61	/61 - PLUS/MINUS (22) OR TOP LEFT SUMMATION (23)
	66	/62 - BOTTOM LEFT SUMMATION
	176	/63 - TOP SLANT SUMMATION CONNECTOR
	140	/64 - BOTTOM SLANT SUMMATION CONNECTOR
	TCK65	/65 - MU (22) OR TOP RIGHT SUMMATION (23)
	TCK66	/66 - PARAGRAPH (22) OR BOTTOM RIGHT SUMMATION (23)
	TCK67	/67 - MIDDLE DOT (22) CENTER SUMMATION (23)
	54	/70 - LEFT SQUARE BRACKET (ASCII)
	42	/71 - CENTERED DOT
	56	/72 - RIGHT SQUARE BRACKET (ASCII)
	45	/73 - PLUS/MINUS
	74	/74 - LESS THAN OR EQUAL
	134	/75 - NOT EQUAL
	76	/76 - GREATER THAN OR EQUAL
	174	/77 - SMALL FULL INTEGRAL


	100	/100 - THEREFORE (3 DOTS)
	126	/101 - VARIATION, PROPORTIONAL TO
	102	/102 - INFINITY
	47	/103 - DIVIDED BY
	127	/104 - CAPITAL DELTA
	101	/105 - NABLA, DEL
	104	/106 - CAPITAL PHI
	121	/107 - CAPITAL GAMMA
	116	/110 - CONGRUENT, VARIES AS, IS APPROXIMATE TO
	132	/111 - SIMILAR OR APPROXIMATELY EQUAL
	122	/112 - CAPITAL THETA
	166	/113 - TIMES, CROSS PRODUCT
	107	/114 - CAPITAL LAMBDA
	175	/115 - IF AND ONLY IF
	135	/116 - IMPLIES
	130	/117 - IDENTICAL TO

	173	/120 - CAPITAL PI
	103	/121 - CAPITAL PSI
	157	/122 - DEGREE
	123	/123 - CAPITAL SIGMA
	113	/124 - SECTION SYMBOL
	110	/125 - PARAGRAPH SYMBOL
	62	/126 - RADICAL
	114	/127 - CAPITAL OMEGA
	125	/130 - CAPITAL XI
	131	/131 - CAPITAL UPSILON
	77	/132 - IS INCLUDED IN
	57	/133 - INCLUDES
	112	/134 - INTERSECTION
	152	/135 - UNION
	72	/136 - LOGICAL AND
	73	/137 - LOGICAL OR

	106	/140 - LOGICAL NOT
	141	/141 - LOWER CASE ALPHA
	142	/142 - LOWER CASE BETA
	170	/143 - LOWER CASE CHI
	167	/144 - LOWER CASE DELTA
	145	/145 - LOWER CASE EPSILON
	144	/146 - LOWER CASE PHI
	161	/147 - LOWER CASE GAMMA
	150	/150 - LOWER CASE ETA
	151	/151 - LOWER CASE IOTA
	162	/152 - LOWER CASE THETA
	153	/153 - LOWER CASE KAPPA
	147	/154 - LOWER CASE LAMBDA
	155	/155 - LOWER CASE MU
	156	/156 - LOWER CASE NU
	115	/157 - PARTIAL DERIVATIVE

	133	/160 - LOWER CASE PI
	143	/161 - LOWER CASE PSI
	160	/162 - LOWER CASE RHO
	163	/163 - LOWER CASE SIGMA
	164	/164 - LOWER CASE TAU
	000	/165 - SPARE
	166	/166 - FUNCTION
	154	/167 - LOWER CASE OMEGA
	165	/170 - LOWER CASE XI
	171	/171 - LOWER CASE UPSILON
	172	/172 - LOWER CASE ZETA
	105	/173 - ARROW LEFT
	111	/174 - ARROW UP
	124	/175 - ARROW RIGHT
	117	/176 - ARROW DOWN


TCK47,	113	/ 22 - 047 -- SECTION
	137	/ 23 - 047 -- TOP LEFT BRACKET

TCK60,	157	/ 22 - 060 -- DEGREE
	64	/ 23 - 060 -- RIGHT MIDDLE CURLY BRACE

TCK61,	45	/ 22 - 061 -- PLUS/MINUS
	136	/ 23 - 061 -- TOP LEFT SUMMATION

TCK65,	155	/ 22 - 065 -- MU
	43	/ 23 - 065 -- TOP RIGHT SUMMATION

TCK66,	110	/ 22 - 066 -- PARAGRAPH
	44	/ 23 - 066 -- BOTTOM RIGHT SUMMATION

TCK67,	42	/ 22 - 067 -- MIDDLE DOT
	65	/ 23 - 067 -- CENTER SUMMATION
	>

IFDEF SPANISH <
	61	/41 - RADICAL
	41	/42 - TOP LEFT RADICAL
	70	/43 - HORIZONTAL CONNECTOR
	46	/44 - TOP INTEGRAL
	67	/45 - BOTTOM INTEGRAL
	52	/46 - VERTICAL CONNECTOR
	TCK47	/47 - SECTION (22) OR TOP LEFT BRACKET (23)
	55	/50 - BOTTOM LEFT BRACKET
	53	/51 - TOP RIGHT BRACKET
	75	/52 - BOTTOM RIGHT BRACKET
	50	/53 - TOP LEFT PARENTHESIS
	71	/54 - BOTTOM LEFT PARENTHESIS
	51	/55 - TOP RIGHT PARENTHESIS
	70	/56 - BOTTOM RIGHT PARENTHESIS
	63	/57 - LEFT MIDDLE CURLY BRACE

	TCK60	/60 - DEGREE (22) OR RIGHT MIDDLE CURLY BRACE (23)
	TCK61	/61 - PLUS/MINUS (22) OR TOP LEFT SUMMATION (23)
	66	/62 - BOTTOM LEFT SUMMATION
	176	/63 - TOP SLANT SUMMATION CONNECTOR
	140	/64 - BOTTOM SLANT SUMMATION CONNECTOR
	TCK65	/65 - MU (22) OR TOP RIGHT SUMMATION (23)
	TCK66	/66 - PARAGRAPH (22) OR BOTTOM RIGHT SUMMATION (23)
	TCK67	/67 - MIDDLE DOT (22) CENTER SUMMATION (23)
	54	/70 - LEFT SQUARE BRACKET (ASCII)
	42	/71 - CENTERED DOT
	56	/72 - RIGHT SQUARE BRACKET (ASCII)
	45	/73 - PLUS/MINUS
	74	/74 - LESS THAN OR EQUAL
	134	/75 - NOT EQUAL
	76	/76 - GREATER THAN OR EQUAL
	174	/77 - SMALL FULL INTEGRAL


	100	/100 - THEREFORE (3 DOTS)
	126	/101 - VARIATION, PROPORTIONAL TO
	102	/102 - INFINITY
	47	/103 - DIVIDED BY
	127	/104 - CAPITAL DELTA
	101	/105 - NABLA, DEL
	104	/106 - CAPITAL PHI
	121	/107 - CAPITAL GAMMA
	116	/110 - CONGRUENT, VARIES AS, IS APPROXIMATE TO
	132	/111 - SIMILAR OR APPROXIMATELY EQUAL
	122	/112 - CAPITAL THETA
	166	/113 - TIMES, CROSS PRODUCT
	107	/114 - CAPITAL LAMBDA
	175	/115 - IF AND ONLY IF
	135	/116 - IMPLIES
	130	/117 - IDENTICAL TO

	173	/120 - CAPITAL PI
	103	/121 - CAPITAL PSI
	157	/122 - DEGREE
	123	/123 - CAPITAL SIGMA
	113	/124 - SECTION SYMBOL
	110	/125 - PARAGRAPH SYMBOL
	62	/126 - RADICAL
	114	/127 - CAPITAL OMEGA
	125	/130 - CAPITAL XI
	131	/131 - CAPITAL UPSILON
	77	/132 - IS INCLUDED IN
	57	/133 - INCLUDES
	112	/134 - INTERSECTION
	152	/135 - UNION
	72	/136 - LOGICAL AND
	73	/137 - LOGICAL OR

	106	/140 - LOGICAL NOT
	141	/141 - LOWER CASE ALPHA
	142	/142 - LOWER CASE BETA
	170	/143 - LOWER CASE CHI
	167	/144 - LOWER CASE DELTA
	145	/145 - LOWER CASE EPSILON
	144	/146 - LOWER CASE PHI
	161	/147 - LOWER CASE GAMMA
	150	/150 - LOWER CASE ETA
	151	/151 - LOWER CASE IOTA
	162	/152 - LOWER CASE THETA
	153	/153 - LOWER CASE KAPPA
	147	/154 - LOWER CASE LAMBDA
	155	/155 - LOWER CASE MU
	156	/156 - LOWER CASE NU
	115	/157 - PARTIAL DERIVATIVE

	133	/160 - LOWER CASE PI
	143	/161 - LOWER CASE PSI
	160	/162 - LOWER CASE RHO
	163	/163 - LOWER CASE SIGMA
	164	/164 - LOWER CASE TAU
	000	/165 - SPARE
	166	/166 - FUNCTION
	154	/167 - LOWER CASE OMEGA
	165	/170 - LOWER CASE XI
	171	/171 - LOWER CASE UPSILON
	172	/172 - LOWER CASE ZETA
	105	/173 - ARROW LEFT
	111	/174 - ARROW UP
	124	/175 - ARROW RIGHT
	117	/176 - ARROW DOWN


TCK47,	113	/ 22 - 047 -- SECTION
	137	/ 23 - 047 -- TOP LEFT BRACKET

TCK60,	157	/ 22 - 060 -- DEGREE
	64	/ 23 - 060 -- RIGHT MIDDLE CURLY BRACE

TCK61,	45	/ 22 - 061 -- PLUS/MINUS
	136	/ 23 - 061 -- TOP LEFT SUMMATION

TCK65,	155	/ 22 - 065 -- MU
	43	/ 23 - 065 -- TOP RIGHT SUMMATION

TCK66,	110	/ 22 - 066 -- PARAGRAPH
	44	/ 23 - 066 -- BOTTOM RIGHT SUMMATION

TCK67,	42	/ 22 - 067 -- MIDDLE DOT
	65	/ 23 - 067 -- CENTER SUMMATION
	>


/WE MUST OUTPUT THE ESCAPE SEQUENCE EVEN THOUGH DD IS CHST.
/THEREFORE WE CANNOT USE PRESCS.

PGCHAR,	XX								/A234
	TAD	(XSESCK)	/PUT OUT ESCAPE				/A234
	DCA	XSADX	/STRING FOR THE					/A234
	JMS	ESCST	/ESCAPE KEY					/A234
	JMS	PLNXT	/GET NEXT CHARACTER				/A234
	NOP		/CAN'T FAIL					/A234
	TAD I	PLPTR	/GET CHARACTER					/A234
	JMP I	PGCHAR

XSESCK,	ESC;	"[&177;	"2&177;	"3&177;	"~&177+4000/ESCAPE SEQUENCE FOR CHST
/------------------------

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

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM
OVDPL2=.-OVRLCA
OBDPL2=OVTYPE+OVNUM

/IN PRINTING TO DRAFT PRINTERS, VERY LITTLE IS PRESUMED ABOUT THE
/ATTACHED PRINTER.  WE ASSUME THAT CARRIAGE RETURN RETURNS THE
/CARRIAGE BUT DOES NOT IMPLY A LINE FEED.  BACKSPACE IS USED ONLY
/TO IMPLEMENT DEAD KEY SEQUENCES.  THUS, IN GENERAL, THIS ROUTINE
/USES A MULTIPLE PASS STRATEGY TO PRINT THE LINE.  COMMENTS AT
/DPLIN3 FURTHER EXPLAIN THE MULTIPLE PASS STRATEGY


/RESET ALL POINTERS. THE UPPER FIVE (5) BITS OF EACH WORD
/IN THE LINE HAVE BEEN PROCESSED.
/THIS IS THE START OF THE LINE.

DPLIN2,	JMP	LPRSTP	/RESET THE POINTERS, RETURN TO DPLIN3

/THIS INNER LOOP PROCESSES EACH CHARACTER IN THE LINE, AND ACTS
/ACCORDING TO EACH CHARACTER'S MODE BITS.

/A) IF NONE OF A CHARACTER'S MODE BITS ARE SET, THIS IS THE LAST PASS DURING
/WHICH IT WILL PRINT.  IT IS REPLACED IN THE BUFFER BY A SPACE.


/B) IF A CHARACTER IS UNDERLINED, AN UNDERSCORE IS PRINTED INSTEAD
/OF THE CHARACTER UNTIL THE PROPER UNDERLINE DARKNESS IS ACHIEVED.
/THEN THE UNDERLINE ATTRIBUTE IS DELETED AND THE CHARACTER ITSELF
/PRINTS NORMALLY ON SUBSEQUENT PASSES.

/C) THE DARKNESS REQUIRED WILL DETERMINE HOW MANY PASSES THROUGH THE LINE
/WILL BE DONE. THE HIT BITS (BITS 1&2 OF THE WORD) DETERMINE THE PASSES.
/00= ONE PASS, 01= TWO PASSES, 10= THREE PASSES, 11= FOUR PASSES.

/D) IF A CHARACTER IS PART OF A DEAD KEY SEQUENCE, EACH CHARACTER
/IN THE SEQUENCE IS TREATED SEPERATELY.  IF A CHARACTER IN A DEAD KEY
/SEQUENCE IS REPLACED WITH A SPACE AND THAT IS NOT THE LAST PASS,
/WE PAY A SMALL SPEED PENALTY.

/IF A CHARACTER FALLS INTO ANY CATEGORY OTHER THAN A), ANOTHER PASS IS
/NECESSARY.  EVENTUALLY, ALL CHARACTERS WILL FALL INTO CATEGORY A) AND
/THE LINE WILL BE COMPLETED.


DPLIN3,	TAD I	PLPTR	/GET THE FIRST CHARACTER IN ITS POSITION
	SNA		/FLUSH NULL CHARACTERS. THEY CAN'T BE PROCESSED.
	JMP	DPLIN9	/GET NEXT CHARACTER

/WE SAVE THE CHARACTER WITHOUT MODE BITS IN THE AC

	AND	(4177)	/MASK OUT THE MODE BITS
	MQL		/SAVE THE MODE-BIT-LESS CHARACTER IN THE MQ

/WE NOW MUST STRIP ALL THE ATTRIBUTES (AFTER ALL THIS WORK!)		/A214
/IF WE ARE PRINTING TO A REAL HOST. (AS OPPOSED TO A PRINTER		/A214
/CONNECTED TO THE HOST PORT).						/A214

	TAD	PRQPNT		/GET DOCUMENT DESTINATION		/A214
	TAD	(-DHOST2)	/					/A214
	SZA CLA			/SKIP IF A REAL HOST			/A214
	JMP	DPLIN4		/REAL PRINTER				/A214
	MQA			/GET MODELESS CHR			/A214
	DCA I	PLPTR		/SAVE BACK IN THE BUFFER		/A214

/NOW CHECK FOR THE CODE 21, 22, OR 23. THIS IS THE SEQUENCE FOR
/PRINTING A TECHNICAL CHARACTER IN ANOTHER CHARACTER SET. IT ALSO CHANGES TO
/G2 OR G3. THE CHARACTER STRING WILL BE TWO CHARACTERS. THE FIRST WILL BE THE
/CONTROL CHARACTER (21,22,OR 23), THE NEXT WILL BE THE CHARACTER OR THE "G"
/SET DESIRED. NOTE THAT THIS TWO CHARACTER STRING IS NOT CALLED A "G" STRING
/BUT IT COULD BE IF YOU SO DESIRE. THE CHARACTER ATTRIBUTES WILL ALSO BE
/ON THE CONTROL CHARACTER.

DPLIN4,	TAD I	PLPTR	/NOW CHECK TO SEE IF THE CHARACTER IS A CONTROL
	AND	P177	/CHARACTER THAT PRECEDES THE TECHNICAL CHARACTER.
	TAD	(-23)
	SNA		/IS IT 23?
	JMP	DPLI4H	/YES
	IAC
	SNA		/IS IT 22?
	JMP	DPLI4C	/IS 22 PROCESS AND DON'T CONTRIBUTE TO JUSTIFICATION
	IAC
	SNA CLA		/IS IT 21?
	JMP	DPLI4E	/YES

	TAD I	PLPTR	/NOT A CONTROL CHARACTER, GET IT BACK AND CONTINUE

/PAPER MOVEMENT CHECK AREA.
/NOW CHECK TO SEE IF SUPERSCRIPT OR SUBSCRIPT IS REQUIRED. THIS WILL	/A222
/MOVING THE PAPER UP OR DOWN AS REQUIRED PRIOR TO PRINTING THE CHARACTER/A222

	AND	(0400)	/MASK OUT ALL BUT THE SUPER/SUB BIT.		/A222
	SNA CLA		/?						/A222
	JMP	DPLI4A	/NO SUPER OR SUB BIT, JUST PRINT THE CHARACTER	/A222
	TAD I	PLPTR	/GET CHARACTER BACK
	AND	(0200)	/TEST FOR SUPERSCRIPT				/A222
	SNA CLA								/A222
	JMP	LPSUPR	/POSITION TO SUPERSCRIPT AND RETURN TO DPLIN5	/A222
	JMP	LPSUB	/POSITION TO SUBSCRIPT AND RETURN TO DPLIN5	/A222

/NO SUPER OR SUB IN CHARACTER ATTRIBUTES

DPLI4A,	TAD	CURPOS	/ARE WE POSITIONED CORRECTLY?
	SNA
	JMP	DPLIN5	/YES

	SPA		/NO, DO WE HAVE TO GO UP OR DOWN?
	JMP	DPLI4B	/IS NEGATIVE, GO UP

	JMS	MOVEDN	/IS UP, GO DOWN
	JMP	DPLIN5	/DONE

DPLI4B,	JMS	MOVEUP	/WE ARE DOWN, MOVE UP.

/CHECK TO SEE IF UNDERSCORE

DPLIN5,	CLA
	JMS	CFUNDL	/CHECK FOR UNDERLINE ATTRIBUTES
	JMP	PUNDL	/RETURN 1: YES, GO TO PUNDL AND RETURN TO DPLI5D
DPLI5A,	TAD I	PLPTR	/RETURN 2: NO UNDL, GET CHARACTER
	AND	(2000)	/SEE IF BOLD BIT SET.
	DCA	PRBIC	/SET FLAG IN LPBI ROUTINE.
	TAD	PRBIF	/CHECK TO SEE IF ANOTHER MEANING FOR BOLD BIT.
	SZA CLA
	JMS	LPBI	/YES, CHANGE FONT OR CHARACTER SETS.
DPLI5B,	TAD I	PLPTR	/GET THE CHR BACK

/WE TEST TO SEE IF THE CODE IS THAT OF THE REQUIRED SPACE RQSP		/A216
/IF SO, WE PRINT THE SPACE CODE (40) INSTEAD OF THE REQUIRED SPACE (177)/A216
/CODE. THIS IS BECAUSE THE REQUIRED SPACE CODE IS JUST A PHONY CODE TO	/A216
/BE REPLACED AT THIS TIME SO THAT IT CANNOT CONTRIBUTE TO JUSTIFICATION	/A216

	AND	P177	/BIT 0 MAY OR MAY NOT BE SET
	TAD	(-RQSP)	/SUBTRACT REQUIRED SPACE CODE (177)		/A216
	SZA CLA		/SKIP IF REQUIRED SPACE				/A216
	JMP	DPLI5C	/NOT A REQUIRED SPACE
	TAD	(SPC)	/IT IS A REQUIRED SPACE.
	JMP	DPLI5E	/PRINT AN ASCII 40 (SPACE).

DPLI5C,	JMS	PRSO	/SEE IF PRINT SHIFT OUT (SO)

DPLI5D,	MQA
DPLI5E,	JMS	PRCHAR	/PRINT IT AFTER ALL THE FINAGLEING.
	CLA
	JMS	PRSI	/DO WE PRINT SHIFT IN (SI)?


/NOW WE SEE IF ANY JUSTIFICATION IS NECESSARY.  ALL SPACES IN THE
/JUSTIFIABLE PORTION OF THE LINE ARE MARKED WITH BIT 0 SET.  AN EXTRA
/PLSS UNITS ARE ADDED TO EACH SUCH SPACE.  IN ADDITION, PLSSC IS
/INCREMENTED EACH TIME.  AS LONG AS IT REMAINS NEGATIVE OR ZERO, AN
/EXTRA UNIT IS ADDED TO EACH SPACE.  SINCE ONLY UNITS IN MULTIPLES OF
/SPACES ARE OUTPUT IN LPMOVE, LEFTOVER UNITS ARE RETAINED UNTIL THE
/NEXT SPACE.
	
/FIRST DETERMINE IF THE CHARACTER JUST OUTPUT WAS A JUSTIFIABLE SPACE.

	TAD I	PLPTR	/GET THE CHARACTER
	SMA CLA		/WAS IT A JUSTIFIABLE CHARACTER--CONSIDER AC0
	JMP	DPLIN8	/IT WASN'T--NO JUSTIFICATION

/Next determine how much space to add.  We increment PLSSC each time.  As soon
/as it reaches zero, we now longer use one additional unit.

	ISZ	PLSSC	/Increment the remainder counter
	NOP		/In case it skips

	TAD	PLSSC	/See if the remainder counter is still negative
	SPA CLA
	AC0001		/Yes--use one additional unit

	TAD	PLSS	/Recover the extra space sizing

/WE NOW HAVE THE AMOUNT OF EXTRA SPACING REQUIRED IN THE AC.  LPMOVE PADS
/OUT AS MUCH OF THE EXTRA SPACE AS IT CAN BY PRINTING THE CHARACTER IN THE
/MQ.

	JMS	LPMOVE	/DO THE MOTION

	JMP	DPLIN8
/----------------
	PAGE

/HERE WE CHECK TO SEE IF THE CHARACTER IS THE LAST DARKNESS REQUIRED.
/WE REPLACE IT WITH A SPACE IF ALL HITS BITS ON THE CHARACTER ARE ZERO.
/IF THE CHARACTER IS AN 21,22,OR 23, THEN REPLACE WITH A NULL IF HIT BITS =0.
/BOLD (BIT 1) AND DARK (BIT 2) ARE DECREMENTED AND ANOTHER PASS FLAG SET.
/ALSO THE BOLD INTERPRETATION FLAG IS CHECKED IF THE HIT BITS ARE NOT 0.
/THIS IS THE FLAG THAT CHANGES THE MEANING OF THE BOLD BIT. IF PRBIF SET, THEN
/INTERPRET THE BOLD BIT AS CHANGE FONT OR CHARACTER SET FOR THAT CHARACTER ONLY.
/THIS IS SO YOU CAN PRINT WITH AN ACCENT OR UMLAUT OVER THE CHARACTER FROM
/ANOTHER FONT. DARK BIT STILL MEANS THE SAME.
/ALSO HERE IF CONTROL CHARACTER FOR TECH CHAR AND A G SET CHANGE WAS MADE.

DPLIN8,	CLA
	TAD	PPUNDL	/DID I PRINT AN UNDERLINE?
	SZA CLA
	JMP	DPLI9A	/YES, THEREFORE DON'T DECREMENT HIT COUNTS
	TAD I	PLPTR	/ARE THE HIT BITS 0?
	AND	(3000)	/MASK THEM.
	SZA		/IF 0, THEN REPLACE WITH A SPACE.
	JMP	DPLI8A	/DON'T REPLACE WITH A SPACE YET.

/SEE IF 21,22, OR 23

	TAD I	PLPTR
	AND	P177
	TAD	(-23)
	SZA
	IAC
	SZA
	IAC
	SNA CLA
	JMP	DPLI8C	/PUT IN A NULL BECAUSE IT IS A 21, 22, OR 23

	TAD I	PLPTR
	SMA		/IS IT A JUSTIFIABLE SPACE?
	JMP	DPLI8B	/NO


DPLI8C,	DCA I	PLPTR	/NULL OUT 21, 22, OR 23 OR RESAVE JUSTIFIABLE SPACE
	ISZ	TCHBLD	/BUMP THE COUNTER FOR TECH CHAR			/A238
	NOP								/A238
	JMP	DPLIN9	/GET THE NEXT CHARACTER AND GO PRINT IT MAYBE.


DPLI8B,	CLA
	TAD	(SPC)
	JMP	DPLI8C

/HERE IF SOME HIT BIT SET.

DPLI8A,	DCA	T1	/SAVE THE HIT BITS. WE NOW CHECK 2 WAYS TO INTERPRET.

	TAD	TCHBLD	/TCHBLD IS A FLAG INITIALLY SET TO -2
			/CHECK IF TECHNICAL CHARACTER. IF SO, NO PRBIF.
	SMA CLA		/IS NEXT CHARACTER A TECH CHARACTER?
	JMP	DPLI8I	/THIS IS NOT A TECH CHARACTER, BUT IT MIGHT BE PRBIF.
	ISZ	TCHBLD	/IT IS A CODE FOR THE TECH CHARACTER.
	NOP
	JMP	DPLI8D	/DECREMENT HIT BITS NORMALLY. IT IS A CONTROL CHARACTER
			/OR A TECH CHARACTER. PRBIF DOES NOT APPLY.
DPLI8I,	TAD	PRBIF	/IS THE BOLD BIT USED TO SELECT ANOTHER FONT?
	SNA CLA
	JMP	DPLI8D	/NO CONTINUE AS BEFORE.

/HERE IF BOLD INTERPRETATION FLAG SET AND SOME HIT BITS SET.

	TAD	T1	/YES, NOW SEE IF ANOTHER PASS NEEDED IF DARK BIT SET.
	AND	(2000)	/FIRST CHECK BOLD BIT.
	SNA CLA
	JMP	DPLI8D	/PRBIF, NO BOLD JUST DARK. JUST DECREMENT NORMALLY.

DPLI8G,	TAD	T1	/IS BOLD AND PRBIF. PRESERVE BOLD, DECREMENT DARK.
	AND	(1000)	/GET DARK BIT
	SNA CLA
	JMP	DPLI8F	/NO DARK, BOLD SET, PRBIF SET, REPLACE WITH SPACE (040)
	TAD I	PLPTR	/YES CLEAR DARK, AND SET UP FOR ANOTHER PASS WITH BOLD SET.
	AND	(6777)	/CLEAR DARK BIT, AND PRINT ANOTHER PASS.
	JMP	DPLI8E

DPLI8D,	TAD	T1	/GET BOLD AND DARK BACK
	TAD	(3000)	/DECREMENT THEM BY ADDING -1 IN BITS 1&2
	AND	(3000)	/DON'T CARRY INTO JUSTIFIABLE BIT.
	DCA	T1
	TAD I	PLPTR	/GET CHARACTER
	AND	(4777)	/MASK OUT HIT BITS.
	TAD	T1
DPLI8E,	DCA I	PLPTR	/NOW SET FLAG FOR ANOTHER PASS.
DPLI9A,	CLA
	DCA	PPUNDL
	ISZ	LPPASS	/SET TO DO ANOTHER PASS THROUGH THE LINE.
DPLIN9,	JMS	PLNXT	/POINT AT THE NEXT CHARACTER
	JMP	DPLI10	/NO MORE CHARACTERS--END OF THE LINE
	TAD I	PLPTR	/GET THE NEXT CHARACTER
	TAD	(-BS)	/IS IT A BACKSPACE?
	SZA CLA
	JMP	DPLIN3	/NO--THIS IS A DESIRED CHARACTER

/WE HAVE FOUND A BACKSPACE; OUTPUT IT & DO NEXT CHR.

	TAD I	PLPTR
	JMS	PRCHAR
	JMP	DPLIN9

/HERE IF, PRBIF SET, BOLD SET, DARK =0, AND CHARACTER PRINTED.
/CLEAR BOLD BIT, SET UP TO REPLACE WITH SPACE AND GET NEXT CHARACTER.

DPLI8F,	TAD I	PLPTR
	AND	(4177)	/PRESERVE BIT 0 AND CHARACTER
	DCA I	PLPTR
	JMP	DPLIN8	/NOW GO REPROCESS WITH THE APPEARANCE OF ALL HIT BITS 0.

/HERE TO SEE IF WE NEED TO HAVE TO REPOSITION THE PAPER PRIOR TO THE
/CARRIAGE RETURN. IT MIGHT HAVE BEEN SUPER OR SUB.

DPLI10,	TAD	CURPOS	/THIS IS TO SEE WHERE THE LINE IS BEFORE THE END/A222
	SNA		/OF THE LINE. IF THE LINE IS SUPER OR SUB, THEN	/A222
	JMP	DPLI11	/FIX IT. THIS IS OK GO DO THE CR		/A222
	SPA CLA		/THE LINE IS NG. GO UP OR DOWN PRIOR TO CR.	/A222
	JMP	DPLI12	/IS DOWN, GO UP.				/A222
	JMS	MOVEDN	/IS UP, MOVE DOWN				/A222
	JMP	DPLI11	/EXIT.						/A222
DPLI12,	JMS	MOVEUP	/IS DOWN, MOVE UP.				/A222

/WE ARE THROUGH WITH THIS PASS. IF THE NEXT PASS PLAG WAS INCREMENTED AT
/LEAST ONCE, DO ANOTHER PASS.

DPLI11,	JMS	SKNHST	/SKIP IF NOT HOST				/A234
	JMP	PRGSL1	/ENTER SPACING ROUTINE				/A234

	TAD	(CR)	/SEND A CARRIAGE RETURN TO END THE LINE
	JMS	PRCHAR
	ISZ	LPUPAS	/ Another pass completed.			/A092
	TAD	LPPASS	/DO WE NEED ANOTHER PASS?
	SNA CLA
	JMP	PRGSL1	/NO--ENTER THE SPACING ROUTINE. IT IS END OF PRINT LINE.
	JMP	DPLIN2	/YES--CONTINUE THE LOOP

/---------------
PAGE


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

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM
OVLN3A=.-OVRLCA
OBLN3A=OVTYPE+OVNUM

/LN03 OVERLAY A								/A247
/THIS OVERLAY IS USED FOR PRINTERS WHICH CAN DO EVERYTHING IN ONE PASS
/THEY MUST HONOR PLU,PLD,BS, AND SGR VALUES 0,1,4
/THEY SHOULD BE CAPABLE OF 7 BIT CHARACTER SELECTION AND BE CAPABLE
/OF PRINTING TECHNICAL CHARACTERS

/THIS OVERLAY IS RESPONSIBLE FOR JUSTIFYING (IF NECESSARY) AND PRINTING
/THE LINE OF TEXT WHICH HAS BEEN ASSEMBLED IN PRLBUF BY PRGTLN
/EXTERNAL ARGUMENT USED BY JUSTIFICATION OVERLAYS:

/PLPTR - A POINTER INTO THE LINE BUFFER.  INITIALLY, IT POINTS AT THE LAST
/         CHARACTER IN THE LINE, WHICH IS THE RETURN.

/PRLBUF - A LITERAL WHICH IS THE ADDRESS OF THE BEGINNING OF THE BUFFER; IT
/         IS THE ADDRESS AT WHICH THE FIRST CHARACTER IS STORED.

/PRQPIT - THE PITCH VALUE.  IT IS ZERO IF PROPORTIONAL PITCH IS SPECIFIED,
/         NON-ZERO OTHERWISE.

/PRRM   - THE JUSTIFICATION FLAG.  IT IS ZERO IF THE LINE IS NOT TO BE
/         JUSTIFIED; OTHERWISE, IT THE LENGTH OF THE LINE IN PRINT UNITS.

/PLNRCS - CHARACTER SIZE.  IT IS THE SIZE OF A CHARACTER IN PRINT UNITS.

/PRCCH  - PRINT HEAD POSITION.  INITIALLY, IT IS THE POSITION THE PRINT
/         HEAD IS IN.
/SOME DEFINITIONS WILL MAKE THE COMMENTS EASIER TO FOLLOW:

/CHARACTER - ONE OF THE ASCII VALUES WHICH FILL THE LINE BUFFER.  THE
/     POSSIBLE CHARACTERS ARE BACK SPACE, TAB, SPACE, AND TEXT.  THE
/     LAST POSITION IN THE LINE BUFFER IS FILLED BY A RETURN, WHICH IS
/     NOT A CHARACTER.

/DEAD KEY SEQUENCE - A SEQUENCE OF TEXT DELIMITED BY BACK SPACES
/     (I.E., TEXT1 BS TEXT2 BS TEXT3).  SUCH SEQUENCES ARE PRINTED WITH
/     THE CHARACTERS SUPERIMPOSED.

/POSITION - ALL THE CHARACTERS WHICH MAP TO THE SAME PHYSICAL PLACE ON
/     THE PRINTED PAGE ARE SAID TO BE THE SAME POSITION.  THEREFORE,
/     ALL THE CHARACTERS IN A DEAD KEY SEQUENCE ARE A POSITION.  A CHARACTER
/     WHICH IS NOT PART OF A DEAD KEY SEQUENCE IS A POSITION.  IN THIS
/     CODE, WE JUSTIFY BY POSITIONS; WE FIND THE WIDTH OF POSITIONS.  IT
/     IS AN IMPORTANT CONCEPT.

/WIDTH - THE SPACE OCCUPIED BY A POSITION WHEN IT IS PRINTED.  IN
/     NON-PROPORTIONAL PRINTING, THE WIDTH IS STANDARD (PLNRCS).  IN
/     PROPORTIONAL PRINTING, THE WIDTH VARIES DEPENDING ON THE CHARACTERS
/     IN THE POSITION.

/TEXT - ANY PRINTABLE ASCII CHARACTER


/WE ALSO MAKE SOME ASSUMPTIONS:

/1.  THE ONLY CHARACTERS IN THE BUFFER ARE RETURN, BACK SPACE, TAB, SPACE,
/    AND TEXT.

/2.  THE ONLY PLACE BACK SPACES OCCUR ARE BETWEEN TEXT.

/PLPTR currently addresses the return word in the buffer.  Bit 1 of this word
/is clear for a hard return and is set otherwise.  We save the type of the
/return for later use.

	AC2000			/ MASK SOFT RETURN BIT
	AND I	PLPTR
	DCA	PRJRET		/ RECORD TYPE OF RETURN
				/ PRJRET=2000 IF SOFT,
				/ PRJRET=0000 IF HARD, CENTERING, OR PARA MARKER

	DCA	PLPFLG		/ PROPORTIONAL PRINTING ON--OVLN3A	/C268
	JMS	PROV		/ CALL ROUTINE TO SEND DECPSP		/A268
		OBPLIN		/ BY LOADING THE "C" TYPE OVERLAY	/A268
	JMS	PLINIT		/ AND THEN CALLING THE ROUTINE		/A268

/We now set up some variables in order to process the line.  We want the
/following conditions to hold:

/PLPTR - Points to the return character (this already holds)

/PLCNT - Is the negative of the number of characters, including the return,
/		in the line.

/PLDIR - Is minus one so that processing can proceed from right to left.

LN3A0A,								/A211
	TAD	PLPTR	/Subtract the address of the return, and one more
	CMA
	TAD   (PRLBUF)	/From the address of the first character
	DCA	PLCNT	/And save as the buffer count

	AC7777
	DCA	PLDIR	/Set the direction of printing


/If the line ends with a soft return, we now strip all trailing spaces, tabs,
/and backspaces from the line.  If the line ends with a hard return, we do
/not strip these characters.  We strip in case of soft return because the
/trailing spaces interfere with justification, and should not appear in case
/the line is underlined.  In either case, when the loop is over, the following
/conditions will hold:

/1.  PLPTR will point to the right most character of the line which should
/	be printed (which will be a text character in case of a soft return
/	and the one before the return for a hard return).

/2.  PLCNT will be the negative of the number of characters from the beginning
/	of the buffer to the character pointed to by PLPTR.

LN3A0,
	JMS	PLNXT	/Look at the next character
	JMP	PRGSL1	/No more characters so the line was all blank--no
			/need to bother printing the line

	TAD	PRJRET		/ WAS IT A SOFT RETURN?
	SNA CLA
	JMP	LN3A1		/ NO, NO NEED TO STRIP TRAILING SPACES

	TAD I	PLPTR	/Get the character
	AND	P177	/Strip the mode bits
	TAD	(-SPC)	/Is it a space/tab/backspace?
	SPA SNA CLA	/skip if positive AND non-zero
	JMP	LN3A0	/Yes--continue stripping the line


/The line was not blank and must be printed.  We now initialize some variables
/used to gather information about the line for printing and justification.

LN3A1,
	TAD	PLCNT
	DCA	PRLBCT	/Save the stripped size of the line

	DCA	PLPS	/Clear position justification spacing
	DCA	PLSS	/Clear space justification spacing

	AC7777
	DCA	PRJPOS	/Initialize number of inter-position spaces
	DCA	PRJSPC	/Clear number of spaces

	DCA	PRRCH	/Clear right end of line position
	DCA	PRPASS	/Clear the pass counter

	DCA	PRJDEF	/Clear deficiency (no justification required yet)/A080
/This loop gathers information about the spacing and composition of the
/line by processing the characters from left to right.  When the loop
/completes, we will know:

/PRRCH - The offset of the right end of the line from the left margin in
/		elementary print units.

/PRJPOS - The number of inter-position spaces in the justifiable portion
/		of the line.

/PRJSPC - The number of spaces in the justifiable portion of the line.

/The loop also marks each character in the justifiable portion of the line
/by setting bit 0 of the character.  The justifiable portion of the line is
/that part which follows the rightmost tab space.

	AC4000		/We first set the count enable flag.  This flag is
	DCA	PRJENB	/to mark justifiable characters and is examined when
			/deciding whether to count them.  It is ultimately
			/cleared when the first tab is encountered.

/At the beginning of each iteration, PLPTR points to the first character in a
/position.  Each iteration treats the entire position with all of its dead
/keys, if any.

LN3A2,
	TAD I	PLPTR	/Get the character
	AND	P177	/Strip the mode bits

	TAD	(-SPC)	/Is it a space?
	SZA CLA
	JMP	LN3A3	/No, a text--jump to treat it

/The character is a space.  If it is part of a tab, the enable flag must be
/cleared.  If the enable flag has not been cleared by this time, we increment
/the number of justifiable spaces and fall through to the text counter.

	TAD I	PLPTR	/Retrieve the space character
	CMA RAL		/AC0=0 if the space is part of a tab, 1 otherwise
	AND	PRJENB	/AC=4000 if counting should still be enabled

	SZA		/Do not count the space if we are disabled
	ISZ	PRJSPC	/Increment the space count if we are enabled
	DCA	PRJENB	/And save the new enable flag
/This section handles characters.  If the enable flag is set, we count the
/position.

LN3A3,
	TAD	PRJENB	/Get the enable flag
	SZA CLA		/If the flag is clear, don't count the position

	ISZ	PRJPOS	/Increment the number of inter-position spaces
	NOP		/In case it skips (since it is initialized to -1)


/ NOW GET THE WIDTH OF THE POSITION.  IN THE CASE OF THE DP OR HOST
/ WE CAN SIMPLY GET THE VALUE PLNRCS.  IF AND WHEN MATRIX PRINTERS
/ CAN DO PROPORTIONAL PRINTING WE WILL HAVE TO DO SOMETHING DIFFERENT,
/ POSSIBLY JMS PLSPCX AS IS DONE FOR LQPS

	TAD	PLNRCS	/GET POSITION WIDTH				/C211

	TAD	PRRCH	/Update the right end measure
	DCA	PRRCH

/We now enter a sub-loop which moves the buffer pointer to the first
/character of the next position.  It also marks each non-backspace character
/as justifiable or not with the enable flag.  When we reach the next position,
/we continue the main loop.  If we just treated the last position, we leave
/the main loop and continue with processing.

LN3A4,
	TAD I	PLPTR	/Get the character
	TAD	PRJENB	/Mark it with the enable flag
	DCA I	PLPTR	/Save the character back into the buffer

LN3A4A,	JMS	PLCHBS	/Are there more characters?
	JMP	LN3A5	/No--leave the loop
	JMP	LN3A4A	/YES, A multinational PRECEDENCE		/A271
	JMP	LN3A4A	/YES, A TECHNICAL PRECEDENCE			/A233
	JMP	LN3A4	/Yes, in this position--continue the inner loop
	JMP	LN3A2	/Yes, in a new position--continue the outer loop

LN3A5,		/THE LINE HAS BEEN COMPLETELY MEASURED

/THIS SECTION PRINTS LINES TO A DRAFT PRINTER.
/MULTIPLE HITS AND UNDERLINING ARE HANDLED
/BY MAKING MULTIPLE PASSES THROUGH THE LINE.

/First, we determine whether or not justification is needed.

	TAD	PRBIF		/ GET BOLD INTERPRETATION FLAG		/A152
	SZA CLA								/A152
	AC2000			/ MASK AC1				/A152
	CMA			/ EITHER CLEAR IT OR LEAVE ALONE	/A152
	DCA	PRBIFM		/ SAVE AS BIT MASK			/A152

	DCA	PLSSC	/Clear the justification remainder
	DCA	LPUPAS	/Init the pass counter (for underlines).	/A092

	TAD	PRJRET		/ WAS IT A SOFT RETURN?
	SNA CLA
	JMP	LNLIN0		/ NO, NO JUSTIFICATION NEED BE DONE

	TAD	PRJSPC	/Are there any justifiable spaces?
	SNA CLA
	JMP	LNLIN0	/No--no justification can be done

	TAD	PRRM	/Does the ruler specify justification?
	SNA
	JMP	LNLIN0	/No--no need to do justification

/The AC now contains the desired justified line length.  We subtract that
/from the current line length to obtain the amount of deficiency.

	CIA
	TAD	PRRCH	/Subtract from  the current line length	
	SMA
	JMP	LNLIN0	/Line is already long enough or too long
	DCA	PRJDEF	/Save the negative of the deficiency

/We now divide the deficiency among the spaces.  The remainder is the negative
/of the number of additional space units which must be inerted, minus one.

	TAD	PRJSPC	/Divide the deficiency between the spaces
	JMS	PRDVID
	DCA	PLSS	/Save as the increased spacing to do

	TAD	PRJDEF	/Get the remainder
	DCA	PLSSC	/Save as the correction factor


LNLIN0,	CLA
	TAD	PRMCLM		/GET CURRENT MULTICOLUMN MARGIN
	JMS	LPIND		/INDENT THE MARGIN

	DCA	TCHBLD		/CLEAR TECH BOLD FLAG
	TAD	PRLBCT	/RESTORE THE CHARACTER COUNT FOR THE LINE
	DCA	PLCNT

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

	AC0001
	DCA	PLDIR	/SET THE DIRECTION OF BUFFER SCAN

/FOR THE LN03 WE WILL MAKE ONLY ONE PASS THROUGH THE LINE
/WE WILL USE PLU AND PLD TO DO SUPERSCRIPTS AND SUBSCRIPTS
/WE WILL USE SGR TO ENABLE BOLD AND UNDERLINE
/WE WILL USE OUR NORMAL TECHNICAL CHARACTER SET PROCESSING
/ALGORITHMS AFTER WE HAVE TAKEN CARE OF THE PRINTING MODE,
/BUT BEFORE PRINTING THE CHARACTER.

/THE LN03 IS NOT CAPABLE OF EXTRA DARK PRINTING



	TAD	(OVLN3B
	JMS	PROV
		OBLN3B


/THE FOLLOWING DPLN JUSTIFICATION VARIABLES MUST APPEAR IN THE FIRST	/A215
/OF THE DPLN JUSTIFICATION OVERLAYS TO AVOID FORWARD REFERENCES TO	/A215
/OVERLAY VARIABLES WHICH ARE NOT LOADED YET ...				/A215

*LPSS		/FORCE A TEMPLATE MATCH					/A247

LPSS,	0	/Saves the value of PLSS between passes
LPSSC,	0	/Saves the value of PLSSC  between passes
PLSSC,	0	/Remainder
LPPASS,	0	/After a pass, is non-zero if another pass is needed
LPUPAS,	0	/Pass # (used to count how many times to bold the undrlns)/A092
PRBIFM,	0	/ MASK FOR #DARKNESS PASSES IF PRBIF>0			/A152
SISOFG,	0	/SHIFT IN SHIFT OUT FLAG. SET WHEN NEEDED FOR CODE 23
CHGSET,	0	/FLAG FOR CHANGING TO ORIGINAL G SET AFTER PRINTING
TCHBLD,	0	/FLAG FOR TECH CHARACTERS AND ELIMINATING BOLD INTERPRETATION.
CURPOS,	0	/CURRENT POSITION. +1 UP 1/2; 0 IS ON LINE;-1 IS	/A222
		/DOWN A HALF OF A LINE					/A222
PPUNDL,	0	/UNDERLINE PRINTED FLAG
LBADR,	"B&177+4000
/---------------
	PAGE

/THE MODE BITS OF EACH CHARACTER ARE NOT REARRANGED IN THIS OVERLAY
/THEREFORE, THEY ARE AS RECEIVED:

/AC  2  3			AC  4
/    0  0   NORMAL		    0     NOT BOLD
/    0  1   UNDERSCORE		    1     BOLD
/    1  0   SUPERSCRIPTED
/    1  1   SUBSCRIPT


/AC  0
/    0   THIS CHARACTER IS NOT A SPACE
/    1   THIS CHARACTER IS A REAL SPACE THAT IS JUSTIFIABLE
/------------------------
	PAGE

OVTYPE=OLB
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM
OVLN3B=.-OVRLCA
OBLN3B=OVTYPE+OVNUM


LNLIN3,	TAD I	PLPTR		/GET THE FIRST CHARACTER IN ITS POSITION
	JMS	PRMODE		/PROCESS THE MODE BITS
				/...SUPER/SUB, BOLD, UNDERLINE


/NOW CHECK FOR THE CODE 21, 22, OR 23. THIS IS THE SEQUENCE FOR
/PRINTING A TECHNICAL CHARACTER IN ANOTHER CHARACTER SET. IT ALSO CHANGES TO
/G2 OR G3. THE CHARACTER STRING WILL BE TWO CHARACTERS. THE FIRST WILL BE THE
/CONTROL CHARACTER (21,22,OR 23), THE NEXT WILL BE THE CHARACTER OR THE "G"
/SET DESIRED. NOTE THAT THIS TWO CHARACTER STRING IS NOT CALLED A "G" STRING
/BUT IT COULD BE IF YOU SO DESIRE. THE CHARACTER ATTRIBUTES WILL ALSO BE
/ON THE CONTROL CHARACTER.

LNLIN4,	TAD I	PLPTR	/NOW CHECK TO SEE IF THE CHARACTER IS A CONTROL
	AND	P177	/CHARACTER THAT PRECEDES THE TECHNICAL CHARACTER.
	TAD	(-23)
	SZA		/23?
	IAC
	SNA		/OR 22?
	JMP	LNLI4G	/YES, PROCESS AND DON'T TRY TO JUSTIFY
	IAC
	SZA CLA		/IS IT 21?
	JMP	LNLI5B	/NO, GO PROCESS NORMALLY


/HERE FOR A CONTROL CHARACTER 21.   CHECK WHICH G SET IS LOADED IN G1	/A247
/IF LOCATION PCHBFO CONTAINS EITHER AN ASCII "A" OR "B", THEN PRINT
/SO,CHR,SI. IF PCHBFO DOES NOT CONTAIN EITHER "A" OR "B", THEN CHANGE TO
/B SET, PRINT SO,CHR,SI, AND RETURN TO THE OLD CHARACTER SET.


LNLI4E,	TAD	PCHFBO	/ SEE IF CHARACTER SET CHANGE IS NEEDED.
	TAD	(-"B+200) /IF CHARACTER IS B OR A, THEN NO CHANGE NEEDED.
	SZA
	IAC
	SNA CLA
	JMP	LNLI4F	/IS A. OR B. AS ABOVE

	AC7777		/SET FLAG TO INDICATE THAT WE HAVE CHANGED.
	DCA	CHGSET
	TAD	(LBADR)	/HAVE TO CHANGE.
	JMS	PRESCS
		PCSTG1
LNLI4F,	AC7777
	DCA	SISOFG	/SET FLAG TO SPAN CHARACTER WITH SO,CHR,SI
	JMP	LNLIN8	/EXIT AND DECREMENT THE HIT BITS

/HERE IF CODE 22 OR 23

LNLI4G,	TAD I	PLPTR	/ SEE IF CHARACTER SET CHANGE IS NEEDED.
	AND	P177	/MASK OFF MODE BITS
	TAD	(XSSS2-22)
	JMS	PRESCS
		PCSS	/CHANGE TO G2 OR G3
	CLA
	JMP	LNLIN8	/EXIT AND DECREMENT THE HIT BITS

/ DO BOLD INTERPRETATION STUFF HERE WHEN WE GET THE
/ REST OF THE STUFF WORKING

LNLI5B,	TAD I	PLPTR	/GET THE CHR BACK

/WE TEST TO SEE IF THE CODE IS THAT OF THE REQUIRED SPACE RQSP		/A216
/IF SO, WE PRINT THE SPACE CODE (40) INSTEAD OF THE REQUIRED SPACE (177)/A216
/CODE. THIS IS BECAUSE THE REQUIRED SPACE CODE IS JUST A PHONY CODE TO	/A216
/BE REPLACED AT THIS TIME SO THAT IT CANNOT CONTRIBUTE TO JUSTIFICATION	/A216

	AND	P177	/BIT 0 MAY OR MAY NOT BE SET
	TAD	(-RQSP)	/SUBTRACT REQUIRED SPACE CODE (177)		/A216
	SZA CLA		/SKIP IF REQUIRED SPACE				/A216
	JMP	LNLI5C	/NOT A REQUIRED SPACE
	TAD	(SPC)	/IT IS A REQUIRED SPACE.
	JMP	LNLI5E	/PRINT AN ASCII 40 (SPACE).

LNLI5C,			/SEE IF PRINT SHIFT OUT FOR A TECH CHR
	TAD	SISOFG		/IS SO,CHR,SI FLAG SET?
	SNA CLA
	JMP	LNLI5D		/NO FLAG, JUMP AHEAD
	TAD	(SO)		/GET SHIFT OUT
	JMS	PRCHAR

LNLI5D,	TAD I	PLPTR	/GET THE CHARACTER AGAIN
	AND	(200)	/SEE IF BOLD BIT IS SET
	R3L		/PUT IN POSITION FOR OTHER SCHEME
	DCA	PRBIC	/SAVE AS BOLD INTERPRETATION VALUE OF THIS CHR
	TAD	PRBIF	/SEE IF WE ARE DOING BOLD INTERPRETATION
	SZA CLA
	JMS	LPBI	/DO BOLD INTERPRETATION

	TAD I	PLPTR	/GET THE CHARACTER AGAIN--
LNLI5E,	AND	P177		/ strip unwanted bits
	JMS	PRCHAR		/PRINT IT AFTER ALL THE FINAGLEING.
	TAD	SISOFG		/DID WE PRINT SO?
	SZA CLA
	TAD	(SI)		/GET SHIFT IN.
	JMS	PRCHAR
	DCA	SISOFG		/CLEAR THE FLAG THAT GOT US HERE.
	TAD	CHGSET		/SEE IF WE MUST RESTORE THE OLD G SET.
	SNA CLA
	JMP	LNLI5F		/NO

	DCA	CHGSET		/YES, CLEAR FLAG
	TAD	(PCHFBO)	/RESTORE THE G SET BEING USED FOR BOLD
	JMS	PRESCS
		PCSTG1
	CLA
LNLI5F,

/NOW WE SEE IF ANY JUSTIFICATION IS NECESSARY.  ALL SPACES IN THE
/JUSTIFIABLE PORTION OF THE LINE ARE MARKED WITH BIT 0 SET.  AN EXTRA
/PLSS UNITS ARE ADDED TO EACH SUCH SPACE.  IN ADDITION, PLSSC IS
/INCREMENTED EACH TIME.  AS LONG AS IT REMAINS NEGATIVE OR ZERO, AN
/EXTRA UNIT IS ADDED TO EACH SPACE.  SINCE ONLY UNITS IN MULTIPLES OF
/SPACES ARE OUTPUT IN LPMOVE, LEFTOVER UNITS ARE RETAINED UNTIL THE
/NEXT SPACE.
	
/FIRST DETERMINE IF THE CHARACTER JUST OUTPUT WAS A JUSTIFIABLE SPACE.

	TAD I	PLPTR	/GET THE CHARACTER
	AND	(4177	/MASK LEAVING ONLY JUSTIFICATION BIT AND CHR
	TAD	(-4040)	/SEE IF WAS A JUSTIFIABLE SPACE
	SZA CLA		/SKIP IF SO
	JMP	LNLIN8	/IT WASN'T--NO JUSTIFICATION

	TAD I	PLPTR	/GET THE JUSTIFIABLE SPACE CODE
	MQL		/AND PUT IN MQ FOR LPMOVE

/Next determine how much space to add.  We increment PLSSC each time.  As soon
/as it reaches zero, we now longer use one additional unit.

	ISZ	PLSSC	/Increment the remainder counter
	NOP		/In case it skips

	TAD	PLSSC	/See if the remainder counter is still negative
	SPA CLA
	AC0001		/Yes--use one additional unit

	TAD	PLSS	/Recover the extra space sizing

/WE NOW HAVE THE AMOUNT OF EXTRA SPACING REQUIRED IN THE AC.  LPMOVE PADS
/OUT AS MUCH OF THE EXTRA SPACE AS IT CAN BY PRINTING THE CHARACTER IN THE
/MQ.

	JMS	LPMOVE	/DO THE MOTION

LNLIN8,	JMS	PLNXT	/POINT AT THE NEXT CHARACTER
	JMP	LNLI11	/NO MORE CHARACTERS--END OF THE LINE
	TAD I	PLPTR	/GET THE NEXT CHARACTER
	TAD	(-BS)	/IS IT A BACKSPACE?
	SZA CLA
	JMP	LNLIN3	/NO--THIS IS A DESIRED CHARACTER

/WE HAVE FOUND A BACKSPACE; OUTPUT IT & DO NEXT CHR.

	TAD I	PLPTR
	JMS	PRCHAR
	JMP	LNLIN8


/WE ARE THROUGH WITH THE LINE.  WE MUST MAKE SURE THE
/CARRIAGE IS RETURNED TO THE PROPER VERICAL POSITION
/AND THAT BOLDING/UNDERLINING ARE OFF

LNLI11,	JMS	PRMODE	/CALL ROUTINE TO CLEAR SUPER/SUB UNDL/BOLD
	TAD	(CR)	/SEND A CARRIAGE RETURN TO END THE LINE
	JMS	PRCHAR
	JMP	PRGSL1	/ENTER THE SPACING ROUTINE. IT IS END OF PRINT LINE.
/----------------
	PAGE

/THIS ROUTINE IS USED TO SEND OUT THE ESCAPE SEQUENCES TO SET UP THE
/PROPER VERTICAL POSITION, BOLD ATTRIBUTE, AND UNDERLINE ATTRIBUTE.
/IT USES ANSI SEQUENCES TO DO THIS (PLU, PLD AND SGR).  PRINTERS WHICH
/CAN ACCEPT THESE SEQUENCES DO NOT NEED A MULTIPLE PASS STRATEGY TO PRINT
/THE LINE.

/ORIGINALLY ADDED FOR THE "LN03 DRIVER"                         /A247

/IT HAS THE SAME NAME AS PRMODE SO IT CAN USE THE SAME VERT ROUTINE

/NOW THAT WE ARE SUPPORTING A PRINTER THAT HAS MULTIPLE FONT CAPABILITY,
/WE FIND THAT THE OLDS WAYS ARE NOT ADEQUATE.  PLU AND PLD ARE DEFINED
/TO BE HALF A LINE UP OR DOWN BASED ON THE CURRENT VERTICAL SPACING,
/WHICH IS CALCULATED FROM THE FONT.  THUS IF WE CHANGE FONTS IN THE
/MIDDLE OF A LINE USING BOLD INTERPRETATION, AND THE NEW FONT HAS A
/DIFFERENT SIZE THAN THE OLD FONT, WE MUST BE CAREFUL ABOUT THE ORDER
/IN WHICH WE DO THINGS, ELSE WE MAY INDUCE A BASELINE SHIFT WHEN GOING
/FROM BOLDED SUPERS TO NON BOLDED NORMAL TEXT OR VICE VERSA.

/THUS WE ESTABLISH THE FOLLOWING RULE:
/  1.	WHEN GOING FROM A NONBOLDED BASELINE TO A BOLDED SUPER OR SUB,
/	DO THE FONT CHANGE AFTER THE VERTICAL MOTION.
/  2.	WHEN GOING FROM A BOLDED SUPER OR SUB TO A NONBOLDED CHR
/	IN A DIFFERENT VERTICAL POSITION, DO THE FONT CHANGE BEFORE
/	THE VERTICAL MOTION

PRMODE, XX
	DCA	PRMTMP		/SAVE ARGUMENT FOR LATER USE
	TAD	PRMTMP
        BSW
        AND     (0014
        TAD     (LNVECT         / ADD ADDRESS OF THE MATRIX
        DCA     PRJUMP          / SAVE TO INDIRECT JUMP THROUGH
	JMP	PRMOD1		/ TO PRESERVE TEMPLATE MATCH

PRJUMP, 0
NEWPOS, 0                       / NEW VERTICAL SELECT
OLDPOS, 0                       / OLD VERTICAL SELECT
ULBREQ, 0                       / UNDERLINE/BOLD STATUS REQUEST
PRMTMP,	0			/ TEMPORARY STORAGE OF ARGUMENT

PRMOD1,	JMS	PROV		/ LOAD OVERLAY CONTAINING VERT
		OBVERT		/
        JMP I   PRJUMP          / EXECUTE THE APPROPRIATE ROUTINE

LNSUND, JMS     VERT            / SELECT NORMAL VERTICAL POSITION
        AC0004                  / REQUEST UNDERLINE
        JMP     LNRSTU          / GO SET INTO REQUEST WORD

LNVECT,		/FROM NORMAL;SUPER;SUB
	JMP	LNRMAL; 000; 001; 101	/REQUEST NORMAL
	JMP	LNSUND; 000; 001; 101	/REQUEST UNDERLINE
        JMP     LSUPER; 101; 000; 102	/REQUEST SUPER
	JMP     LSUBSC; 001; 002; 000	/REQUEST SUBSCT

LSUBSC,	IAC                     / NEWPOS WILL BE SELECT 2
LSUPER,	IAC                     / NEWPOS WILL BE SELECT 1
LNRMAL, JMS     VERT            / SELECT 0 VERTICAL

/NOW HANDLE UNDERLINE ATTRIBUTE
LNRSTU,	DCA     ULBREQ          / CLEAR UNDERLINE/BOLD REQUEST
	TAD	PRMTMP		/ GET THE CHARACTER BACK
        AND     (200)           / ISOLATE THE BOLD BIT
        BSW                     / GET INTO
        CLL RAR                 / BIT 11 (WEIGHT 1)
        TAD     ULBREQ          / SET UP
        DCA     ULBREQ          / NEW UNDERLINE/BOLD REQUEST
        TAD     ULBREQ          / SEE IF SAME STATUS AS BEFORE
        CIA                     /
        TAD     UNDERL          /
        SNA CLA                 /
        JMP I   PRMODE          / YES, NO FURTHER ACTION NECESSARY

/WE HAVE DETECTED THE NEED FOR A CHANGE IN THE BOLD AND/OR UNDERLINE
/ATTRIBUTE.  WE WILL ISSUE SGR FIRST WITH A ZERO PARAMETER, AND
/THEN WITH THE BOLD NUMERIC VALUE (1) IF THAT IS WHAT IS REQUIRED,
/AND THEN WITH THE UNDERLINE NUMERIC VALUE (4), IF THAT IS WHAT IS
/REQUIRED

        JMS     PRESCS          / CALL SGR SEQUENCE
                PCSGR           / RESET WITH CLEAR AC

	TAD	PRBIF		/ SEE IF DOING BOLD INTERPRETATION
	CMA			/
        AND     ULBREQ          / AND WITH REQUESTED VALUE
	AND	(0001)		/ LOOK ONLY AT BOLD BIT
        SZA                     / SKIP AND DO A HARMLESS AND OR
        JMS     PRESCS          / SET THE BOLD ATTRIBUTE
                PCSGR           / ANSI SGR SEQUENCE

        AC0004                  / SET THE UNDERLINE MASK
        AND     ULBREQ          / AND WITH REQUESTED VALUE
        SZA                     / SKIP AND DO A HARMLESS AND OR
        JMS     PRESCS          / SET THE UNDERLINE ATTRIBUTE
                PCSGR           / ANSI SGR SEQUENCE
                CLA             / CLEAR RETURNED VALUE

        TAD     ULBREQ          / GET NEW VALUES FOR BOLD/UNDERLINE
        DCA     UNDERL          / SAVE FOR POSTERITY
	JMP I	PRMODE		/ AND EXIT
/--------------------
	PAGE


OVTYPE=OLA
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM



/THE SAVE AND RESTORE ROUTINES ARE USED TO HANDLE HEADERS AND FOOTERS.  THE
/ESSENTIAL IDEA IS THAT WHEN A HEADER OR FOOTER PRINT CONTROL BLOCK IS
/ENCOUNTERED, THE STATE OF THE PRINTER IS RECORDED.  IT IS RECORDED IN
/SUCH A WAY THAT THAT STATE CAN BE RESTORED LATER AT ANY TIME.

/THEN, WHEN IT COMES TIME TO PRINT A HEADER/FOOTER, THE CURRENT STATE OF
/THE PRINTER IS SAVED, AND THE APPROPRIATE SAVED STATE IS RESTORED.  IN THIS
/STATE, THE PRINTER CAN PRINT THE HEADER/FOOTER.  WHEN THE HEADER/FOOTER
/COMPLETES, THE OLD CURRENT STATE IS RESTORED, AND PRINTING RESUMES WHERE
/IT LEFT OFF.

/THE STATE OF THE PRINTER CAN BE DIVIDED INTO TWO PARTS:

/1.  PRINTER VARIABLES
/2.  POSITION IN THE FILE

/THE PRINTER VARIABLES WHICH MUST BE SAVED DURING A STATE SAVE ARE:

/1.  PRRLSZ - THE LINE SIZE SETTING MANDATED BY THE RULER.  THIS IS SAVED
/             SO THAT THE RULER IN EFFECT AT THE TIME OF THE SAVE CAN TAKE
/             EFFECT AGAIN.

/2.  PRRM - THE JUSTIFICATION SETTING MANDATED BY THE RULER.  AGAIN, THIS
/           IS SAVED SO THAT THE RULER IN EFFECT AT THE TIME OF THE SAVE CAN
/           TAKE EFFECT AGAIN.

/3.  PRGCBK - THE BACKUP LOCATION FOR THE READ ROUTINE, PRGCHR.  THIS IS
/             SAVED SO THAT ANY BACKED UP READ IS STILL BACKED UP WHEN
/             THE STATE IS RESTORED.


/THE POSITION IN THE FILE MUST ALSO BE SAVED.  THE IDEA HERE IS THAT THE
/STATE OF THE FILE SYSTEM IS SAVED, SO THAT WE CAN LATER MOVE TO THE
/APPROPRIATE PART OF THE FILE WHEN IT IS TIME TO RESTORE.  THIS WORKS
/QUITE NICELY WHEN READING FROM A FILE, SINCE IT IS POSSIBLE TO BACK UP
/IN A FILE.  HOWEVER, WHEN READING CHARACTERS FROM THE EDITOR UNDER LIST
/PROCESSING, IT IS NOT POSSIBLE TO BACK UP.  THEREFORE, TWO STRATEGIES ARE
/EMPLOYED; ONE FOR FILE READING, ONE FOR LIST PROCESSING.

/1.  FILE SYSTEM SAVE/RESTORE IS HANDLED JOINTLY BY THE PRINTER AND THE FILE
/    SYSTEM.  FOUR VARIABLES WITHIN THE FILE SYSTEM DEFINE THE STATE OF THE
/    FILE READ; THESE VARIABLES ARE REMOTELY SAVED AND RESTORED BY THE
/    PRINTER.  WHEN RESTORING, TWO ROUTINES MUST BE INVOKED FOLLOWING THE
/    VARIABLE RESTORATION TO FILL THE BUFFERS BACK UP.  THE ADVANTAGE OF THIS
/    SCHEME IS THAT THERE IS NO RESTRICTION OF HEADER/FOOTER LENGTH.

/2.  LIST PROCESSING SAVE/RESTORE IS HANDLED SOLELY BY THE PRINTER.  WHEN
/    THE HEADER/FOOTER BLOCK IS ENCOUNTERED, IT IS READ CHARACTER BY
/    CHARACTER AND WRITTEN OUT TO A SPECIAL DISK BUFFER.  WHEN THE HEADER/
/    FOOTER IS RESTORED, THE CHARACTERS ARE READ BACK FROM THE DISK.  HENCE,
/    DURING LIST PROCESSING THE PRINTER MUST READ FROM THE EDITOR WHEN
/    PRINTING NORMAL TEXT, AND FROM THE DISK BUFFER WHEN PROCESSING A
/    HEADER/FOOTER.  UNDER THIS SCHEME THE LENGTH OF A HEADER OR FOOTER,
/    INCLUDING RULERS, IS LIMITED TO FIVE BLOCKS.


/THE ALERT READER MAY WONDER WHY THE TWO CASES ARE TREATED SEPARATELY.  A
/FIVE BLOCK RESTRICTION IS NOT SEVERE, SO WHY NOT BUFFER ALL HEADER/FOOTERS
/ON DISK?  WHEN DOING LIST PROCESSING, THE SCROLL BUFFERS ARE NOT IN USE,
/AND THESE ARE USED TO BUFFER HEADER/FOOTERS BEFORE WRITING TO DISK.  THERE
/IS NO SUITIABLE BUFFER TO USE IN THE GENERAL CASE.


/THIS ROUTINE SAVES THE STATE OF THE PRINTER AND FILE SYSTEM.  IT IS USED
/TO "REMEMBER" HEADERS AND FOOTERS SO THAT THEY CAN BE PRINTED LATER AND
/TO "REMEMBER" OUR PLACE WHEN WE PRINT HEADERS/FOOTERS SO THAT WE CAN
/PICK UP WHERE WE LEFT OFF LATER.

/THE ARGUMENT TO THIS ROUTINE IS ZERO IF THE STATE IS TO BE SAVED FOR
/RESTORATION AS THE CURRENT LOCATION; MINUS ONE IF THE STATE IS TO BE
/SAVED FOR RESTORATION AS A FOOTER; AND ONE IF THE STATE IS TO BE SAVED
/FOR RESTORATION AS A HEADER.

/AC=TYPE OF SAVE
/JMS	PRSAVE
/AC=0


	OBPRSV=OVTYPE+OVNUM						/A185
PRSAVE,	XX

	DCA	PRFLAG	/SAVE AS THE TYPE OF PRINTING IN PROGRESS

/UP TO EIGHT WORDS MAY BE SAVED WHEN SAVING THE STATE. HERE, WE COMPUTE (M034)
/THE OFFSET INTO THE SAVE TABLE CORRESPONDING TO THE REQUESTED TYPE OF
/SAVE.

	TAD	(10)	/MULTIPLY THE ARGUMENT BY 8(10)	/M034
	JMS	PRMULT
		PRFLAG

/THE FIRST SECTION OF THE SAVE TABLE CONTAINS THE FOOTER SAVE; THE SECOND
/SECTION CONTAINS THE CURRENT TEXT SAVE; AND THE THIRD SECTION CONTAINS
/THE HEADER SAVE.

	TAD (PRSAV+10-1) /ADD THE ADDRESS OF THE SAVE TABLE PLUS EIGHT /M034
	DCA	X0	/SAVE IN AN AUTO-INCREMENT REGISTER

/WE NOW SAVE THE FOUR CRUCIAL PRINTER VARIABLES IN THE SAVE TABLE. /M034

	TAD	PRRM	/SAVE THE JUSTIFICATION SETTING
	DCA I	X0

	TAD	PRRLSZ	/SAVE THE LINE SPACING
	DCA I	X0

	TAD	PRGCBK	/SAVE THE BACKUP LOCATION
	DCA I	X0
	
	TAD	RULRRM	/A034 SAVE THE RIGHT MARGIN
	DCA I	X0	/A034
	
	JMS	PRTRNC	/GET THE PROPER RULER SETTING FOR THIS SAVE

/NOW, OUR STATE SAVE METHOD DIVERGES, DEPENDING ON WHETHER WE ARE DOING
/LIST PROCESSING OR NOT.

	TAD	LPFLAG	/ARE WE DOING LIST PROCESSING?
	SZA CLA
	JMP	PRSAV2	/YES--JUMP TO HANDLE A LIST PROCESSING SAVE


/WE ARE DOING A REGULAR FILE SYSTEM SAVE.  WE SIMPLY SAVE THE FOUR VALUES
/FROM THE FILE SYSTEM AND SAVE THEM IN THE SAVE TABLE.

/GET THE ADDRESS PRECEEDING THE FIRST OF THE FOUR VARIABLES TO BE SAVED.
/THE FOUR VARIABLES ARE ALL IN A BLOCK.

	TAD   (FSSAV-1)	/GET ONE BEFORE THE BLOCK TO BE SAVED

	DCA	X1	/SAVE IN AN AUTO-INCREMENT REGISTER
	TAD	(-4)	/SET UP THE LOOP COUNT
	DCA	T1

/THIS LOOP SAVES THE FOUR FILE SYSTEM VARIABLES.

PRSAV1,	TAD I	X1	/GET A VARIABLE
	DCA I	X0	/SAVE THE VALUE
	ISZ	T1	/HAVE WE READ ALL FOUR?
	JMP	PRSAV1	/NO--CONTINUE THE LOOP

	JMP I	PRSAVE	/YES--RETURN



/THIS SECTION HANDLES STATE SAVES FOR LIST PROCESSING.  IF WE ARE NOT
/SAVING A HEADER/FOOTER, WE ARE DONE AND MAY RETURN IMMEDIATELY.

PRSAV2,
	TAD	PRFLAG	/WAS THIS A HEADER/FOOTER SAVE?
	SNA
	JMP I	PRSAVE	/NO--RETURN


/NOW WE WRITE THE HEADER/FOOTER TO THE APPROPRIATE DISK BUFFER.

	JMS	GBLOCK	/INITIALIZE THE FIRST BLOCK TO WRITE
	JMS	WBLOCK	/WRITE THE HEADER/FOOTER TO THE DISK BUFFER

/THE HEADER/FOOTER IS NOW RECORDED ON DISK.  THE HEADER/FOOTER CONTROL
/BLOCK CODE, WHICH REQUESTS HEADER/FOOTER SAVES, NOW NEEDS TO MAKE A PASS
/THROUGH THE HEADER/FOOTER TO RECORD SOME INFORMATION ABOUT IT.  WE NOW
/SET THINGS UP SO THAT SUBSEQUENT READS WILL COME FROM THE BUFFER READER
/FOR THE DURATION OF THE HEADER/FOOTER PROCESSING.

	TAD	PRFLAG	/RECOVER THE ARGUMENT
	JMS	INITRD	/INITIALIZE SO THAT THE BUFFER READER CAN BE USED

	JMP I	PRSAVE	/AND RETURN




/THIS ROUTINE RESTORES THE STATE OF THE PRINTER AND FILE SYSTEM.  IT IS USED
/TO "RECOVER" SAVED HEADERS AND FOOTERS SO THAT THEY CAN BE PRINTED AND
/TO "RECOVER" OUR PLACE AFTER WE PRINT HEADERS/FOOTERS SO THAT WE CAN
/PICK UP WHERE WE LEFT OFF.

/THE ARGUMENT TO THIS ROUTINE IS ZERO IF REGULAR TEXT IS TO BE RESTORED; MINUS
/ONE IF THE FOOTER IS TO BE RESTORED; AND ONE IF THE HEADER IS TO BE RESTORED.

/AC=TYPE OF SAVE
/JMS	PRREST
/AC=0

	OBREST=OVTYPE+OVNUM						/A185
PRREST,	XX

	DCA	PRFLAG	/SAVE THE TYPE OF RESTORATION

/WE COMPUTE THE OFFSET INTO THE SAVE TABLE OF THE VALUES WHICH MUST BE
/RESTORED.

	TAD	(10)	/MULTIPLY THE ARGUMENT BY EIGHT	(10)	/M034
	JMS	PRMULT
		PRFLAG

	TAD (PRSAV+10-1)/ADD THE ADDRESS OF SAVE TABLE TO GET THE OFFSET/M034
	DCA	X0	/SAVE IN AN AUTO-INCREMENT REGISTER

/NEXT, RESTORE THE THREE PRINTER VARIABLES.

	TAD I	X0	/RESTORE THE JUSTIFICATION VALUE
	DCA	PRRM

	TAD I	X0	/RESTORE THE LINE SPACING
	DCA	PRRLSZ

	TAD I	X0	/RESTORE THE BACKUP BUFFER
	DCA	PRGCBK
	TAD I 	X0	/RESTORE THE RIGHT MARGIN			/M034
	DCA RULRRM							/M034

/THE AMOUNT OF SPACING WHICH GOES BETWEEN LINES IS THE SUM OF PRRLSZ AND
/PRQLSZ, WITH THE EXCEPTION THAT PRQLSZ DOES NOT CONTRIBUTE WHEN PRINTING
/A HEADER OR FOOTER.  THIS ROUTINE COMPUTES THE LINE SPACING GIVEN THAT
/CONSTRAINT.

	JMS	PRTRNC	/RESTORE THE VALUE OF PRLLSZ

/THE REST OF THE RESTORATION PROCESS DIFFERS DEPENDING ON WHETHER WE ARE
/DOING LIST PROCESSING.

	TAD	LPFLAG	/ARE WE DOING LIST PROCESSING?
	SZA CLA
	JMP	PRRES2	/YES--JUMP TO HANDLE IT

/IF A HEADER OR FOOTER WAS JUST PRINTED, FINDING THE END OF IT CAUSED THE
/READ ROUTINE TO SET RDCHAR SO THAT ALL SUBSEQUENT READS WOULD RETURN ZERO.
/WE MUST RESET THE READ LINK SO THAT WE MAY CONTINUE READING.

	TAD   (RDFILE)	/GET THE FILE READING LABEL
	DCA	RDCHAR	/RESET THE READ LINK


/RESTORE THE FOUR SAVED VALUES TO THE FILE SYSTEM.

	TAD  (FSSAV-1)	/GET ONE BEFORE THE BLOCK TO RESTORE

	DCA	X1	/SAVE IN AN AUTO-INCREMENT REGISTER
	TAD	(-4)	/SET THE LOOP COUNT
	DCA	T1


/THIS LOOP RESTORES THE FOUR VALUES.

PRRES1,	TAD I	X0	/GET THE SAVED VALUE
	DCA I	X1	/RESTORE THE VALUE
	ISZ	T1	/HAVE WE RESTORED ALL FOUR?
	JMP	PRRES1	/NO--CONTINUE THE LOOP


/NOW, MAKE TWO CALLS TO THE FILE SYSTEM TO COMPLETE THE RESTORE.

	JMS	RDFTAB	/INITIALIZE THE TABLE OF BLOCK POINTERS

	JMS	RDFBUF	/READ IN THE NEXT BLOCK OF TEXT
	CLA		/AN ERROR SHOULD NOT OCCUR

	JMP I	PRREST	/AND RETURN


/THIS SECTION HANDLES COMPLETING LIST PROCESSING RESTORATION.

PRRES2,

/WE SET THE READ LINK TO THE EDITOR READ.  THIS WILL BE CHANGED BELOW IF
/WE ARE RESTORING A HEADER/FOOTER.

	TAD   (RDEDIT)	/SET THE READ ROUTINE TO EDITOR READ
	DCA	RDCHAR

	TAD	PRFLAG	/ARE WE DOING A REGULAR TEXT RESTORE?
	SNA
	JMP I	PRREST	/YES--RETURN IMMEIDATELY

/WE MUST READ SUBSEQUENT CHARACTERS FROM THE DISK BUFFER.  THIS ROUTINE
/SETS THINGS UP SO THAT THE READS CAN BE DONE.

	JMS	INITRD	/INITIALIZE FOR READING FROM THE DISK BUFFER
	JMP I	PRREST	/AND RETURN



/THIS ROUTINE INTIALIZES THE APPROPRIATE VARIABLES SO THAT ALL READS WHICH
/FOLLOW WILL COME FROM THE HEADER/FOOTER BUFFER.  THE ARGUMENT IN THE AC
/IS ONE IF A HEADER SHOULD BE READ, AND TWO IF A FOOTER SHOULD BE READ.

/AC=ARGUMENT
/JMS	INITRD
/AC=0


INITRD,
	XX

/GBLOCK WILL DETERMINE THE FIRST BLOCK NUMBER OF THE APPROPRIATE BUFFER.  THE
/ARGUMENT IT EXPECTS HAPPENS TO BE THE ARGUMENT THIS ROUTINE RECEIVES.

	JMS	GBLOCK	/SET THE FIRST BLOCK OF THE DISK BUFFER
	JMS	RBLOCK	/READ THE FIRST BLOCK FROM THE DISK INTO THE
			/RESIDENT BUFFER

	TAD   (RDBUFF)	/SET THE READ ROUTINE LINK
	DCA	RDCHAR

	JMP I	INITRD	/AND RETURN



/THIS ROUTINE READS THE NEXT BLOCK FROM THE DISK BUFFER AREA INTO THE
/RESIDENT BUFFER AREA AND INITIALIZES THE VARIABLES OF THE BUFFER
/READING ROUTINE SO THAT THE BLOCK MAY BE READ CHARACTER BY CHARACTER.

/AC=0
/JMS	RBLOCK
/AC=0

RBLOCK,
	XX

/FIRST, WE INITIALIZE THE VARIABLES USED BY THE READ BUFFER ROUTINE (RDBUFF).

	TAD (STXBUF-1)	/SET THE POINTER INTO THE RESIDENT BUFFER
	DCA	RDBPTR

	TAD	(-401)	/SET THE CHARACTER COUNT OF THE RESIDENT BUFFER
	DCA	RDCCNT

/NEXT, WE READ THE DESIRED BLOCK FROM THE DISK INTO THE RESIDENT BUFFER.

	TAD	RDBUF1		/SET THE DATA FIELD OF THE BUFFER
	DCA PRQB+RXQBFD

	TAD	RDBLCK		/SET THE BLOCK TO READ
	JMS	PRQRX		/READ THE BLOCK
		RXERD+4000	/READ					/A207
		0		/SYSTEM DISK				/A207
		STXBUF		/BUFFER ADDRESS				/A207
	JMP	PRQSDE		/IF ERROR GO REPORT IT			/A207

/NOW, WE RESTORE THE INFORMATION BLOCK.
	
	TAD   (CDFMYF)	/SET THE DATA FIELD BACK
	DCA PRQB+RXQBFD

/THE NEXT BLOCK READ FROM THE DISK BUFFER IS THE ONE FOLLOWING THE ONE
/JUST READ.

	ISZ	RDBLCK	/INCREMENT THE BLOCK FOR NEXT TIME
	
	JMP I	RBLOCK	/AND RETURN


/THIS OVERLAY ENTRY IS A LINK TO THE SUBROUTINE RBLOCK.

OVRDBL=.-OVRLCA
OBRDBL=OVTYPE+OVNUM

	JMS	RBLOCK	/READ THE NEXT BLOCK
	JMP	RDBUFF	/RETURN TO THE BUFFER READ ROUTINE


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

/MADE FUNCTIONAL FOR ALL TYPES OF PRINTERS				/A212

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

	DCA	PRLLSZ	/SAVE AS THE LINE SIZE
	JMP I	PRTRNC	/AND RETURN

/ THIS ROUTINE STRIPS CHARACTERS UNTIL A NEW LINE IS FOUND.  IT MAKES
/ A NORMAL RETURN IF THE EOC WAS FOUND, A SKIP RETURN IF EOL,
/ AND REPORTS MISMATCHED CONTROLS IF EOF IS FOUND			/A184

	OBHIGS=OVTYPE+OVNUM						/A185
PRHIGS,
	XX

PRHIG1,
	JMS	PTSTST		/ SEE IF USER WANTS TO STOP		/A182
	JMS	PRGCHC		/ GET A CHARACTER			/C192
	JMP I	PRHIGS		/ END OF CONTROL			/C192

	AND	P177		/ STRIP MODE BITS
	TAD	(-12)		/ CHECK FOR A NEW LINE
	SZA CLA
	JMP	PRHIG1		/ KEEP LOOKING
	ISZ	PRHIGS		/ SKIP RETURN FOR EOL
	JMP I	PRHIGS		/ NEW LINE FOUND--RETURN

/THIS ROUTINE RECEIVES MINUS ONE AS AN ARGUMENT IF A FOOTER IS TO BE READ
/FROM DISK, AND PLUS ONE IF A HEADER IS TO BE READ.  IT SETS THE LOCATION
/RDBLCK WITH THE BEGINNING DISK BLOCK OF THE IDSK BUFFER OR THE HEADER OR
/FOOTER.

/AC=ARGUMENT
/JMS	GBLOCK
/AC=0

GBLOCK,
	XX

	SPA CLA
	TAD (DLFDTR-DLHDTR)	/THE FIRST BLOCK OF THE FOOTER DISK BUFFER
	TAD   (DLHDTR)		/THE FIRST BLOCK OF THE HEADER DISK BUFFER
	DCA	RDBLCK	/SAVE THE FIRST BLOCK OF THE APPROPRIATE DISK BUFFER
	
	JMP I	GBLOCK	/AND RETURN


/THIS SECTION BUFFERS A LIST PROCESSING HEADER/FOOTER BEGINNING WITH THE
/BLOCK NUMBER IN RDBLCK.  IT WILL WRITE UP TO FIVE BLOCKS.  IF A
/HEADER/FOOTER EXCEEDS FIVE BLOCKS, THAT PART WHICH EXCEEDS IS LOST.

/REWRITTEN TO USE RDBUF IN THIS FIELD TO SAVE SPACE AND SIMPLIFY	/C190

/AC=0
/JMS	WBLOCK
/AC=0

WBLOCK,	XX

/ WE MUST SET UP SOME VARIABLES WHICH DRIVE THE LOOP WHICH FOLLOWS.

	TAD	(-5)	/SET THE MAXIMUM NUMBER OF BLOCKS WHICH MAY BE WRITTEN
	DCA	WBBCNT

/EACH ITERATION OF THIS LOOP SEES ONE BLOCK BEING WRITTEN.  IF THE CONTROL
/BLOCK ENDS IN THE MIDDLE OF A BLOCK, THAT BLOCK IS WRITTEN BEFORE RETURN.

WBLCK1,

/400 CHARACTERS MAY BE WRITTEN INTO A BLOCK.  THIS INNER LOOP WRITES
/CHARACTERS UNTIL THE BUFFER IS FULL OR AN END OF FILE/END OF COMMAND IS
/FOUND.

	TAD	(-401)	/SET THE MAXIMUM CHARACTER COUNT PLUS ONE
	DCA	WBCCNT

	TAD  (RDBUF-1)	/GET ONE BEFORE THE BEGINNING OF THE BUFFER
	DCA	WBBPTR	/SAVE AS THE BUFFER POINTER

/THIS LOOP INSERTS CHARACTERS INTO THE RESIDENT BUFFER UNTIL IT FILLS OR
/UNTIL THE END OF THE HEADER/FOOTER IS FOUND.

WBLCK2,
	ISZ	WBCCNT	/IS THERE ROOM IN THE BUFFER?
	JMP	WBLCK3	/YES--JUMP TO INSERT THE NEXT CHARACTER

	ISZ	WBBCNT	/IS THERE A BLOCK AFTER THIS ONE?
	JMP	WBLCK7	/YES--WRITE THE BUFFER AND TRY AGAIN

			/THERE IS NO MORE ROOM IN THE DISK BUFFER
			/WRITE AN EOC IN THE LAST LOCATION OF THE BUFFER/C190
			/AND GO STRIP THE REST OF THE BLOCK

	TAD	(EPC)		/ LOAD END OF CONTROL CODE		/A190
	DCA I	WBBPTR		/ STUFF IN END OF BUFFER		/A190

/THE FINAL BLOCK MUST BE WRITTEN TO DISK, BUT FIRST WE MUST STRIP
/THE REMAINING CHRACTERS IN THE HEADER FOOTER

WBLCK5,	JMS	READCH	/READ A CHARACTER--HAVE WE FOUND THE END YET?
	SZA CLA
	JMP	WBLCK5	/NO--CONTINUE STRIPPING CHARACTERS
	TAD	T1	/SEE IF EOF					/A190
	SNA CLA		/						/C241
	JMP	WBLCK8	/YES (CAREFUL--THIS IS LIST PROCESSING)		/A190
	JMP	WBLCK6	/GO WRITE THE BLOCK, ETC			/A190

WBLCK3,
	JMS	READCH	/GET THE NEXT CHARACTER TO WRITE IN THE BUFFER.
	ISZ	WBBPTR	/WRITE IN THE NEXT BUFFER LOCATION

/WE NOW HAVE A CHARACTER TO WRITE IN THE BUFFER--BE IT A NEW CHARACTER (IN
/WHICH CASE IT IS WRITTEN IN A NEW BUFFER LOCATION) OR AN END OF CONTROL
/GENERATED BECAUSE THE DISK BUFFER WAS FULL (IN WHICH CASE IT IS OVERWRITTEN
/IN THE LAST BUFFER LOCATION).

	SNA		/IF THE CHR RETURNED IS ZERO			/A190
	TAD	T1	/THEN WRITE T1 (EOC OR EOF)			/A190
	DCA I	WBBPTR	/WRITE THE CHARACTER IN THE RESIDENT BUFFER
	TAD I	WBBPTR	/RECOVER THE CHARACTER JUST WRITTEN
	SZA		/SEE IF END OF FILE				/A190
	TAD	(-EPC)	/OR END OF CONTROL				/A190

/THE AC NOW CONTAINS ZERO IF BUFFERING IS COMPLETE, AND NON-ZERO OTHERWISE.
/CONTINUE THE LOOP UNLESS BUFFERING IS COMPLETE.

	SZA CLA
	JMP	WBLCK2	/BUFFERING INCOMPLETE--CONTINUE THE LOOP


WBLCK6,	TAD	RDBLCK		/LOAD THE BLOCK NUMBER			/A207
	JMS	PRQRX		/WRITE THE BLOCK ONTO DISK
		RXEWT+4000	/WRITE					/A207
		0		/SYSTEM DRIVE				/A207
		RDBUF		/BUFFER ADDRESS				/A207
	JMP	PRQSDE		/IF ERROR GO REPORT IT			/A207

	
	JMP I	WBLOCK	/AND RETURN


/THE BUFFER IS FULL AND MUST BE WRITTEN TO DISK.

WBLCK7,
	TAD	RDBLCK		/LOAD THE BLOCK NUMBER			/A241
	JMS	PRQRX		/WRITE THE BLOCK
		RXEWT+4000	/WRITE					/A207
		0		/SYSTEM DRIVE				/A207
		RDBUF		/BUFFER ADDRESS				/A207
	JMP	PRQSDE		/IF ERROR GO REPORT IT			/A207
	ISZ	RDBLCK		/BUMP BLOCK NUMBER			/C207
	JMP	WBLCK1		/CONTINUE THE LOOP

WBLCK8,			/MISSING CONTROL IN LP HEADER/FOOTER		/A201
	JMP	MISCTL		/GO REPORT MISSING CONTROL		/A201

WBBPTR,	0	/A POINTER INTO THE RESIDENT BUFFER BEING WRITTEN
WBCCNT,	0	/A COUNT OF ROOM REMAINING IN THE RESIDENT BUFFER
WBBCNT,	0	/A COUNT OF BLOCKS REMAINING TO BE WRITTEN
/-------------------
PAGE

OVTYPE=OLA
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM



/***********************************************************************/
/									/
/ THIS ENTIRE PAGE ADDED REV203						/
/									/
/ IF A JOB NEEDS THE PRINTER FIELD, IT WILL SET PRACTN=7777		
/ THE PRINTER MUST JEXIT IN RESIDENT CODE. IN THAT CASE			
/ THE OTHER JOB CLOBBERS THE PRINTER FIELD, AND WHEN DONE		
/ RELOADS THE PRINTER FIELD BY READING ONLY THE RESIDENT BLOCKS		
/ BACK IN FROM THE DISK.  WHEN THE OTHER JOB DOES THE JSTRT		
/ WE WILL START IN RESIDENT CODE AND EVERYTHING WILL BE COOL		

/ HOWEVER, SOME CRITICAL VALUES MUST BE SAVED SO THAT THEY		
/ CAN BE RESTORED LATER.  WHEN THE PRINTER IS STARTED AGAIN		
/ THE LOCATIONS 10020-10077 MUST BE RESTORED, AND SOME LOCATIONS	
/ MUST BE INITIALIZED							



/ THIS SECTION SAVES THE CRITICAL VALUES BEFORE DISPATCHING TO THE	
/ RESIDENT CODE TO GO TO SLEEP						
	OVPRJX=.-OVRLCA							
	OBPRJX=OVTYPE+OVNUM						

	DCA	PRACTN		/ SIGNAL OTHER JOB WE HAVE SEEN FLAG	
	TAD	(PRFVBF-1	/ SET UP INDEX POINTER TO SAVE BUFFER	
	DCA	X0		/ IN SYS				
	TAD	(PRSVTB-1	/ SET UP INDEX POINTER TO LIST OF	
	DCA	X1		/ ADDRESSES TO BE SAVED			
WAITJ2,	CDFMYF			/ CHANGE TO THIS FIELD			
	TAD I	X1		/ GET AN ADDRESS			
	SNA			/					
	JMP	WAITJX		/ IF ZERO SAVING IS DONE		
	DCA	T1		/ SAVE IN TEMP				
	TAD I	T1		/ GET VALUE AT THAT ADDRESS		
	CDFSYS			/ AND SAVE IN SYSTEM FIELD		
	DCA I	X0		/ IN PRFVBF BUFFER			
	JMP	WAITJ2		/ BACK TO LOOP POINT			

PRSVTB,				/ TABLE OF POINTERS TO LOCATIONS	
				/ TO SAVE WHEN BEFORE JEXIT		
	PRQPNT			/ DOCUMENT DESTINATION			
	PRQPSZ			/ PAGE SIZE OF LAST DOC PRINTED		
	PRTID			/ PRINTER ID LOCATION			
				/ OTHER JOB MUST CLEAR PRSTTS		
				/ BEFORE STARTING UP PRINTER		
	0			/ STOPPER				


	OVWKUP=.-OVRLCA		/ ENTRY POINT TO WAKE UP PRINTER
	OBWKUP=OVTYPE+OVNUM

/ RESET PRIRFD SO WE ARE SURE TO READ FROM THE FILE INTERFACE!		/A263
	DCA	PRIRFD		/ WAS BUG WPSV2-380			/A263

	DCA	PRSTTS		/ INIALIZE SOME VALUES DIRECTLY
				/ PABORT, PRSTOP, PRACTN, PRACTV ARE CLEARED
				/ AT OVWAIT
	DCA	LPONLN		/ TELL WORLD WE HAVE NO PRINTER

/ MAKE SURE WE LOAD ALL OVERLAYS AFRESH			
	AC4000			/LOAD A CODE TO MAKE SURE	
	DCA	OLA+PROVA	/WE LOAD THIS OVERLAY AFRESH	
	AC4000			/LOAD A CODE TO MAKE SURE	
	DCA	OLB+PROVA	/WE LOAD THIS OVERLAY AFRESH	
	AC4000			/LOAD A CODE TO MAKE SURE	
	DCA	OLC+PROVA	/WE LOAD THIS OVERLAY AFRESH	


/ NOW RESTORE THE CRITICAL VALUES SAVED IN THE SPECIAL BUFFER IN WPSYS

	TAD	(PRFVBF-1
	DCA	X0
	TAD	(PRSVTB-1
	DCA	X1
WAKEU2,	TAD I	X1		/ READ AN ADDRESS
	SNA
	JMP	WAKEU3		/ DONE IF ZERO
	DCA	T1
	CDFSYS
	TAD I	X0		/ READ SYS BUFFER
	CDFMYF
	DCA I	T1		/ SAVE IN CORRECT PRINTER LOCATION
	JMP	WAKEU2		/ LOOP BACK

WAKEU3,				/ DONE, GO BACK TO WAIT OVERLAY

	TAD	(OVWAIT
	JMS	PROV
		OBWAIT

/OVDDCK MUST RESIDE IN AN OVERLAY TYPE DIFFERENT THAN THE WAIT OVERLAY.	/A231
/THIS IS BECAUSE IT MAY BE CALLED BY LIST PROCESSING WHILE THE PRINT JOB
/IS IDLE (MENU GUARANTEES THIS).  BUT THE WAIT OVERLAY HAD BETTER STAY
/IN PLACE OR ALL KINDS OF HAVOC COULD (AND ONCE UPON A TIME DID) RESULT.


OVDDCK=.-OVRLCA			/PART OF PRTRID ROUTINE			/A166
OBDDCK=OVTYPE+OVNUM		/TO CHECK DOCUMENT DESTINATION		/A166
				/IF NOT GOING TO HOST			/A166
	TAD	PRQPNT		/					/A166
	TAD	(-DDP2)		/ IS IT A DRAFT PRINTER?		/A166
	SNA			/					/A166
	JMP	CHKDP		/ YES, SEE IF DRAFT PRINTER IS ONLINE	/A166
	TAD	(DDP2-DSQ1	/ SEE IF IT IS A SERIAL LQP		/A166
	SNA CLA
	JMP	CHKLQP		/ YES SEE IF LQP IS ONLINE
				/ FALL THROUGH TO ERROR ON UNRECOGNIZED	/A166
				/ DOCUMENT DESTINATION			/A166

DDERR,	ISZ	PRTRID		/ ERROR--BUMP RETURN POINT		/A166
	JMP	IDRTN		/ GO RETURN				/A166

CHKDP,	TAD	LPONLN		/					/A143
	AND	(DPMSK)		/					/A143
	SNA CLA			/ SKIP IF NOT DP ONLINE			/A143
	JMP	DDERR		/ NOT A DRAFT PRINTER, COMPLAIN		/A166
	JMS	SKIPIF		/ SKIP IF LA100 OR LA50			/C216
		DPMSK+XRPMSK	/					/A216
	JMP	IDRTN		/ NON LA100 DRAFT PRINTER IS ONLINE, EXIT


/ AT THIS POINT WE HAVE A SELECTABLE QUALITY DRAFT PRINTER ONLINE	/A166
/	 WE SELECT ITS DRAFT QUALITY MODE.				/A166
	
	JMS	PRESCS		/ SELECT DRAFT QUALITY MODE		/C216
		PCSQM		/					/A216
	JMP	IDRTN		/ LA50/100 ONLINE, EXIT			/A166

CHKLQP,	JMS	SKIPIF		/ SKIP IF LA100 OR LA50			/C216
		DPMSK+XRPMSK	/					/A216
	JMP	CHKLQ1		/ NO, SEE IF LQP			/A166

/ AT THIS POINT WE HAVE A SELECTABLE QUALITY DRAFT PRINTER ONLINE	/A166
/ WE SELECT ITS HIGHEST QUALITY MODE					/A166

	AC0002			/ ENABLE LETTER QUALITY MODE		/A166
	JMS	PRESCS		/ ENABLE LETTER QUALITY MODE		/C216
		PCSQM		/					/A166
	CLA			/ THIS WAS MISSING CAUSING PROBLEMS	/A231
	JMP	IDRTN		/ LA50/LA100 ONLINE, EXIT		/A166

CHKLQ1,		/ NON DRAFT TYPE LQP ATTACHED				/A166
	TAD	LPONLN		/ GET TYPE OF PRINTER			/A143
	SMA CLA			/ SKIP IF NOT LQP			/A143
	JMP	DDERR		/ NOT LQP, COMPLAIN			/A166
	JMP	IDRTN		/ 					/A166



XSTQM,	52; 42; 4172		/ ESC [ * " z	/ SET QUALITY MODE
/-----------------------
	PAGE

OVTYPE=OLB
OVNUM=OVNUM+1
OVADR=OVADR+400
OVRLCA=PROVA+OVTYPE
DL=DLOPRO+OVNUM		/DISK BLOCK OF THIS OVERLAY
FIELD OVNUM%20+3

RELOC
*OVADR
RELOC OVRLCA

	-OVNUM



IFDEF ENGLSH <						/A020
IFNDEF ENGCAN <						/A020
PRHPRT="P-200		/ PRINTER
PRHHDR="T-200		/ TOP
PRHHD2="T-200		/ HEADER
PRHFOT="B-200		/ BOTTOM
PRHRES="R-200		/ RESET
PRHMTC="M-200		/ MULTI
PRHSEC="S-200		/ SECTION
>	/END NDEF ENGCAN				/A020
IFDEF ENGCAN <						/A020
PRHHDR="T-200						/A020
PRHHD2="H-200						/A020
PRHFOT="B-200						/A020
PRHRES="R-200						/A020
PRHMTC="M-200						/A020
PRHSEC="S-200						/A020
>	/END ENGCAN					/A020
>	/END ENGLSH					/A020
IFDEF ITALIAN <						/A020
PRHPRT="S-200		/ PRINTER
PRHHDR="I-200						/A020
PRHHD2="I-200						/A020
PRHFOT="F-200						/A020
PRHRES="R-200						/A020
PRHMTC="M-200						/A020
PRHSEC="S-200						/A020
>	/END ITALIAN					/A020
IFDEF FRENCH <						/A020
PRHHDR="T-200						/A020
PRHHD2="H-200						/A020
PRHFOT="B-200						/A020
PRHRES="R-200						/A020
PRHMTC="M-200						/A020
PRHSEC="S-200						/A020
>	/END FRENCH					/A020
IFDEF DUTCH <						/A020
PRHPRT="P-200						/A020
PRHHDR="B-200						/A020
PRHHD2="B-200						/A020
PRHFOT="O-200						/A020
PRHRES="T-200						/A020
PRHMTC="M-200						/A020
PRHSEC="S-200						/A020
>	/END DUTCH					/A020

IFDEF V30NOR <						/A020
PRHPRT="S-200		/ PRINTER
PRHHDR="T-200		/ TOP
PRHHD2="T-200		/ HEADER
PRHFOT="B-200		/ BOTTOM
PRHRES="N-200		/ RESET
PRHMTC="M-200		/ MULTI
PRHSEC="A-200		/ SECTION
>

IFDEF V30SWE <						/A020
PRHPRT="S-200		/ PRINTER
PRHHDR="V-200		/ TOP
PRHHD2="V-200		/ HEADER
PRHFOT="N-200		/ BOTTOM
PRHRES="E-200		/ RESET
PRHMTC="M-200		/ MULTI
PRHSEC="S-200		/ SECTION
>

IFDEF SPANISH <						/A020
PRHPRT="P-200		/ PRINTER
PRHHDR="I-200		/ TOP
PRHHD2="I-200		/ HEADER
PRHFOT="F-200		/ BOTTOM
PRHRES="R-200		/ RESET
PRHMTC="M-200		/ MULTI
PRHSEC="S-200		/ SECTION
>



OVCNTL=.-OVRLCA
OBCNTL=OVTYPE+OVNUM

/THIS SECTION HANDLES PRINT CONTROL BLOCKS.  IT DETERMINES WHETHER THE
/CONTROL BLOCK IS FOR RESET, MULTI-COLUMN, HEADERS, FOOTERS, SECTION,
/OR PRINTER, AND DISPATCHES ACCORDINGLY

/THIS LOOP FINDS THE FIRST NON-BLANK, NON-CONTROL CHARACTER IN THE BLOCK.
/THIS IDENTIFIES THE TYPE OF BLOCK.


PRHIST,
	JMS	PRGCHC	/GET A CHARACTER
	JMP	PRSTR1	/END OF CONTROL BLOCK				/C225

	AND	P177	/STRIP THE MODE BITS
	TAD	(-40)	/IS IT A TEXT CHARACTER?
	SPA SNA
	JMP	PRHIST	/NO--KEEP LOOKING

/THE FIRST CHARACTER OF THE COMMAND BLOCK HAS BEEN FOUND AND IS IN THE AC.
/CONVERT IT TO LOWER CASE IF NECESSARY.


	TAD   (40-140)	/CONVERT TO LOWER CASE
	SMA
	TAD	(-40)

/NOW DETERMINE WHAT KIND OF COMMAND IT IS.

	TAD (140-PRHMTC)	/MULTI-COLUMN?
	SNA
	JMP	PRMLTC		/YES

	TAD (PRHMTC-PRHHDR)	/HEADER?
	SNA
	JMP	PRHEAD		/YES

	TAD (PRHHDR-PRHHD2)	/SECOND HEADER?			/A020
	SNA							/A020
	JMP	PRHEAD		/YES

	TAD (PRHHD2-PRHFOT)	/FOOTER?			/M020
	SNA
	JMP	PRFOOT		/YES

	TAD (PRHFOT-PRHRES)	/RESET?
	SNA
	JMP	PRRSET		/YES

	TAD (PRHRES-PRHSEC)	/SECTION?
	SNA
	JMP	PRSECT		/YES

	TAD	(PRHSEC-PRHPRT)	/PRINTER?
	SNA
	JMP	PRPRNT		/YES

/THE COMMAND BLOCK IS INVALID.  STRIP THE REST OF THE BLOCK AND RETURN.

	CLA
	JMP	PRSTRP	/RETURN


/ HERE WE JUMP TO THE OVERLAY TO HANDLE PRINTER CONTROL STATEMENTS	/A168

PRPRNT,	TAD	(OVPRNT)
	JMS	PROV
		OBPRNT

/THS SECTION HANDLES A MULTI-COLUMN CONTROL BLOCK.  IF WE ARE NOT PRINTING TO
/AN LQP, WE CANNOT HAVE MULTI-COLUMNS.

PRMLTC,
	TAD	LPONLN	/SEE WHAT KIND OF PRINTER WE HAVE		/A143
	AND	(MCMSK)							/A143
	SZA CLA		/SKIP IF NOT LQP			/C143	/C148
	JMP	PRMCL0	/AN LQP--PROCESS THE BLOCK

	JMP	PRSTRP	/STRIP THE REST OF THE BLOCK AND RETURN

/NOW, WE ZERO OUT THE MULTI-COLUMN INFORMATION ARRAY.  THIS ARRAY CONTAINS
/THE NUMBER OF COLUMNS, FOLLOWED BY THE WIDTH OF SUCCESSIVE COLUMNS.

PRMCL0,
	TAD (-PRMCAC-1)	/GET THE NUMBER OF ENTRIES IN THE TABLE
	DCA	T1
	TAD (PRMCAY-1)	/GET ONE BEFORE THE BEGINNING OF THE TABLE
	DCA	X0

/THIS LOOP INITIALIZES THE NUMBER OF COLUMNS TO ONE, AND CLEARS THE COLUMN
/WIDTH ENTRIES.

	AC0001		/PUT A ONE IN THE FIRST LOCATION

PRMCL1,
	DCA I	X0	/DEPOSIT THE VALUE
	ISZ	T1	/ANY MORE TABLE POSITIONS?
	JMP	PRMCL1	/CONTINUE THE LOOP


/NOW, WE READ THE MULTI-COLUMN PRINTER CONTROL BLOCK, USING THE VALUES
/TO INITIALIZE THE ARRAY.  PRMCGN RETURNS THE SUCCESSIVE NUMBER FROM
/THE BLOCK.  WHEN THE END PRINT CONTROL IS ENCOUNTERED, PRMCGN
/MAKES A NORMAL RETURN; OTHERWISE, IT MAKES A SKIP RETURN.

/FIRST, WE READ AND RECORD THE NUMBER OF COLUMNS, AND TEST TO SEE IF
/THAT NUMBER EXCEEDS THE PERMISSIBLE MAXIMUM.

	JMS	PRMCGN	/GET THE FIRST NUMBER
	JMP	PRMCL4	/EOC ENCOUNTERED--NOTHING MORE TO READ

/IF THE NUMBER OF COLUMNS IS SPECIFIED TO BE ZERO OR LESS, USE ONE INSTEAD.

	SPA SNA
	AC0001
	DCA	PRMCAY	/SAVE THE NUMBER OF COLUMNS

/NOW, IF THE SPECIFIED NUMBER OF COLUMNS EXCEEDS THE MAXIMUM, THE NUMBER IS
/REDUCED TO THE MAXIMUM.

	TAD	PRMCAY	/GET THE NUMBER OF COLUMNS
	TAD  (-PRMCAC)	/SUBTRACT THE MAXIMUM NUMBER OF ENTRIES
	SPA CLA
	JMP	PRMCL2	/THE NUMBER OF COLUMNS IS IN RANGE

/THE CONTROL BLOCK SPECIFIED MORE COLUMNS THAN CAN BE TREATED WITH THE
/ARRAY--CHANGE THE NUMBER OF COLUMNS TO THE MAXIMUM.

	TAD   (PRMCAC)	/GET MAXIMUM NUMBER OF ENTRIES
	DCA	PRMCAY	/SAVE AS THE NUMBER OF COLUMNS

/WE NOW HAVE A WORKABLE NUMBER OF COLUMNS.  THIS LOOP READS NUMBERS FROM THE
/CONTROL BLOCK UNTIL EITHER THE TABLE IS FILLED OR THE BLOCK IS EXHAUSTED.

PRMCL2,
	TAD  (-PRMCAC)	/GET MAXIMUM NUMBER OF ENTRIES
	DCA	T3	/SAVE IN A COUNTER

	TAD   (PRMCAY)	/GET STARTING ADDRESS OF ARRAY
	DCA	X0	/SAVE IN INDEX LOCATION

/READ THE COLUMN WIDTH INFORMATION INTO THE ARRAY.

PRMCL3,
	JMS	PRMCGN	/GET ANOTHER NUMBER
	JMP	PRMCL4	/END OF COMMAND BLOCK--NO MORE TO READ
	DCA I	X0	/STORE IN THE ARRAY
	ISZ	T3	/IS THERE ROOM FOR MORE?
	JMP	PRMCL3	/YES--CONTINUE THE LOOP

/WE HAVE READ THE CONTROL BLOCK AND RE-INITIALIZED THE ARRAY.  WE NOW MUST
/PERFORM NECESSARY FORMATTING TO MAKE ROOM FOR THE COLUMNS.

/IF WE ARE NOT CURRENTLY PRINTING ON ANY COLUMN, WE MERELY RETURN.  OTHERWISE,
/WE SET THE NEW COLUMN REQUEST FLAG BEFORE RETURNING SO THAT THE SPACING
/ROUTINE CAN SET THEM UP.

PRMCL4,
	TAD	PRMCPC	/GET THE CURRENT COLUMN NUMBER
	SZA CLA
	AC7777		/SET THE REQUEST FLAG
	DCA	PRMCRF	/THE FLAG IS SET OR CLEARED DEPENDING ON WHETHER
			/WE ARE CURRENTLY PRINTING A COLUMN OR NOT

	JMP	PRSTRP	/GO STRIP, RESTORE READCH, ETC.		/D188	/A192

/THIS SECTION READS THE NEXT NUMBER WHICH IT CAN FIND IN THE PRINT CONTROL
/BLOCK.  A NUMBER IS A STRING OF DIGITS TERMINATED BY A NON-DIGIT.

PRMCGN,
	XX

/WE INITIALIZE THE VARIABLES.  PRMCFF WILL REMAIN NEGATIVE UNTIL A DIGIT
/IS LOCATED.

	AC7777
	DCA	PRMCFF	/SET THE FOUND SOMETHING FLAG TO FOUND NOTHING
	DCA	PRMCGT	/CLEAR THE NUMBER TEMPORARY

/THIS LOOP READS CHARACTERS FROM THE CONTROL BLOCK AND TESTS THEM AS TO
/WHETHER THEY ARE DIGITS.

PRMCG1,
	JMS	PRGCHC	/GET THE NEXT CHARACTER				/C192
	JMP I	PRMCGN	/END OF CONTROL--RETURN
	AND	P177	/STRIP THE MODE BITS

/THE ASCII REPRESENTATION OF A DIGIT MUST LIE BETWEEN 60 AND 71, INCLUSIVE.
/THIS SECTION CHECKS FOR A VALID DIGIT.

	JMS	DIGCHK	/SEE IF A DIGIT					/A145
	JMP	PRMCG2	/NO--JUMP TO HANDLE IT				/A145

/THE AC NOW CONTAINS THE OCTAL VALUE CORRESPONDING TO THE DECIMAL DIGIT JUST
/FOUND.  WE ADD THIS TO THE NUMBER ALREADY PARTIALLY READ AND CONTINUE.

	DCA	PRMCFF	/SAVE THE DIGIT

	TAD	PRMCGT
	JMS	PRMULT	/MULTIPLY THE PARTIALLY READ NUMBER BY 10
		(12)

	TAD	PRMCFF	/ADD IN THE NEW DIGIT
	DCA	PRMCGT	/SAVE AS THE PARTIALLY READ NUMBER
	JMP	PRMCG1	/LOOK FOR THE NEXT DIGIT


/THIS SECTION IS INVOKED WHEN A NON-DIGIT CHARACTER IS READ.  IF WE ARE AT
/THE END OF THE CONTROL BLOCK, THE ZERO IS RETURNED.  OTHERWISE,
/THE VALUE IN PRMCFF IS TESTED.  IF IT IS STILL NEGATIVE, NO DIGITS HAVE BEEN
/FOUND YET, AND WE KEEP LOOKING.  IF IT IS NOW NON-NEGATIVE, WE HAVE FOUND
/A NUMBER AND THIS CHARACTER TERMINATES IT.  RETURN THE NUMBER.

/THIS SECTION IS INVOKED WHEN A NON-DIGIT CHARACTER IS READ.  THE VALUE OF
/PRMCFF IS TESTED.  IF IT IS STILL NEGATIVE, NO DIGITS HAVE BEEN FOUND
/YET, AND WE KEEP LOOKING.  IF IT IS NOW NON-NEGATIVE, WE HAVE FOUND A
/NUMBER AND THIS CHARACTER TERMINATES IT.  RETURN THE NUMBER.

PRMCG2,
	CLA

	TAD	PRMCFF	/SEE IF A NUMBER WAS FOUND
	SPA CLA
	JMP	PRMCG1	/NO--KEEP LOOKING

	TAD	PRMCGT	/YES--RETURN THE NUMBER
	ISZ	PRMCGN
	JMP I	PRMCGN

PRMCGT,	0	/THE DIGITS ARE COMBINED INTO A NUMBER HERE
PRMCFF,	0	/THIS FLAG IS NEGATIVE UNTIL A DIGIT IS FOUND, IS POSITIVE
		/THERAFTER.  ALSO SERVES AS A TEMPORARY.


PAGE

/THIS SECTION HANDLES A RESET (PAGE NUMBER) BLOCK.  IT DETERMINES
/IF TWO SUCESSIVE EVEN OR ODD PAGES IN A ROW ARE CAUSED BY THE RESET
/COMMAND.  IF SO, AND WE ARE PRINTING EO, WE WILL OUTPUT A PAGE INSERT
/COMMAND AT OVTOPP.

PRRSET,
	TAD	PRQPGO		/GET THE IP PAGE SETTING
	DCA	PNRSVL		/SAVE AS PAGE NUMBER RESET VALUE	/A260
	JMS	PRMCGN		/IS THERE A NUMBER SPECIFIED?
	SZA
	DCA	PNRSVL		/YES, SAVE THIS VALUE INSTEAD
	TAD	PNRSVL		/NOW EXCLUSIVE OR THE LEAST SIGNFICANT BIT
	TAD	PRPGNM		/SIMPLY BY ADDING THE TWO VALUES
	RAR			/SAVE IN LINK				/A260
	CLA			/CLEAR AC				/A260
	TAD	PNRSVL		/ACTUALLY RESET THE PAGE NUMBER		/A260
	DCA	PRPGNM		/					/A260
	RAL			/GET THE LINK				/A260
	DCA	PNRSVL		/SAVE IN THE PAGE NUMBER RESET LOCATION	/A260
	JMP	PRSTRP		/STRIP THE REST OF THE BLOCK AND RETURN


/THIS SECTION HANDLES A SECTION BLOCK.  IT INCREMENTS THE SECTION NUMBER,
/UNLESS ONE IS SPECIFIED IN THE BLOCK.

PRSECT,
	ISZ	PRSCNM	/INCREMENT THE SECTION NUMBER
	JMS	PRMCGN	/IS THERE A NUMBER SPECIFIED?
	SZA
	DCA	PRSCNM	/YES--SET THE SECTION NUMBER TO THE VALUE
	JMP	PRSTRP	/STRIP THE REST OF THE BLOCK AND RETURN


/THIS SECTION STRIPS THE REST OF THE CHARACTERS FROM THE CONTROL BLOCK, RESETS
/THE READ LINK, AND RETURNS TO THE GET CHARACTER ROUTINE.

OVSTRP=.-OVRLCA
OBSTRP=OVTYPE+OVNUM

PRSTRP,
	TAD	T1		/ ARE WE ALREADY AT EOC?		/A192
	TAD	(-EPC		/					/A192
	SNA CLA			/					/A192
	JMP	PRSTR1		/ YES					/A192
PRSTR2,	JMS	PTSTST		/ SEE IF USER WANTS TO STOP		/A182
	JMS	PRGCHC		/GET A CHARACTER			/C192
	JMP	PRSTR1		/END OF CONTROL FOUND			/C192
	CLA								/A192
	JMP	PRSTR2		/KEEP STRIPPING				/A192

/WE ARE AT THE END OF THE PRINT CONTROL					/C188
/RESET THE READ LINK
/IT WAS CHANGED WHEN THE END OF THE PRINT CONTROL WAS FOUND		/C188
/IT ALSO MAY BE NON ZERO IF PROCESSING LIST PROCESSING HEADERS/FOOTERS	/A188

	OVEXPC=.-OVRLCA							/A173
	OBEXPC=OVTYPE+OVNUM						/A173
PRSTR1,

	TAD	LPFLAG		/ARE WE LIST PROCESSING?
	SNA CLA
	TAD	(RDFILE-RDEDIT)
	TAD	(RDEDIT)
	DCA	RDCHAR		/APPROPRIATELY RESET READ ROUTINE PTR

	JMP	PRGCH1		/GO GET NEXT CHR AS A TEXT CHR


/THIS SECTION HANDLES HEADER BLOCKS.

PRHEAD,
	AC0001		/PREPARE TO DO A HEADER MEASUREMENT
	JMS	SIZE	/GET THE SIZE OF THE HEADER
	DCA	PRHSIZ	/SAVE IT
	JMP	PRSTR1	/STRIP THE REST OF THE BLOCK AND RETURN		/C185

/THIS SECTION HANDLES FOOTER BLOCKS.

PRFOOT,
	AC7777		/PREPARE TO DO A FOOTER MEASUREMENT
	JMS	SIZE	/GET THE SIZE OF THE FOOTER
	DCA	PRFSIZ	/SAVE IT
	JMP	PRSTR1	/STRIP THE REST OF THE BLOCK AND RETURN		/C185


/THIS ROUTINE RETURNS THE SIZE OF THE HEADER/FOOTER BLOCK, HAVING SAVED
/ITS LOCATION AND STRIPPED IT FROM THE FILE.

SIZE,
	XX

	DCA	SIZET1	/SAVE THE TYPE OF SAVE THIS IS

	JMS	PROV	/LOAD THE SAVE/RESTORE OVERLAY
		OBHIGS	/BUT DO NOT GO THERE				/C185

	JMS	PRHIGS	/STRIP THE REST OF THE LINE
	NOP		/WON'T FIND EOC

	TAD	SIZET1	/RECOVER THE ARGUMENT
	JMS	PRSAVE	/SAVE THE CRUCIAL INFORMATION ABOUT THE HEADER/FOOTER


/WE NOW READ THE LINES OF THE BLOCK.  EACH TIME A NEW LINE IS FOUND, THE
/SIZE OF THE BLOCK IS UPDATED.  IF END OF CONTROL IS SEEN WE RETURN TO	/C185
/THE NO-- LINE.  IF END OF FILE IS SEEN WE WILL NOT RETURN HERE BUT	/A185
/REPORT MISSING CONTROL FROM PRHIGS					/A185


	DCA	SIZET1	/CLEAR THE SIZE TEMPORARY

SIZE1,
	JMS	PRHIGS	/IS THERE ANOTHER LINE?
	JMP	SIZE2	/NO--PREPARE TO RETURN
	TAD	PRLLSZ	/YES--GET LINE SIZE
	TAD	SIZET1	/ADD TO THE BLOCK SIZE
	DCA	SIZET1	/SAVE AS THE NEW BLOCK SIZE
	JMP	SIZE1	/CONTINUE WITH THE LOOP

/WE PREPARE TO RETURN.

SIZE2,
	DCA	PRFLAG	/SHOW REGULAR TEXT IS PRINTING
	JMS	PRTRNC	/GET THE PROPER SPACING FOR REGULAR TEXT
	TAD	SIZET1	/RECOVER THE BLOCK SIZE
	JMP I	SIZE	/AND RETURN


SIZET1,	0	/A TEMPORARY FOR THE SIZE ROUTINE



/-------------------
PAGE

