/LPT DRIVER TASK FOR RTS-8
/
/
/
/
/
/
/
/
/
/COPYRIGHT  (C)  1974 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.
/
/
/
/
/
/
/
/
/
/
/HANDLES LE8, LS8E, LV8 LINE PRINTERS.
/INPUT MESSAGE FORMAT IS COMPATIBLE WITH THE TELETYPE HANDLER

/TASK DATA BLOCK:
TASK=	LPT
CUR=	10
INIWT=	0

LSF=	6661
LCF=	6662
LSE=	6663	/ERROR SKIP FOR LE8 ONLY
LIE=	6665
LLS=	6666
LIF=	6667	/DISABLE INTERRUPT - LE8 ONLY

	FIELD CUR%10
	*4600
MEVFLG,
START,	CAL
FLAGS,	SKPINS
HALF,	LPINT
LPMSLP,	TAD	ASGNEE	/GET ASIGNEE (IF ANY)
	CAL
	RECEIV		/TAKE THE MESSAGE OFF THE Q
MADDR,	0		/GETS ADDRESS OF MESSAGE
	DCA	MSGCDF	/FIELD OF MSG IN AC
	AC7775
	TAD	MADDR
	DCA	MEVFLG	/SAVE MESSAGE EVENT FLAG ADDRESS
	JMS	CDFMSG
	TAD I	MADDR
	DCA	FLAGS	/FIRST WORD OF MESSAGE IS FLAGS
	ISZ	MADDR
	ISZ	MADDR	/SKIP REPLY WORD
	TAD	FLAGS
	AND	(200
	SZA CLA
	JMP	ASSIGN	/BIT 200 ON MEANS THIS IS AN ASSIGN CALL
	TAD	FLAGS
	RTL
	SMA CLA		/BIT 1000 OF FLAG WORD INDICATES
	JMP	.+3	/IF MESSAGE OR POINTER TO IT FOLLOWS
	TAD I	MADDR
	DCA	MADDR
	STA
	DCA	HALF	/INITIALIZE LEFT/RIGHT SWITCH
/LOOP TO UNPACK AND OUTPUT MESSAGE

LPOLP,	JMS	CDFMSG
	TAD	FLAGS
	SPA CLA		/BIT 0 IF FLAG WD TELLS WHETHER
	JMP	ONEPWD	/MESSAGE IS PACKED OR UNPACKED ASCII
	ISZ	HALF
	JMP	RGHTHF
	AC7776
	DCA	HALF
	TAD I	MADDR
	CLL RTR
	RTR
	RTR
	JMP	.+3
RGHTHF,	TAD I	MADDR
	ISZ	MADDR
	AND	(77
	SNA
	JMP	CKCRLF
	TAD	(240
	AND	(77
	TAD	(240
OUTCH,	JMS	LPOUT
	JMP	LPOLP

ONEPWD,	TAD I	MADDR
	ISZ	MADDR
	SZA
	JMP	OUTCH
CKCRLF,	TAD	FLAGS
	RAL		/BIT 1 OF FLAGS TELLS WHETHER
	SMA CLA		/TO FOLLOW MESSAGE BY A CR/LF
	JMS	CRLF
LPOVER,	TAD	MSGCDF	/GET CDF TO MESSAGE FIELD
	DCA	MF
	TAD	MEVFLG
	CAL
	POST
MF,	0		/POST EVENT FLAG FOR SENDER
	JMP	LPMSLP

ASSIGN,	TAD	FLAGS
	AND	(77	/GET TASK TO BE ASSIGNED TO
	DCA	ASGNEE
	JMP	LPOVER	/POST ASSIGNMENT EVENT FLAG

ASGNEE,	0		/TASK ASSIGNMENT - 0 MEANS UNASSIGNED
/LOW-LEVEL LPT OUTPUT CODE

CRLF,	0
	TAD	(215
	JMS	LPOUT
	TAD	(212
	JMS	LPOUT
	JMP I	CRLF

LPOUT,	0
	DCA	CDFMSG
	TAD	LPOEV
	SNA CLA		/EVENT FLAG POSTED?
	JMP	LPREDY	/YES - SKIP SOME OVERHEAD
	CLA IAC
	LIE		/ENABLE LINE PRINTER INTERRUPTS
	CLA		/JUST IN CASE
	CAL
	WAITE		/WAIT FOR LAST CHAR TO FINISH
PLPOEV,	LPOEV
LPREDY,	TAD	CDFMSG
	IOF		/INHIBIT INTERRUPTS
	LLS
	CLA
	AND I	0	/WASTE SOME TIME
	ISZ	LPOEV
	LSF
	JMP	.+3	/TEST FOR IMMEDIATE FLAG
	LCF
	DCA	LPOEV
	ION		/RESTORE INTERRUPTS
	JMP I	LPOUT	/YES - DON'T BOTHER WITH EVENT FLAG

LPINT,	0;0		/USED FOR LINKING INTO SKIP CHAIN
	LSE		/CHECK FOR LPT POWER LOW
	SKP		/NO
	LIF		/YES - DISABLE INTERRUPTS
	LSF
	JMP I	LPINT
	CDF CUR
	CIF 0
	LCF
	TAD	PLPOEV
	POSTDS		/POST "LPT COMPLETE" EVENT FLAG

LPOEV,	0

CDFMSG,	0
MSGCDF,	HLT
	JMP I	CDFMSG
	PAGE
	$$$$

