	.TITLE RSX LINE PRINTER HANDLER
/
/   8 SEP 77 (PDH) INSERT CODE FOR 'CLOSE'
/   7 SEP 77 (PDH) FOLD LOWER CASE INTO UPPER; DEFINE 'UC15'
/
UC15=0
/
/ COPYRIGHT (C) 1975
/ DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
/
/ THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY
/ ON A SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH
/ THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS
/ SOFTWARE, OR ANY OTHER COPIES THEREOF, MAY NOT BE PRO-
/ VIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON
/ EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO
/ THESE LICENSE TERMS.  TITLE TO AND OWNERSHIP OF THE
/ SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.
/
/ THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE
/ WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COM-
/ MITMENT BY DIGITAL EQUIPMENT CORPORATION.
/
/ DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY
/ OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY
/ DEC.
/
	.EJECT
/
/	EDIT #20	8/29/73		S. ROOT
/	EDIT #21	11/25/73	G. COLE & S. ROOT
/	EDIT #22	11/26/73	S.ROOT FIX TOO SHORT LINE
/	EDIT #17	30 APR 72	H. KREJCI
/					C. PROTEAU
/					W. A. DESIMONE
/	EDIT #23	1/9/74		SCR CLEANUP
/	EDIT #24	1/17/74		SCR CLEANUP
/	EDIT #25	1/18/74		SCR CLEANUP
/	EDIT #26	2/2/74		API TRAP VECTOR NUMBER ERROR
/	EDIT #027	2/2/74		FIX NO OK EXIT PROBLEM
/	EDIT #028	2/2/74		FIX IMAG MODE COUNT
/	EDIT #029	2/28/74	SCR	PUT LINE FEED BACK FOR UC15 IMAGE MODE
/	EDIT #031	5/25/74	SCR	#030 HAD A RUN-DOWN PROBLEM, RETRENCH
/					TO 029 MOSTLY
/	EDIT #032	5/9/75 MJH	MISSING DISCLAIMER
/
/ COPYRIGHT 1971, 1972, 1973, 1974 DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
/
/
/	MODIFICATIONS FOR UC15 UNICHANNEL LINE PRINTERS
/
/  WHEN THE ASSEMBLY PARAMETER UC15=0 IS SUPPLIED, A VERSION
/  FOR THE UNICHANNEL PRINTERS IS CREATED.
/
/  IN THIS CASE THE INTERNAL BUFFER IS PACKED TWO CHAR'S PER
/  WORD, RIGHT JUSTIFIED, WITH THE TWO TOP BITS UNUSED.
/  THE FIRST CHARACTER GOES ON THE RIGHT!, THE SECOND ON THE LEFT!
/
/  ERROR CONDITIONS ARE ENTIRELY HANDLED ON THE PDP-11 SIDE. THE
/  PDP-15 SIDE HANDLER ASSUMES THAT THE DEVICE NEVER MAKES AN
/ ERROR; SOME OPERATIONS JUST TAKE A WHILE TO COMPLETE. ERROR
/  MESSAGES ARE PLACED IN A TABLE IN THE PIREX-11 EXEC. A
/  SEPARATE TASK PRINTS OUT ANY ERROR S THAT OCCUR. THE
/  PDP-11 HANDLES TIMEOUT UNTIL DEVICE READY.
/
/	W  A  R  N  I  N  G  !  !
/
/  IN ORDER FOR THE UC15 HANDLER TO FUNCTION PROPERLY, THE
/  PDP-11 MUST BE ABLE TO ACCESS OUR INTERNAL BUFFER
/  AND TCB'S. THIS MEANS THAT THEIR ADDRESS MUST BE LESS THAN
/  28K TO THE PDP-11. THUS, IF THE PDP-11 LOCAL MEMORY IS 8K,
/  THIS HANDLER MUST RESIDE BELOW 20K IN PDP-15 CORE! THIS IS
/  EQUIVALENT TO 50000 OCTAL. SIMILARLY, IF THE LOCAL 
/  PDP-11 MEMORY IS 12K, THE HANDLER MUST RESIDE BELOW
/  40000 OCTAL.
/
/   STANDARD SERIES PRINTERS
/
/
/ THIS HANDLER DRIVES THE LP15 PRINTER SERIES.  IT IS
/ COMPATIBLE WITH NORMAL OUTPUT FROM MACRO & FORTRAN WRITTEN
/ PROGRAMS.
/
/ TO SATISFY A PRINT REQUEST, THE LINE IS MOVED TO A BUFFER IN
/ THE HANDLER TASK BECAUSE IT MAY HAVE TO BE MODIFIED (IF NORMAL
/ FORTRAN OUTPUT), AND BECAUSE A NORMAL MODE REQUESTOR MUST
/ NOT BE ABLE TO MODIFY THE LINE AFTER THE HARDWARE HAS BEGUN
/ TO READ IT (THE LP15 CONTROLLER UNPACKS 5/7 ASCII CHARACTERS
/ UNTIL A VERTICAL CONTROL CHARACTER IS FOUND).
/
/ ALL IMAGE MODE OUTPUT AND ASCII OUTPUT NOT BEGINNING WITH
/ 12 (LINE FEED), 14 (FORM FEED), 21 (DOUBLE SPACE), OR 20
/ (OVER PRINT) IS PRECEDED BY A LINE FEED, AND PRINTED IN 
/ SINGLE LINE MODE.
/
/ FOR ASCII MODE OUTPUT BEGINNING WITH 12, 14, OR 21 (FORTRAN
/ OTS OUTPUT), THE HIGH ORDER HEADER HALFWORD IS SET TO TWO (TO
/ INDICATE TWO "LINES") AND THE LINE IS OUTPUT IN MULTIPLE-LINE
/ MODE.
/
/ FOR ASCII MODE OUTPUT BEGINNING WITH 20 (FORTRAN OTS OUTPUT TO
/ OVERPRINT THE PREVIOUS LINE), THE HIGH ORDER HEADER HALFWORD
/ IS SET TO TWO, THE 20 IS CHANGED TO A 15 (CARRIAGE RETURN, 
/ WHICH IS EFFECTIVELY A NOP), AND THE LINE IS PRINTED IN MULTIPLE
/ LINE MODE.
/
/ THERE ARE NO IMPOSED PAGE EJECTS AT PAGE BOTTOMS.
/
/ THE FOLLOWING CAL PARAMETER BLOCKS ARE USED TO QUEUE REQUESTS FOR
/ PRINTER SERVICE:
/
/	CPB	3600	HANDLER INFORMATION (HINF)
/		EV
/		LUN
/
/	CPB	2400	ATTACH PRINTER
/		EVA
/		LUN
/
/	CPB	2700	PRINT LINE
/		EVA
/		LUN
/		MODE
/		LINE
/
/	CPB	2500	DETACH PRINTER
/		EVA
/		LUN
/
/ THE REQUESTOR'S EVENT VARIABLE IS CLEARED (ZEROED) WHEN THE REQUEST
/ IS QUEUED BY THE "QUEUE I/O" DIRECTIVE.  IF THE REQUEST CAN BE 
/ PERFORMED, THE EVENT VARIABLE IS SET TO ONE (+1) UPON COMPLETION.
/ IF THE REQUEST CANNOT BE PERFORMED, THE EVENT VARIABLE IS SET TO ONE 
/ OF THE FOLLOWING NEGATIVE VALUES:
/
/	 -6 -- ILLEGAL REQUEST FUNCTION
/	 -7 -- ILLEGAL DATA MODE
/	-16 -- ILLEGAL OUTPUT HEADER WORD-PAIR-COUNT (<1)
/	-24 -- LUN HAS BEEN REASSIGNED WHILE REQUEST WAS IN QUEUE
/	-30 -- OUT-OF-PARTITION TRANSFER (NORMAL MODE)
/	-203 - ILLEGAL TO ATTACH OR DETACH FROM OTHER THAN TASK LEVEL
/
X12=12		/AUTO-INCREMENT REG 12
X13=13		/AUTO-INCREMENT REG 13
X17=17		/AUTO-INCREMENT REG 17 (USED TO SET REQUESTOR'S EV)
R1=101		/RE-ENTRANT REGISTER ONE
R2=102		/RE-ENTRANT REGISTER TWO
R3=103		/RE-ENTRANT REGISTER THREE
R4=104		/RE-ENTRANT REGISTER FOUR
NADD=107	/NODE ADDITION ROUTINE ENTRY POINT
SNAM=123	/NAME SCAN ROUTINE ENTRY POINT
POOL=240	/LISTHEAD FOR POOL OF EMPTY NODES
PDVL=252	/LISTHEAD FOR PHYSICAL DEVICE LIST
ALAD=325	/ATTACH LUN & DEVICE ENTRY POINT
DLAD=332	/DETACH LUN & DEVICE ENTRY POINT
DQRQ=337	/DE-QUEUE REQUEST ENTRY POINT
VAJX=342	/VERIFY & ADJUST ENTRY POINT
IOCD=345	/DECLARE I/O REQUEST COMPLETE ENTRY POINT
DMTQ=361	/DETACH & EMPTY QUEUE ENTRY POINT
D.TG=10		/POSITION OF TRIGGER EVENT VARIABLE IN PDVL NODE
LUN=2		/LUN FOR NOT-READY MESSAGE.(LUN 3 NOT USED SINCE MCR OUTPUT
		/COULD BE CHANNELED THRO LUN 3)
WCA=34		/WORD COUNT ADDRESS (NOT USED BY LP CONTROLLER)
CAA=35		/CURRENT ADDRESS REGISTER ADDRESS
LPP1=706541	/PRINT ONE LINE
LPPM=706521	/PRINT MULTIPLE LINE
LPRS=706552	/READ LP STATUS
LPEI=706544	/ENABLE LP INTERRUPTS
LPDI=706561	/DISABLE LP INTERRUPTS
LPCD=706621	/CLEAR LP DONE FLAG
LPCS=706641	/CLEAR LP STATUS AND ERROR FLAGS
.INH=705522	/INHIBIT INTERRUPTS
.ENB=705521	/ENABLE INTERRUPTS
/
/
	.IFDEF	UC15
/
/  EQUATES FOR UNICHANNEL PRINTERS
/
APISLT=56
APILVL=2
LPSI=APILVL*20+706101
SIOA=706001
LIOR=706006
CAPI=APILVL*20+706104
/
	.IFUND	NOSPL
DEVCOD=4		/DEVICE CODE IN PIREX IF SPOOLING ALLOWED
	.ENDC
	.IFDEF	NOSPL
DEVCOD=204		/200 BIT FORBIDS SPOOLING
	.ENDC
	.ENDC
	.DEC
	.IFUND	LBZ	/LINE BUFFER SIZE MAY BE CHANGED VIA
/
/  PDP-15 LINE PRINTERS MAY HAVE MAX OF 132 CHAR'S IN IMAGE
/
LBZ=134			/CONDITIONAL ASSEMBLY, HOWEVER 'LBZ'
/
	.ENDC		/MUST BE EVEN (FOR "GUARD WORD" PROTECTION TO WORK).
	.OCT
	.IFUND	UC15
LBZX=LBZ/2*2-LBZ
	.IFNZR	LBZX
	.END -- LBZ MUST BE EVEN
	.ENDC
	.ENDC
/
LBF=.
/
/ HANDLER INITIALIZATION
/
START	LAC	LPDVL	/SCAN PHYSICAL DEVICE LIST FOR NODE
	DAC*	(R1)	/FOR THIS DEVICE.
	LAC	LHNAM
	DAC*	(R2)
	JMS*	LSNAM	/(R1, R2, R6, X17, XR, & AC ARE ALTERED)
			/NODE FOUND?
	CAL	(10)	/NO -- EXIT
	DAC	PDVNA	/SAVE PDVL NODE ADDRESS
	AAC	+D.TG	/AND
	DAC	PDVTA	/TRIGGER EVENT VARIABLE ADDRESS ADDRESS.
	CAL	CCPB	/CONNECT INTERRUPT LINE
	LAC	EV	/CONNECT OKAY?
	SPA
	CAL	(10)	/NO -- EXIT
	LAC	LTG	/YES -- SET TRIGGER EVENT VARIABLE ADDRESS
	DAC*	PDVTA	/IN PHYSICAL DEVICE NODE
	AND	L70000	/DETERMINE "XR-ADJ"
	TCA
	DAC	XADJ
/
	.IFUND	UC15
/
	LPCD		/CLEAR LP CONTROLLER
	LPCS
/
	.ENDC
/
	.IFDEF	UC15
/
	JMS	CLEAR	/CLEAR OUT DEVICE, WAIT FOR COMPLETE
	LAC	EV11K	/CHECK IF OUR DRIVER IN PIREX
	RTL		/PDP-11 SIGN BIT TO OURS
	SMA		/SKIP IF PROBLEM
	JMP	WFTGR	/NO PROBLEM, GO WAIT FOR WORK
	CAL	MSINIT	/PROBLEM, TYPE MESSAGE
	CAL	WFMS	/WAIT FOR MESSAGE COMPLETION
	CAL	(10	/TYPED, NOW EXIT
/
WFMS	20	/WAIT FOR ERROR MESSAGE
	EV
MSINIT	2700		/TYPE ERROR MESSAGE
	EV
	LUN
	2
	INITMS
INITMS 	004002; 000000; .ASCII "*** NO LP IN PIREX"<15>
/
	.ENDC
/
	JMP	WFTGR	/WAIT FOR TRIGGER
/
HNAM	.SIXBT "LP@@@@"	/DEVICE NAME (HANDLER TASK NAME IS "LP....")
/
/  INITIALIZATION LITERALS, TO SAVE SPACE
/
LPDVL	PDVL		/PHYSICAL DEVICE LIST HEADER ADDR.
LHNAM	HNAM		/POINT TO HANDLER NAME
LSNAM	SNAM		/SEARCH FOR NAME MATCH ROUTINE ADDR.
LTG	TG		/ADDR OF OUT TRIGGGER
L70000	70000		/LITERAL FOR XR ADJUSTMENT
/
/
			/END OF INITIALIZATION CODE
/
	.IFUND	UC15
/
	.BLOCK LBZ+LBF-.
/
/ ^^^^^^^^^^^^^^^^ THE ABOVE CODE IS OVER- ^^^^^^^^^^^^^^^^^^
/ ^^^^^^^^^^^^^^^^ LAYED BY OTS ASCII LINES ^^^^^^^^^^^^^^^^^
/
	064015	/GUARD WORD CONTAINS A CARRIAGE RETURN (15) LINE
		/TERMINATOR FOR BOTH ASCII & IMAGE MODE LINES.  ITS
		/PURPOSE IS TO STOP THE LP15 CONTROLLER IF A LINE
		/DOES NOT CONTAIN A VERTICAL CONTROL CHARACTER
		/REQUIRED TO STOP THE CONTROLLER FROM FETCHING
		/DATA FROM CORE.
	.ENDC
	.IFDEF UC15
/
	.BLOCK	LBZ/2+2+LBF-.
PUTP	0
	.ENDC
/
/
/ WAIT FOR TASK TO BE TRIGGERED BY 'QUEUE I/O' DIRECTIVE OR BY 'ABORT'
/ TO SIGNAL THAT A REQUEST HAS BEEN QUEUED.
/
WFTGR	CAL	WFTCPB	/WAIT FOR TRIGGER EVENT VARIABLE TO BE SET
/
	.IFUND	UC15
/
/ THE TASK HAS BEEN TRIGGERED -- PICK A REQUEST FROM QUEUE (IF ANY)
/
	DZM	TG	/CLEAR TRIGGER
PQ	LAC	PDVNA	/DEQUE A REQUEST
/
	.ENDC
/
	.IFDEF	UC15
/
PQ	LAC	TG	/FIND OUT WHO WOKE US UP
	DZM	TG	/CLEAR FOR NEXT TIME AROUND
	RTL		/ABORT BIT TO AC0
	SPA!CLA!IAC	/SKIP IF NOT, SET UP 1 FOR COMPARES
	JMP	PQ1	/PICK OFF ABORT IN NORMAL MANNER
/			/IRREGARDLESS IF WAITING FOR INTERRUPT
	SAD	LPDON	/HAS INTERRRUPT COME BACK
	JMP	OPDONE	/GO CHECK IT OUT
	SAD	POST	/ARE WE WAITING FOR ONE
	JMP	WFTGR	/YES, DO NOTHING NOW, INTERRUPT WILL WAKE
/			/US LATER;WE ALWAYS CHECK DEQUE BEFORE 
/			/RETUNING TO SLEEP AGAIN.
PQ1	LAC	PDVNA	/DEQUE A REQUEST
/
	.ENDC
/
	DAC*	(R1)
	JMS*	(DQRQ)	/(R1, R2, R4, R5, R6, XR, & AC ARE ALTERED)
			/WAS A REQUEST FOUND?
	JMP	WFTGR	/NO -- WAIT FOR TRIGGER
	DAC	RN	/YES -- SAVE ADDRESS OF REQUEST NODE
	TAD	XADJ	/SETUP XR TO ACCESS NODE
	PAX
/
	LAC	5,X	/FETCH CAL FUNCTION CODE
	AND	(777)
	SAD	(017)	/ABORT REQUEST?
	JMP	ABORT	/YES -- ABORT TASK I/O
	SAD	(777)	/NO -- EXIT (DEASSIGNED) REQUEST?
	JMP	DAEX	/YES -- DETACH & EXIT
	SAD	(27	/PRINT REQ?
	JMP	PRINT	/YUP
	SAD	(36	/HINF CODE REQ?
	JMP	HINF
	.IFDEF	UC15		/ PDP-11 PRINTER ONLY - CLOSE TO SPOOLER
	SAD	(34
	JMP	CLOSE
	.ENDC
	CLL!RAR		/SEARCH ATTACH DETACH IN COMMON
	SAD	(12	/24/2 AND 25/2  ARE 12
	JMP	ATTACH	/GO DO EITHER
ILFUNC	LAW	-6	/NO -- UNIMPLEMENTED FUNCTION -- SET
	JMP	SEV	/EVENT VARIABLE TO -6
/
/ ABORT ALL I/O INITIATED BY THE INDICATED TASK.
/
ABORT	XOR	5,X	/ABORT IS AN ILLEGAL FUNCTION FOR ALL TASKS
	SZA!CLA!CMA	/EXCEPT 'IORD', WHO SETS THE LUN=0.
	JMP	ILFUNC
/
	.IFDEF	UC15
/
/  IF ABORT REQUEST IS FOR THE PRESENT TASK, WHCIH IS
/  PRESENTLY WAITING FOR A PRINT REQ, TELL PDP-11 TO COOL IT.
/
	TAD	POST	/AC NOW 0 IF WAITING
	TAD	2,X	/STL NODE PRESENT REQ.
	SAD	STLA	/STL NODE PRINT REQ
	JMS	CLEAR	/!ONLY! IF POST=1 AND 2,X=STLA!!
/
/
	.ENDC
/
	LAC	PDVNA	/PHYSICAL DEVICE NODE ADR
	DAC*	(R1)
	LAC	RN	/REQUEST NODE ADR
	DAC*	(R2)
	JMS*	(DMTQ)	/DETACH LUN & DEVICE, IF NECESSARY, AND THEN
			/EMPTY THE QUEUE OF ALL I/O REQUESTS MADE BY THE
			/TASK BEING ABORTED. (R1, R2, R3, R5, R6, X10,
			/X11, X12, XR & AC ARE ALTERED).
	JMP	SP1	/DONE.
/
/
/  ATTACH TO  OR  DETACH FROM A TASK
/
ATTACH	CLA!RAL		/LINK TO AC; ATTACH-DETACH COMMON CODE
	PAX		/XR 0 FOR ATTACH, 1 FOR DETACH
	LAC	PDVNA	/LUN AND DEVICE
	DAC*	(R1)
	LAC	RN
	DAC*	(R2)
	XCT	ATTDET,X /(R3, R4, R5, R6, X10, X11, XR, & AC ARE ALTERED)
			/WAS LUN DETACHED?
	JMP	SEV	/NO -- SET REQUESTOR'S EVENT VARIABLE TO -24 OR -203
SP1	CLA!IAC		/YES -- SET REQUESTOR'S EVENT VARIABLE TO +1
	JMP	SEV
/
/  MONITOR SUBROUTINE CALLS FOR ATTACH-DETACH
/
ATTDET	JMS*	(ALAD
	JMS*	(DLAD
/
/
/ RETURN HANDLER INFORMATION IN EVENT VARIABLE
/
HINF	LAC	(100011)
	JMP	SEV
/
/ PRINT LINE
/
	.IFUND	UC15
/
/
PRINT	LAC	7,X	/SAVE MODE INDICATOR
	DAC	MI
	AND	(777776)/IF DATA MODE IS OTHER THAN 2 (ASCII)
	SAD	(000002)/OR 3(IMAGE), SET REQUESTOR'S EVENT
	JMP	.+3	/VARIABLE TO -7
	LAW	-7
	JMP	SEV
/
	.ENDC
/
	.IFDEF	UC15
/
CLOSE	LAC	(6415		/ MUST PROVIDE DATA; OVERPRINT
	DAC	LBF+2
	LAC	(104001		/ 1 CHAR, EOF FOR SPOOLER
	SAD	LBF		/ CLOSE LAST THING SENT?
	JMP	SP1		/ COMPLETE REQUEST!
	DAC	LBF
	LAC	2,X		/ REMEMBER WHO ISSUED REQUEST
	DAC	STLA
	JMP	UCLP04		/ JOIN UP TO SEND LINE
/
PRINT	LAC	2,X
	DAC	STLA	/REMEMBER WHO ISSUED PRINT
/
/  SORRY ABOUT NEXT FEW; DATA MODE MUST BE 2 OR 3;
/  PUT IN MI A NOP FOR MODE 3 AND SKIP FOR MODE 2
/
	LAW	-2	/ADD IN MODE TO GIVE 0 OR 1
	TAD	7,X
	RAR!CLL		/0 IN AC IF ONLY IF LEGAL DATA MODE
	SNA!RAL		/SKIP ILLEGAL
	JMP	.+3	/NOW AC 0 FOR ASCII, 1 FOR IMAGE
	LAW	-7	/ERROR XIT
	JMP	SEV	/FOR ILLEGAL DATA MODE
	SWHA		/1000 FOR IMAGE MODE
	XOR	(SKP	/SKP OR NOP AS REQUESTED
	DAC	MI
/
	.ENDC
	LAC	RN	/VERIFY & ADJUST (NORMAL MODE) THE ADDRESS
	DAC*	(R2)	/OF THE BEGINNING OF THE LINE (HEADER ADR).
	LAC	10,X
	DAC*	(R3)
	DAC	TEMP1	/(SAVE UN-ADJUSTED BASE FOR SECOND JMS)
	CLA!IAC
	DAC*	(R4)
	JMS*	(VAJX)	/(R3, R5, XR, & AC ARE ALTERED)
			/IS BEGINNING ADDRESS OKAY?
	JMP	ERR30	/NO -- SET REQUESTOR'S EVENT VARIABLE TO -30
	LAW	-1	/YES -- SETUP X12 AS SOURCE INDEX TO MOVE LINE
	TAD*	(R3)
	DAC*	(X12)
/
	LAC*	X12	/MOVE FIRST HEADER LINE AND ESTABLISH LINE
	DAC	LBF	/LENGTH IN WORDS.
	LRS	10
	AND	(776)
	DAC*	(R4)
/
	AAC	-2	/IF LESS THAN TWO WORDS, SET REQUESTOR'S
	SMA		/EVENT VARIABLE TO -16.
	JMP	.+3
	LAW	-16
	JMP	SEV
/
	LAC	TEMP1	/VERIFY LINE SIZE (NORMAL MODE).  R2 & R4 ARE
	DAC*	(R3)	/SETUP.
	JMS*	(VAJX)	/(R3, R5, XR, & AC ARE ALTERED)
			/IS LINE SIZE OKAY?
	JMP	ERR30	/NO -- SET REQUESTOR'S EVENT VARIABLE TO -30
/
/  FOLLOWING SECTION FOR PDP-15 PRINTERS
/
	.IFUND UC15
	LAC*	(R4)	/YES -- SETUP 'TEMP1' AS WORD COUNT FOR MOVE
	TCA
	DAC	TEMP1
	AAC	+LBZ
	SMA
	JMP	.+3
	LAW	-LBZ
	DAC	TEMP1
	LAC	(LBF)	/SETUP X13 AS DESTINATION INDEX FOR MOVE
	DAC*	(X13)
/
	LAC*	X12	/MOVE REMAINDER OF LINE TO INTERNAL BUFFER
	DAC*	X13
	ISZ	TEMP1
	JMP	.-3
/
	CLA!IAC		/LINE HAS BEEN MOVED AND IS READY TO BE 
	JMS	SEVRN	/PRINTED FROM INTERNAL BUFFER, INDICATE
			/TO THE REQUESTOR THAT THE LINE HAS BEEN 
			/PRINTED BY SETTING HIS EVENT VARIABLE TO
			/+1.
/
	LAC	MI
	SAD	(3
	JMP	LFPSL
	LAC	LBF+2
	AND	(774000
	SAD	(50000
	JMP	PTL	/YES -- PRINT TWO LINES
	SAD	(060000)/NO -- FORM FEED (14)?
	JMP	PTL	/YES -- PRINT TWO LINES
	SAD	(104000)/NO -- DOUBLE SPACE (21)?
	JMP	PTL	/YES -- PRINT TWO LINES
	SAD	(100000)/NO -- OVERPRINT (20)?
	SKP
	JMP	LFPSL	/NO -- LINE FEED & PRINT SINGLE LINE
	LAC	LBF+2	/YES -- CHANGE 20 TO 15 (NOP LINE) AND
	AND	(003777)/PRINT TWO LINES
	XOR	(064000)
	DAC	LBF+2
	JMP	PTL
	.ENDC
/
/  UC15 SECTION TO TRANSFER BUFFER
/
	.IFDEF	UC15
/
/  EQUATES
/
LINLEN=LBZ-2		/CHARACTEERS PER LINE
/
	LAC*	X12	/!!MOVE!! FROM HEADER TO POINT TO DATA
	LAC	(LBF+2	/PUTTER POINTER IN PUTP
	DAC	PUTP
	LAC*	(R4	/HERE IS WORD COUNT OF BUFFER
	XCT	MI	/SKIP ASCII
	SKP		/IMIAGE, SKIP TO SUBTRACT 1
	SKP!CLL!RAR	/ASCII, REDUCE TO PAIR COUNT, SKIP TO TCA
	AAC	-1	/IMAGE, CORRECT FOR TWO WORDS IN HEADER
	CMA!IAC		/NEGATE FOR ISZ LOOP CONTROL. ISZ FIRST
	DAC	TEMP1
	LAC	GETIN	/INIT. CHAR GETTER
	DAC	GETSW
	LAC	PUTIN	/INIT CHAR PUTTER
	DAC	PUTSW
	DZM	LBF	/CLEAR CHARACTER COUNT
	CLA!CMA		/SET UP FIRST SWITCH
	DAC	FIRST
	DZM	TCHAR	/SO IT ISN'T A CR IN CASE OF BLANK LINE!
	JMS	RESETL	/RESET LINE POINTERS
/
/  MAIN LOOP TO TRANSFER CHAR'S TO HANDLER BUFFER
/
MAIN	JMS	GETCH	/CHARACTER GETTER, LEAVES IT IN AC
	DAC	TCHAR	/SAVE IT
	SNA		/SKIP UNLESS NULL CHAR
	JMP	MAIN	/NULL, IGNORE
	AAC	-40	/SEPARATE 'TEXT' CHAR'S FROM CONTROL CHAR'S
	SNA!SPA		/SKIP ON REGULAR CHARS
	JMP	MSPEC	/GO DO SPECIALS
	SAD	(137	/RUB OUT?
	JMP	MAIN	/IGNORE
	SAD	(135	/ALT MODE
	JMP	UCLP04	/END OF LINE ON ALT MODE
	LAC	BLANKC	/DO WE HAVE PENDING BLANKS/TABS TO SEND
/
/  NOTE THAT BLANKC HAS MINUS THE COUNT OF CONSECUTIVE BLANKS
/  TO SEND. A TAB IS CHANGED TO CONSECUTIVE BLANKS SINCE THE
/  PDP-11 HARDWARE DOESN'T KNOW ABOUT TABS.
/
	SMA!CLL		/SKIP IF ANY AT ALL
	JMP	MAINC	/NOPE, GO DO REGULAR CHAR.
	TAD	(200	/CHECK IF MORE THAN 127
	SMA!CLA		/SKIP IF YES
	JMP	MAIND	/NOPE, PUT OUT ONE COUNT OF BLANKS
	TAD	(200	/FIRST OF TWO COUNTS, 128
	JMS	PUTCH
	LAC	(200	/SET UP BALANCE
MAIND	TAD	BLANKC	/BALANCE FOR TWO, ALL IF ONE ONLY CASE
	JMS	PUTCH
MAINC	DZM	BLANKC	/RESET COUNTER
	LAC	TCHAR	/ORIGINAL CHAR.
	AAC	-140		/ (PDH) CHECK FOR LOWER CASE
	SMA			/ (PDH)
	AAC	-40		/ (PDH) FOLD LOWER CASE TO UPPER
	AAC	140		/ (PDH) RESTORE CHARACTER
	JMS	PUTCH	/PLACED INTO BUFFER
MAINK	ISZ	TABC	/INCREMENT TAB COUNTER
	JMP	MAINE	/NOT OVERFLOW, GO CHECK LINE COUNTER
	LAW	-10	/RESET TAB COUNTER
	DAC	TABC
MAINE	ISZ	MAXC	/HAVE WE RUN OUT OF LINE
	JMP	MAIN	/NO
	JMP	UCLP04	/YES, GO FINISH UP, RESET LINE POINTERS
/
/  SPECIAL CHARACTERS
/
MSPEC	SZA!CLA!CMA	/SKIP IF IT IS A BLANK
	JMP	MSPEC2	/NOPE, CHECK FOR OTHER THINGS
	TAD	BLANKC	/ADD ONE TO BLANK COUNTER (IS MINUS COUNTER)
	DAC	BLANKC
	JMP	MAINK	/JOIN LINE AND TAB CONTROL SECTION
MSPEC2	LAC	TCHAR	/GET BACK ORIGINAL CHAR
	SAD	(11	/IS IT A TAB
	JMP	MTAB	/YUP, GO DO IT
	SAD	(15	/CARRIAGE RETURN
	JMP	UCLP04	/END OF LINE ON CARRIAGE RETURN
	SAD	(20	/FORTRAN OTS OVERPRINT, DO AS CR
	JMP	MCR
	SAD	(14	/FORM FEED
	JMP	MSPEC3	/JUST PUT IT OUT, FOR NOW
	SAD	(21	/FORTRAN DOUBLE SPACE
	JMP	MSPEC4	/DO AS TWO 12'S
MSPEC5	LAC	(12	/DEFAULT ON UNRECOGNIZED CONTROL CHAR. IS LINE FEED
MSPEC3	JMS	PUTCH	/PLACE IN BUFFER
	JMP	MAIN	/GO DO NEXT
MSPEC4	LAC	(12	/FIRST OF TWO 12'S FOR THE 21
	JMS	PUTCH
	JMP	MSPEC5	/GO DO THE SECOND 112
MCR	JMS	RESETL	/RESET LINE POINTERS
	LAC	(15	/CARRIAGE RETURN
	JMP	MSPEC3	/PUT CHAR AND LOOP
MTAB	LAC	TABC	/GET REMAINING COUNT FOR TAB
	TAD	BLANKC	/AND ADD TO CUMULATIVE BLANK COUNT
	DAC	BLANKC
	LAC	TABC	/AND TO LINE CHECKER
	CMA!IAC
	TAD	MAXC
	DAC	MAXC
	SMA		/SKIP IF SOME LINE LEFT
	JMP	UCLP04	/NONE LEFT, FINISH UP, RESET POINTERS
	LAW	-10
	DAC	TABC	/RESET TAB COUNTER
	JMP	MAIN	/NEXT CHAR
/
/
UCLP04	CLA!IAC		/FROM USER BUFFER, SET EV
	JMS	SEVRN	/THIS RETURNS NODE SETS EV ETC.
	LAC	LBF	/GET CHAR COUNT
	SZA!CLA!CMA	/SKIP ON ZERO COUNT, -1 IS A BLANK!
	JMP	RETRY	/GO DO REGULAR
	ISZ	LBF	/MAKE COUNT 1 FOR THE BLANK
	JMS	PUTCH	/PUTS A SINGLE BLANK OUT
/
RETRY	CLA!IAC		/SET POST, SAYS WE'RE WAITING
	DAC	POST	
	DZM	LPDON	/CLEAR INTERRUPT HAPPENED
	LAC	TCBP	/POINTER FOR PIREX COMMAND STRING
	JMS	LPIU	/SEND IT
	JMP	WFTGR	/WAIT FOR INTERRRUPT TO WAKE US UP
/
OPDONE	DZM	POST	/RETURNED FROM PDP-11
	DZM	LPDON	/CLEAR FLAGS
	LAC	EV11	/PDP-11 STATUS
	AND	(177777	/KEEP THE PDP-11 BITS
	SAD	(177001	/OUT OF POOL ERROR
	JMP	RETRY	/YES, GO TRY AGAIN
	RTL	/PDP-11 SIGN BIT TO OUR SIGN BIT
	SPA!RTR		/REMAKE ORIG. CODE, SKIP IF OK
	DAC	IMPERR	/STORE 'IMPOSSIBLE' ERROR AND CONTINUE?!?
	JMP	PQ	/GO LOOK FOR MORE WORK
/
IMPERR	0		/IMPOSSIBLE ERROR HOLDER
/
/	CHARACTER UNPACKING ROUTINE
/
/  THIS ROUTINE 'OWNS' THE MQ
/
/  
/  CHARACTERS ARE OBTAINED FROM X12 POINTER. EACH CHAR
/  IS RETURNED RIGHT JUSTIFIED IN THE AC
/  TEMP1 HAS A MINUS COUNT OF THE WORDS TO BE OBTAINED
/  FROM THE INPUT POINTER X12
/
GETCH	0
	XCT	MI	/SKIP IF IT IS ASCII
	SKP
	JMP*	GETSW	/GETSW IS POINTER TO CORRECT ACTION ON ONTHE
/			/CORRECT ONE OF THE FIVE POSSIBLE CHAR'S
/
/  NOW DO IMAGE MODE
/
	ISZ	TEMP1
	SKP		/SKP ON NOT THRU YET
	JMP	UCLP04	/DONE
	LAC*	X12
	JMP	GETCM	/FINISH UP IN COMMON
/
GETSW	0		/POINTER TO CORRECT ACTION. INIT'ED FROM GETIN
/			/FILLED BY JMS GETSW AFTER EACH CHAR
GETCM	AND	(177	/COMMON FINISH UP, STRIP XTRA BITS
	JMP*	GETCH	/OUT
/
GETIN	GET1		/INIT GETSW TO POINT TO FIRST CHAR ACTION
/
/  INDIVIDULA CHARACTER ACTION
/
GETQ	JMS	GETSW	/AFTER 5TH CHAR, POINT BACK TO FIRST
/
GET1	ISZ	TEMP1	/OUT OF PAIRS?
	SKP		/SKIP IF NOT
	JMP	UCLP04	/ASCII, RESET LINE POINTERS ON RUNOUT
	LAC*	X12	/FIRST WORD OF PAIR
	LMQ		/INTO MQ FOR SHIFTING
	LLS	7
	JMS	GETSW	/DONE, LEAVE POINTER FOR SECOND CHAR
GET2	LLS	7	/SECOND CHAR
	JMS	GETSW	/LEAVING POINTER FOR THIRD
GET3	LLS	4	/THE HALF-AND-HALF CHAR
	DAC	GETSW	/VERY TEMPORARY
	LAC*	X12	/CAN'T END IN MIDDLE OF PAIR
	LMQ		/SECOND WORD TO SHIFTER
	LAC	GETSW	/BRING BACK FIRST
	LLS	3	/COMPLETE CHAR
	JMS	GETSW	/LEAVING POINTER TO FOURTH ACTION
GET4	LLS	7
	JMS	GETSW	/LEAVING FOR 5
GET5	LLS	7
	JMP	GETQ	/BACK TO TOP FOR POINTER TO 1
/
/
/
/  CHARACTER PUTTER FOR PDP-11
/
/  TWO CHAR'S PER WORD FORMAT. FIRST CHAR IS RIGHT JUSTIFIED, SECOND
/  IS PLACED IMMEDIATELY ABOVE FIRST, LEAVING TOP TWO BITS OF WORD
/  UNUSED. CHAR IS DELEVERD TO US IN AC. INIT PUTSW BY DAC'ING CONTENTS
/  OF PUTIN INTO IT. ROUTINE COUNTS THE OUTPUT CHARS IN PUTCH
/
PUTCH	0
	AND	(377	/EIGHT BITS REMAIN
	ISZ	FIRST	/DON'T SEND A LEADING LF, PDP-11 PUTS ONE IN
	JMP	.+3	/NOT FIRST TIME, SKIP TEST
	SAD	(12	/IS IT A LINE FEED
	JMP*	PUTCH	/YUP, DO NOTHING
	ISZ	LBF	/COUNT AN OUTPUT CHAR
	JMP*	PUTSW	/GO DO FIRST OR SECOND CHAR
PUTSW	0		/INIT'ED AS PUT1. FILLED LATER BY JMS PUTSW
	JMP*	PUTCH	/DONE, RETURN
/
PUTIN	PUT1		/START AT FIRST CHAR
/
PUTQ	JMS	PUTSW	/LEAVE POINTER FOR FIRST AFTER SECOND
PUT1	DAC*	PUTP	/FIRST CHARACTER ACTION, PLACE RIGHT JUSTIFIED
	JMS	PUTSW	/LEAVING POINTER FOR SECOND
/
PUT2	CLL!SWHA	/PUT CHAR IN RIGHT PLACE
	RAR
	XOR*	PUTP	/PUT HALVES TOGETHER
	DAC*	PUTP	/BOTH IN BUFFER
	ISZ	PUTP	/MOVE POINTER
	LAC	PUTP	/OUT OF BUFFER CHECK IF POINTER POINTS TO SELF
	SAD	(PUTP
	JMP	UCLP04	/OUT OF SPACE!
	JMP	PUTQ	/GO TELL PUTSW  THAT PUT1 IS NEX5T
/
/  RESETL 
/
/    THIS ROUTINE RESETS THE POINTERS TO THE BEGINNING OF  A LINE
/
RESETL	0
	LAW	-10	/8 SPACES PER TAB
	DAC	TABC	/THE PDP-11 DOESN'T KNOW ABOUT TABS
	DZM	BLANKC	/ZERO COUNT OF CONSECUTIVE BLANKS
	LAC	LINLIM	/NUMBER OF CHARACTERS PER LINE
	DAC	MAXC
	JMP*	RESETL
/
/
FIRST	0		/INIT TO -1 TO SHOW FIRST CHAR.
LINLIM	-LINLEN		/COUNTER FOR MAX CHAR'S PER LINE
MAXC	0		/DO ISZ ON LINLIM COUNT HERE
TCHAR	0		/TEMPORARY FOR HOLDING CHAR
BLANKC	0		/COUNT OF CONSECUTIVE BLANKS
TABC	0		/MODULO 8 COUNT WHERE NEXT TAB GOES
STLA	0		/REMEMBER WHO IS DOING PRINT
/			/ASCII SKIPS, IMAGE DOESN'T
/
/
/  TCB FOR SENDING BUFFER TO PDP-11
/
TCB	APISLT*400+APILVL	/TELL PDP-11 WHERE TO SEND INTERRUPT
	DEVCOD			/PIREX DEVICE CODE
EV11	0			/EVENT VARAIBLE FROM PIREX
STADD	0
	LBF			/PERMANENT BUFFER ADDR
LPIOT	0			/NOT USED
STATUS	0			/NOT USED
/
/  TCB FOR STOP I/O TO LINE PRINTER DRIVER 
/
/
TCBK	0
	DEVCODE&177*400+200
EV11K	0
/
/  POINTERS TO TCB'S
/
TCBP	TCB
TCBKP	TCBK
/
/  LOCATIONS FOR UC15 VERSION
/
LPDON	0		/1 WHEN OPERATIONS FINISHED, OTHERWISE 0
POST	0		/1 WHEN WAITING FOR INTERRUPT, OTHERWISE 0
/
/
/
LPIU	0		/SUBROUTINE TO SEND TO PDP-11
	DZM	EV11	/CLEAR RETURN VARIABLE
	DZM	EV11K	/AND THE OTHER ONE, IN CASE IT USED
	SIOA		/SKIP IF PDP-11 CAN TAKE IT
	JMP	.-1	/NOPE
	LIOR		/AC POINTS TO INSTRUCTION LIST
	JMP*	LPIU	/THAT'S ALL
/
CLEAR	0		/CLEAR POST,LPDON,PIREX
	DZM	POST
	DZM	LPDON
	LAC	TCBKP	/TELL PIREX TO CLEAR
	JMS	LPIU	/PIREX REQ SENDER
	CAL	WFCLER	/WAIT FOR PIREX COMPLETION
	JMP*	CLEAR
/
/
WFCLER	20		/WAIT FOR PIREX TO SET EV FOR CLEAR DEVICE
	EV11K
/
/
	.ENDC
ERR30	LAW	-30
/
/  COMMON TERMINATION OF NON-PRINTING REQUESTS
/
SEV	JMS	SEVRN	/SET EVENT VARIABLE, DECALRE SIGNIFICANT
	JMP	PQ	/EVENT, RETURN NODE, PICK NEXT REQ.
/
/
/  SECTION FOR PDP-15 PRINTERS
/
	.IFUND	UC15
/
/
/ LINE FEED & PRINT SINGLE LINE
/
LFPSL	LAC	MI	/SET MODE INDICATOR IN HEADER (UNPACKING
	DAC	LBF+0	/HARDWARE IGNORES HIGH ORDER HEADER HALFWORD
			/WHEN PRINTING IN SINGLE LINE MODE).
/
	LAC	(LFL)	/PRINT LINEFEED LINE
	JMS	PRNT
	LPP1
/
	LAC	(LBF)	/PRINT REQUESTED LINE
	JMS	PRNT
	LPP1
/
	JMP	PQ	/PICK NEXT REQUEST
/
LFL	002003	/LINEFEED LINE
	000000
	000012
/
/ PRINT TWO LINES
/
PTL	LAC	(002002)/ALTER HEADER TO INDICATE TWO 
	DAC	LBF+0	/ASCII "LINES".
/
	LAC	(LBF)	/PRINT BOTH "LINES"
	JMS	PRNT
	LPPM
/
	JMP	PQ	/PICK NEXT REQUEST
/
/
/
/ PRNT -- SUBROUTINE TO PRINT A LINE.  THE LINE BUFFER ADDRESS IS
/ IN AC, AND THE IOT TO PRINT IS IN THE LOCATION FOLLOWING THE JMS.
/
PRNT	0
	DZM	PRNTEF	/CLEAR ERROR FLAG
	AAC	-1	/DETERMINE & SAVE CURRENT ADDRESS
	DAC	CABF
PRNT1	DAC*	(CAA)	/SET CURRENT ADDRESS
	DZM*	(WCA)	/PREVENT WORD COUNT OVERFLOW
	XCT*	PRNT	/EXECUTE PRINT IOT, CLEAR EVENT VARIABLE,
	DZM	EV	/ENABLE LP INTERRUPT, AND WAIT FOR THE EVENT
	LPEI		/VARIABLE TO BE SET NON-ZERO BY THE INTERRUPT
	JMS	WFAB	/SERVICE ROUTINE.
/
	LAC	EV	/INTERRUPT HAS OCCURRED -- EXAMINE PRINTER STATUS.
	AND	(200000)	/ALARM ERR OR LP OFF LINE?
	SNA
	JMP	PRNTXT	/NO -- EXIT PRNT SUBROUTINE
	LAC	PRNTEF	/NEW ERROR?
	SZA
	JMP	PRNT2	/NO -- DELAY AND RETRY
	CAL	TEMCPB	/YES -- TYPE ERR MESSAGE
	JMS	WFAB
	CLA!IAC
	DAC	PRNTEF
/
PRNT2	CAL	MTCPB	/DELAY
	JMS	WFAB
	LAC	CABF	/RETRY
	JMP	PRNT1
/
PRNTXT	ISZ	PRNT	/EXIT PRNT SUBROUTINE
	JMP*	PRNT
/
PRNTEF	0
/
/
/ WFAB -- SUBROUTINE TO WAIT FOR EVENT VARIABLE TO BE SET AND THEN TO
/ CHECK THE TRIGGER EVENT VARIABLE TO SEE IF AN ABORT REQUEST SHOULD
/ BE PROCESSED.
/
WFAB	0
	CAL	WFECPB	/WAITFOR EV TO BE SET.
	LAC	TG	/IS BIT 2 OF THE TRIGGER SET?
	RTL
	SMA
	JMP*	WFAB	/NO -- RETURN
/
/ DE-QUEUE THE ABORT REQUEST.
/
	DZM	TG
	LAC	PDVNA	/PHYSICAL DEVICE NODE ADR
	DAC*	(R1)
	JMS*	(DQRQ)	/(R1, R2, R4, R5, XR & AC ARE ALTERED).
			/WAS A REQUEST FOUND?
	JMP*	WFAB	/NO -- SHOULD NEVER RETURN HERE.
	DAC	RN	/YES -- SAVE NODE ADR
	DAC*	(R2)
	LAC	PDVNA	/PHYSICAL DEVICE NODE ADR
	DAC*	(R1)
	JMS*	(DMTQ)	/DETACH LUN & DEVICE, IF NECESSARY, AND THEN
			/EMPTY THE REQUEST QUEUE OF ALL I/O REQUESTS
			/MADE BY THE TASK BEING ABORTED. (R1, R2, R3,
			/R5, R6, X10, X11, X12, XR & AC ARE ALTERED).
	JMS	SEVRN	/SET REQUESTER'S ('IORD'S') EV, DECRE-
			/MENT THE I/O PENDING COUNT, AND RETURN NODE TO POOL.
	JMP*	WFAB
/
	.ENDC
/
/ SEVRN -- SUBROUTINE TO SET THE REQUESTOR'S EVENT VARIABLE TO
/ THE QUANTITY IN AC, DECLARE A SIGNIFICANT EVENT, DECREMENT I/O
/ TRANSFERS PENDING COUNT (NORMAL MODE), AND RETURN REQUEST NODE
/ TO THE POOL.
/
SEVRN	0
	PAL		/SAVE EV VALUE
	LAC	RN	/REQUEST NODE ADR
	TAD	XADJ
	PAX
	LAC	6,X	/REQUESTER'S EV
	SNA
	JMP	NOSET	/NONE SPECIFIED
	TAD	XADJ
	PAX
	PLA
	DAC	0,X	/SET EV
/
NOSET	LAC	RN	/DECLARE I/O REQUEST COMPLETED (DECREMENT
	DAC*	(R2)	/TRANSFERS PENDING COUNT).
	JMS*	(IOCD)	/(R5, XR, & AC ARE ALTERED)
/
	LAC	(401000)/DECLARE A SIGNIFICANT EVENT
	ISA
/
	LAC	(POOL)	/RETURN REQUEST NODE TO POOL
	DAC*	(R1)
			/(R2 IS ALREADY SETUP)
	JMS*	(NADD)
/
	JMP*	SEVRN	/EXIT 'SEVRN' SUBROUTINE
/
/ EXIT REQUEST (FROM TASK "...REA")
/
DAEX	LAC	(POOL)	/RETURN REQUEST NODE TO POOL
	DAC*	(R1)
	LAC	RN
	DAC*	(R2)
	JMS*	(NADD)
/
/  PDP15 TURN OFF LINE PRINTER
/
	.IFUND UC15
	LPDI		/DISABLE LP INTERRUPTS
	CAL	DCPB	/DISSCCCONNECT
	.ENDC
/
/  PDP-11 TURN OFF LINE PRINTER
/
	.IFDEF UC15
/
	JMS	CLEAR	/CLEAR OUT DEVICE IN PIREX
	ISZ	CCPB	/MAKE CONNECT A DISCONNECT
	CAL	CCPB	/AND DISCONNECT
/
	.ENDC
/
/
	ISZ	PDVTA	/CLEAR ASSIGN INHIBIT FLAG IN PDVL NODE
	.INH
	DZM*	PDVTA
	.ENB
	CAL	(10)	/EXIT
/
/ INTERRUPT SERVICE ROUTINE
/
INT	0		/INTERRUPT ENTRY POINT
	DBA		/ENTER INDEX (PAGE) MODE
	DAC	ACBF	/SAVE AC
/
/  PDP-15 LINE PRINTER INTERRUPT SECTION
/
	.IFUND UC15
	LPRS		/READ STATUS AND SET IN EVENT VARIABLE
	DAC	EV
	LPCS		/CLEAR STATUS, ERR FLAG, & DONE FLAG
	LPCD
/
	.ENDC
/
/  PDP-11 LINE PRINTER INTERRUPT SECTION
/
	.IFDEF UC15
/
	CAPI		/CLEAR OUT FLAG SET BY PIREX
	LAC	POST	/WANTED OR NOT
	SNA		/SKIP IF YES
	JMP	INT11	/NOT WANTED, JUST GET OUT
	DAC	TG
	DAC	LPDON
/
	.ENDC
/
	LAC	(401000)/DECLARE A SIGNIFICANT EVENT
	ISA
INT11	LAC	ACBF	/RESTORE AC
	DBR		/RETURN TO INTERRUPTED PROGRAM
	JMP*	INT
/
XADJ	0	/XR ADJUST CONSTANT TO SUBTRACT PAGE BITS
ACBF	0	/AC BUFFER
CABF	0	/INITIAL CURRENT ADDRESS BUFFER
EV	0	/EVENT VARIABLE
MI	0	/MODE INDICATOR
RN	0	/ADDRESS OF REQUEST NODE PICKED FROM QUEUE
TG	0	/TRIGGER EVENT VARIABLE
/
PDVNA	0	/PHYSICAL DEVICE NODE ADDRESS
PDVTA	0	/ADDRESS OF ADR OF TRIGGER EV IN PHY DEV NODE
/
TEMP1	0
/
WFTCPB	20		/WAIT FOR TRIGGER
	TG
CCPB	11	/CONNECT CPB
	EV
	16
	INT
/
	.IFUND	UC15
/
/  LEAVE SOME OUT FOR UC15 TO SAVE SPACE
/
DCPB	12	/DISCONNECT CPB
	0
	16
	INT
/
MTCPB	13	/MARK TIME CPB
	EV
	12
	1
/
/
WFECPB	20	/WAIT FOR EVENT VARIABLE CPB
	EV
/
TEMCPB	2700	/TYPE ERR MESSAGE
	EV
	LUN
	2
	ERRMES
/
ERRMES	004002; 000000; .ASCII "*** LP NOT READY"<15>
/
	.ENDC
/
/
	.END	START
