/5 LP08/LS8E/LA180/LV8E HANDLER
/
/
/
/
/
/
/
/
/
/COPYRIGHT  (C)  1974,1975,1977 BY DIGITAL EQUIPMENT CORPORATION
/
/
/
/
/
/
/
/
/
/
/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 IN THIS DOCUMENT 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 CORPORATION ASSUMES NO RESPONSIBILITY FOR THE USE
/OR RELIABILITY OF ITS SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY
/DIGITAL.
/
/
/
/
/
/
/
/
/
/
	LPVERSION="C&77

	*0

	-1
	DEVICE LPSV;DEVICE LPT;1040;LPT&177;ZBLOCK 2

/LPT HANDLER FOR EITHER LP08 OR LS8E LINE PRINTER.
/HANDLES TABS, PASSES EVERYTHING ELSE ON TO THE HARDWARE.

	LSF=6661	/SKIP ON FLAG
	LSR=6663	/SKIP ON ERROR
	LLS=6666	/LOAD LPT BUFFER

	DBST=	6570	/SKIP IF DEMAND SET AND CLEAR IT
	DBTD=	6574	/LOAD COMPLEMENT OF AC0-11 TO TRANSMIT BUFFER
	DBSE=	6575	/SET INTERRUPT ENABLE
	DBCE=	6575	/CLEAR INTERRUPT ENABLE

	LA180=0		/SET TO 1 TO USE LA180

/V3D CHANGES:

/ADDED IN LA180 SUPPORT
	*200

LPWDTH,	-205		/-(WIDTH+1)    [USE -121 FOR 80 COLUMNS]
LTERMC,	14		/4 FOR LV8
LVCCNV,	-40		/0 IF PRINTER PRINTS LC
LP7770,	7770
LP0007,	0007
LPT,	LPVERSION	/NORMAL ENTRY POINT
	CLA STL RAR
	TAD I	LPT	/ R/W BIT TO LINK		L
	AND	LP7700	/				I
	CMA		/TREAT 0 PG CNT AS 0 WD CNT	N
	DCA	LPTWC	/SAVE -(DBLWD COUNT+1)		K
LPT214,	RDF		/
	TAD	LPTCIF	/				M
	DCA	LPTXIT	/SAVE CIF CDF RETRN FIELD	U
	TAD I	LPT	/				S
	AND	(70	/				T
	TAD	(CDF 0	/
	DCA	LPTCDF	/				N
	ISZ	LPT	/PT TO BUFFER			O
	TAD I	LPT	/GET BUFFER ADDRESS		T
	DCA	LPTCA	/SAVE BUFFER PTR
	ISZ	LPT	/PT TO BLOCK #			C
	TAD I	LPT	/GET IT				H
	ISZ	LPT	/POINT TO ERROR RETURN		G
LPTCDF,	HLT		/				!
	SNL
	JMP	LPTERR	/CAN'T READ FROM LPT
	SNA CLA
	TAD	LPT214	/OUTPUT FORM FEED IF BLOCK 0
LPTELP,	JMS	LPTPCH	/PRINT 3RD CHAR OF DOUBLEWORD
	ISZ	LPTWC
	JMP	LPTLP	/GET 3 MORE CHARS
	SKP
LPTCTZ,	TAD	LTERMC
	JMS	LPTPCH	/OUTPUT FORM FEED IF ^Z SEEN (EOT OF LV8)
	ISZ	LPT	/BUMP TO NORMAL RETURN
LPTXIT,	HLT		/RESTORE FIELDS
	JMP I	LPT	/EXIT
/UNPACKING LOOP - USES A SHIFT REGISTER METHOD TO GET THE
/THIRD CHARACTER IN EACH DOUBLEWORD.

LPTLP,	STL		/GUARD BIT OF SHIFT REGISTER
LPROTL,	RTL
	RTL
	SPA		/DO WE HAVE 8 BITS SHIFTED IN?
	JMP	LPTELP
	DCA	LPTCDF	/SAVE SHIFT REGISTER
	TAD I	LPTCA
	JMS	LPTPCH	/PRINT A CHAR
	TAD I	LPTCA
	ISZ	LPTCA	/BUMP INPUT POINTER
LP7400,	7400		/PROTECT ISZ
	AND	LP7400
	CLL RAL
	TAD	LPTCDF	/SHIFT HIGH 4 BITS INTO
	JMP	LPROTL	/SHIFT REGISTER

LPTERR,	STL CLA RAR	/PUT 4000 IN AC
	JMP	LPTXIT	/AND TAKE ERROR RETURN

LPTWC,	0
LPTCA,	0
/CHAR PRINT ROUTINE

LPTPCH,	0
	AND	(177
	TAD	(-175
	SMA
	JMP	LPFLSH	/FLUSH CODES 175-177
	TAD	(175-140
	SMA
	TAD	LVCCNV	/CONVERT LC TO UC IF DESIRED
	TAD	(140-33
	SNA
	TAD	(11	/CHANGE ALTMODE TO $
	IAC
	SNA
	JMP	LPTCTZ	/^Z - END OF FILE
	TAD	(32-11
	SNA
	JMP	LPTTAB	/TABS MUST BE SIMULATED
LPLFHK,	TAD	(11	/RESTORE CHAR
	SZA		/FLUSH NULLS
	JMS	LPCHAR	/
	TAD	LPLPTR	/IF COL. CTR GT 0
	SMA		/WE HIT A CONTROL CHAR
	TAD	LPWDTH	/OR EOL- SET TO FULL
	DCA	LPLPTR	/WIDTH (NOTE LPLPTR=1 !)
LP7700,
LPFLSH,	SMA CLA		/NEVER SKIPS
	JMP I	LPTPCH	/RETURN

LPCHAR,	0		/LOW LEVEL PRINT ROUTINE
	IFZERO LA180 <
	NOP		/NOP'S NEEDED FOR SET
	LLS		/PUT CHAR IN LPT BUFFER
	NOP
	>
	IFNZRO LA180 <
	CMA
	DBTD		/PUT CHAR IN LP BUFFER
	CMA
	>
	AND	LP7770	/KLUDGE - CLEARS COLUMN CTR
	TAD	LP7770	/ON CR, LF, VT, FF BUT ALSO
	SNA CLA		/ON ^H,^N, AND ^O.  BIG DEAL
	DCA	LPLPTR	/?SR RICHIE SAID 'LPCRFG'
LP7600,	7600		/CLEAR AC
LPCTCL,	TAD	LP7600
	KRS
	TAD	(-7603	/CHECK FOR ^C FROM CONSOLE
	SNA CLA
	KSF		/WITH FLAG UP
	JMP	.+3
LPTCIF,	CDF CIF 0	/YES, RETURN TO OS/8
	JMP I	LP7600
	IFNZRO	LA180	<DBST>	/NO	MUST BE HERE
	IFZERO	LA180	<LSF>	/NO	FOR SET
	JMP	LPCTCL	/WAIT FOR FLAG
	ISZ	LPLPTR	/CHECK LINE OVERFLOW
	JMP I	LPCHAR
	TAD	(15
	JMS	LPCHAR
	CLA IAC
	JMP	LPLFHK
LPTTAB,	TAD	LPBLNK	/GET PSEUDO BLANK
	JMS	LPCHAR	/PRINT IT
	TAD	LPWDTH
	CMA
	TAD	LPLPTR	/GET # CHARS IN LINE
	AND	LP0007
LPBLNK,	SZA CLA		/LOOP 'TILL MULTIPLE OF 8
	JMP	LPTTAB
	JMP I	LPTPCH

LPLPTR,	0
	$

