/ LQP HANDLER FOR OS/8
/
/
/ THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE
/ AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
/ CORPORATION.  DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY
/ FOR ANY ERRORS THAT MAY APPEAR IN THIS DOCUMENT.
/
/ THE SOFTWARE DESCRIBED HEREIN IS FURNISHED TO THE PURCHASER
/ UNDER A LICENSE FOR USE ON A SINGLE COMPUTER SYSTEM AND CAN BE COPIED
/ (WITH INCLUSION OF DIGITAL'S COPYRIGHT NOTICE) ONLY FOR USE IN SUCH
/ SYSTEM, EXCEPT AS MAY OTHERWISE BE PROVIDED IN WRITING BY DIGITAL.
/ 
/ DIGITAL EQUIPMENT ASSUMES NO RESPONSIBILITY FOR THE USE
/ OR RELIABILITY OF ITS SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED
/ BY DIGITAL.
/
/ COPYRIGHT (C) 1977 BY DIGITAL EQUIPMENT CORPORATION
/

PDMP=6502
PDMC=6503
PDPC=6504
PDRS=6505
PDWS=6506
PDRE=6507
 
LPVERSION="A&77	/VERSION A (MH)

*0		/ORIGIN FOR BUILD INFO

-1		/ONE ENTRY POINT
DEVICE LQP	/GROUP NAME
DEVICE LPT	/DEVICE NAME
1040		/DEVICE TYPE
LQP&177+4000	/ENTRY POINT + TWO-PAGE FLAG
0		/REQUIRED ZEROES
0

PAGE

LQPORG=.
LQPCSV,	0
LQPBUF,	0
LQPDWC,	0
LQPDCY,	0

LQP,	LPVERSION	/ENTRY POINT (MH)
	CLA STL RTL			/RAISE RIBBON
	PDWS

	PDRE			/INIT PRINTER
	DCA .-1			/---FIRST TIME ONLY---

	JMS LQPDCZ		/INIT SECOND PAGE LINK

	RDF	/GET RETURN CIF
	TAD (CIF CDF)
	DCA LQPRDF

	TAD I LQP	/GET FUNCTION WORD
	AND (70)
	TAD (CDF)
	DCA LQPBDF	/SET BUFFER CDF

	TAD I LQP
	AND (3700)
	CMA
	DCA LQPDWC	/SET DOUBLE-WORD COUNT +1

	ISZ LQP
	TAD I LQP
	DCA LQPBUF	/SET BUFFER PTR

	ISZ LQP
	TAD I LQP
LQPBDF,	0		/CDF TO BUFFER
	SZA CLA
	JMP LQPGO
	TAD (15);JMS LQPDOC	/NEW PAGE ON BLOCK 0
	TAD (14);JMS LQPDOC
LQPGO,	ISZ LQPDWC
	JMP LQPGO1		/LOOP IF MORE TO DO
LQPCZ,
	TAD (13);JMS LQPDOC	/CLEAR SPACE ACCUMULATORS
LQPRDF,	0			/THEN RETURN TO CALLER
	ISZ LQP
	ISZ LQP
	JMP I LQP

LQPGO1,
	TAD I LQPBUF	/GET NEXT WORD
	AND (7400)
	CLL RTR
	DCA LQPCSV	/SAVE PART OF THIRD CHAR

	TAD I LQPBUF
	JMS LQPDOC	/OUTPUT FIRST CHAR

	ISZ LQPBUF
	TAD I LQPBUF
	JMS LQPDOC	/OUTPUT SECOND CHAR

	TAD I LQPBUF
	AND (7400)	/PUT THIRD CHAR TOGETHER
	BSW
	TAD LQPCSV
	CLL RTR
	JMS LQPDOC	/OUTPUT THIRD CHAR

	ISZ LQPBUF
	JMP LQPGO	/LOOP FOR DONE TEST

LQPDCZ,	0
	TAD LQPDCZ
	AND (7600)
	TAD (LQPDCX-LQPORG)
	DCA LQPDCY
	JMP I LQPDCZ

LQPDOC,	0
	JMS I LQPDCY
	JMP LQPCZ

	KRS			/CHECK FOR CONTROL C AT CONSOLE
	AND (177)
	TAD (-3)
	SZA CLA			/SKIP IF SO
	JMP I LQPDOC

	CIF CDF 0		/RETURN TO OS8
	JMP I (7600)

PAGE
LQPTCH,	24	/2*NUMBER OF INCRS PER CHAR
LQLINE,	20	/2*NUMBER OF INCRS PER LINE
LQPAGE,	-102	/-NUMBER OF LINES PER PAGE

LQPDCX,	0		/OUTPUT ONE CHAR
	AND (177)
	TAD (-40)		/TEST FOR SPECIAL OR BLANK
	SPA
	JMP LQPSPC		/JUMP IF SPECIAL
	SNA
	JMP LQPIDX		/JUMP IF BLANK

	TAD (40)
LQPDC1,	DCA LQPCTM		/SAVE CHAR CODE

LQPWLP,	PDRS			/LOOP TIL DEVICE READY
	BSW
	SMA CLA
	JMP .+5			/JUMP IF NO CHECK FLAG
	PDRE			/ELSE RESET DEVICE
	DCA LQPX		/AND HORIZONTAL POSITIONS
	DCA LQPDX
	ISZ LQPDY		/ADVANCE A LINE, FOR CLARITY

	PDRS
	STL
	TAD (400)
	SZL CLA
	JMP LQPWLP		/LOOP IF NOT READY

	TAD LQPDY		/DO Y MOTION, IF NEEDED
	SNA
	JMP LQPNDY		/JUMP IF NONE
	CIA
	DCA LQPMTM		/SAVE -NUMBER LINES TO DO

	TAD LQLINE		/SUM TOTAL INCRS TO DO
	ISZ LQPMTM
	JMP .-2

	PDMP		/MOVE PAPER

	TAD LQPY		/COMPUTE NEW POSITION
	TAD LQPDY
	TAD LQPAGE		/ON PAGE, PLEASE!!
	SMA
	JMP .-2
	CIA
	TAD LQPAGE
	CIA
	DCA LQPY
	DCA LQPDY

LQPNDY,	TAD LQPDX		/DO X MOTION, IF NEEDED
	SNA
	JMP LQPNDX		/JUMP IF NONE

	STL
	SMA
	CLL CIA			/ADJUST FOR -X MOTION
	DCA LQPMTM

	TAD LQPTCH		/SUM TOTAL INCRS TO DO
	ISZ LQPMTM
	JMP .-2

	RAR		/GET DIRECTION INDICATOR BACK
	PDMC		/MOVE CARRIAGE

	TAD LQPX		/COMPUTE NEW POSITION
	TAD LQPDX
	DCA LQPX
	DCA LQPDX

LQPNDX,	TAD LQPCTM		/RETRIEVE SAVED CHAR
	SNA
	JMP LQPDCR		/JUMP IF NONE
	CLL RAL		/ADJUST FOR OFFSET
	PDPC			/PRINT CHAR

LQPIDX,	ISZ LQPDX		/BUMP SPACE COUNTER
	JMP LQPDCR		/RETURN TO CALLER
	JMP LQPDCR		/...IN CASE ISZ SKIPPED...

LQPSPC,			/SPECIAL CHARACTER CHECKING
	TAD (40-32)	/CONTROL Z?
	SNA
	JMP I LQPDCX		/TAKE EOF RETURN IF SO

	TAD (32-15)		/CARRIAGE RETURN?
	SNA
	JMP LQPCR		/JUMP IF SO

	IAC			/FORM FEED?
	SNA
	JMP LQPFF		/JUMP IF SO

	IAC			/VERTICAL TAB?
	SNA
	JMP LQPDC1		/CLEAR ACCUMULATORS, IF SO

	IAC			/LINE FEED?
	SNA
	JMP LQPLF		/BUMP LINE COUNTER IF SO

	IAC			/TAB?
	SNA CLA
	JMP LQPDCR		/RETURN IF NOT RECOGNIZED

LQPTB,	TAD LQPX		/DO TAB
	TAD LQPDX
	TAD (10)
	AND (7770)
	CIA

LQPCR,	TAD LQPX
	CIA
	DCA LQPDX		/SAVE CR OR TAB MOTION

LQPDCR,	ISZ LQPDCX		/BUMP TO OK RETURN
	JMP I LQPDCX			/AND TAKE IT

LQPLF,	ISZ LQPDY		/BUMP LINE COUNTER
	TAD LQPY		/CHECK FOR NEXT PAGE
	TAD LQPDY
	TAD LQPAGE
	SMA CLA
	JMP LQPDC1		/JUMP IF SO

	JMP LQPDCR		/ELSE, JUST RETURN

LQPFF,	TAD LQPY		/DO FORM FEED
	TAD LQPAGE
	CIA
	DCA LQPDY
	JMP LQPDC1		/DO PAGE EJECT NOW

LQPX,	0
LQPDX,	0
LQPY,	0
LQPDY,	0
LQPMTM,	0
LQPCTM,	0

PAGE
