Google
 

Trailing-Edge - PDP-10 Archives - AP-4178E-RM - swskit-sources/lpksdv.mac
There are 20 other files named lpksdv.mac in the archive. Click here to see a list.
;<3A.MONITOR>LPKSDV.MAC.75, 22-Jun-78 20:08:41, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.74,  3-May-78 15:36:12, Edit by MCLEAN
;FIX FOR LINEPRINTER NOT THERE
;<3.SM10-RELEASE-3>LPKSDV.MAC.73,  3-Apr-78 13:01:33, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.72,  2-Apr-78 15:49:25, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.71,  2-Apr-78 13:39:47, Edit by MCLEAN
;FIX FLUSH TO CAUSE INTERRUPT AFTER INIT SO LPT WON'T HANG
;<3.SM10-RELEASE-3>LPKSDV.MAC.70, 22-Mar-78 20:36:49, Edit by MCLEAN
;FIX FESFLO TO  ENABLE INTERRUPT AFTER RESET
;<3.SM10-RELEASE-3>LPKSDV.MAC.69, 15-Mar-78 18:15:19, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.68, 14-Mar-78 23:48:45, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.67, 11-Mar-78 23:37:09, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.66, 11-Mar-78 23:35:52, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.65, 11-Mar-78 22:42:17, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.64, 11-Mar-78 21:58:29, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.63, 11-Mar-78 20:53:48, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.62,  5-Mar-78 14:10:41, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.61,  3-Mar-78 14:21:54, Edit by MCLEAN
;FIX SHUFFL ROUTINE
;<3.SM10-RELEASE-3>LPKSDV.MAC.60, 16-Feb-78 13:12:57, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.59, 15-Feb-78 23:47:39, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.58, 15-Feb-78 23:45:23, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.57, 15-Feb-78 20:44:43, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.56, 14-Feb-78 15:35:07, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.55, 13-Feb-78 23:40:32, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.54, 13-Feb-78 00:10:19, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.53, 13-Feb-78 00:06:28, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.52, 12-Feb-78 23:29:08, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.51, 12-Feb-78 23:07:32, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.50, 10-Feb-78 16:46:43, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.49, 10-Feb-78 16:36:28, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.48, 10-Feb-78 16:34:31, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.47, 10-Feb-78 16:33:01, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.46, 10-Feb-78 00:45:38, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.45,  9-Feb-78 18:46:56, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.44,  9-Feb-78 18:03:55, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.43,  9-Feb-78 17:17:37, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.42,  9-Feb-78 16:33:06, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.41,  9-Feb-78 00:02:19, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.40,  8-Feb-78 23:43:45, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.39,  8-Feb-78 23:33:29, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.38,  8-Feb-78 23:32:01, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.37,  8-Feb-78 23:30:07, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.36,  8-Feb-78 23:24:14, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.35,  8-Feb-78 23:16:55, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.20,  8-Feb-78 23:06:08, Edit by MCLEAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.19,  8-Feb-78 23:04:18, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.33,  8-Feb-78 22:49:51, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.32,  8-Feb-78 22:15:29, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.31,  8-Feb-78 22:12:04, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.30,  8-Feb-78 22:05:07, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.29,  8-Feb-78 21:51:53, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.28,  8-Feb-78 21:50:16, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.27,  8-Feb-78 20:35:40, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.26,  8-Feb-78 20:18:39, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.25,  8-Feb-78 17:13:08, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.24,  8-Feb-78 17:08:59, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.23,  8-Feb-78 14:48:27, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.22,  7-Feb-78 16:55:28, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.21,  7-Feb-78 16:50:27, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.20,  7-Feb-78 16:28:00, Edit by MCLEAN
;<1MCLEAN>LPKSDV.MAC.19,  7-Feb-78 15:21:05, Edit by MCLEAN
;ADD INTERRUPT ENABLE CHECK AND OTHER GOODIES
;<3.SM10-RELEASE-3>LPKSDV.MAC.18, 25-Jan-78 16:09:48, EDIT BY OSMAN
;DON'T SET LOCAL INIT EVERY TIME A BUFFER IS SENT (WAS CAUSING TABS TO GET SCREWED UP)
;<3.SM10-RELEASE-3>LPKSDV.MAC.17,  5-Dec-77 20:08:23, EDIT BY OSMAN
;USE UNIBUS NUMBER "LPTUBN" INSTEAD OF 0
;<3.SM10-RELEASE-3>LPKSDV.MAC.16, 11-Nov-77 14:09:41, EDIT BY OSMAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.15, 10-Nov-77 22:02:47, EDIT BY OSMAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.14, 10-Nov-77 21:47:36, EDIT BY OSMAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.13, 10-Nov-77 18:41:38, EDIT BY OSMAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.12, 10-Nov-77 18:01:22, EDIT BY OSMAN
;MAKE INITIALIZATION CHECK FOR EXISTENCE OF LP'S, AND MAKE WORK ROUTINES FAIL IF CALLED FOR NONX LP
;<3.SM10-RELEASE-3>LPKSDV.MAC.11, 10-Nov-77 00:26:02, Edit by MCLEAN
;USE PROKS SYMBOLS FOR EXTERNAL PAGE AND INTERRUPT VECTOR
;<3.SM10-RELEASE-3>LPKSDV.MAC.10,  1-Nov-77 11:09:46, EDIT BY OSMAN
;DON'T CALL OURTLS ON EVERY CONTROL CHARACTER
;<3.SM10-RELEASE-3>LPKSDV.MAC.9, 25-Oct-77 13:23:07, EDIT BY OSMAN
;IN OURTLS, USE RDIO INSTEAD OF RDIOB.  IN LPINT+6, USE TIOE INSTEAD OF TION
;<3.SM10-RELEASE-3>LPKSDV.MAC.8, 21-Oct-77 14:23:58, EDIT BY OSMAN
;REMOVE ALL REFERENCES TO P1,P2,P3,P4 (CHANGE THEM TO Q2,Q3)
;<3.SM10-RELEASE-3>LPKSDV.MAC.7, 21-Oct-77 14:14:09, EDIT BY OSMAN
;REMOVE %P1% KLUDGE
;DOING ERROR RESET SETS DONE, SO BE CAREFUL!
;<3.SM10-RELEASE-3>LPKSDV.MAC.5, 20-Oct-77 22:49:59, EDIT BY OSMAN
;TRY TO MAKE OFF-LINE/ON-LINE CONTINUE PRINTER
;<3.SM10-RELEASE-3>LPKSDV.MAC.4, 20-Oct-77 13:42:53, EDIT BY OSMAN
;USE 600000 BITS OF PDP-11 ADDRESS FOR BUS A17 AND BUS A16 WHEN SETTING "GO"
;<3.SM10-RELEASE-3>LPKSDV.MAC.2, 18-Oct-77 16:02:54, EDIT BY OSMAN
;<3.SM10-RELEASE-3>LPKSDV.MAC.1, 18-Oct-77 15:47:47, EDIT BY OSMAN
;IF LINEPRINTER COMES ON-LINE, GET IT ROLLING AGAIN
;<3-MONITOR>LPKSDV.MAC.25, 12-Oct-77 15:22:10, EDIT BY OSMAN
;CALL OURTLS WHEN SNDEOF REQUESTED
;<3-MONITOR>LPKSDV.MAC.24, 12-Oct-77 13:56:29, EDIT BY KIRSCHEN
;UPDATE COPYRIGHT FOR RELEASE 3
;<3-MONITOR>LPKSDV.MAC.23, 11-Oct-77 10:41:02, EDIT BY OSMAN
;IT'S CALLED SAVBCT, NOT SAVCNT!
;<3-MONITOR>LPKSDV.MAC.22, 11-Oct-77 10:33:32, EDIT BY OSMAN
;IN INITIALIZATION, SET INTERRUPT ENABLE.
;PUT IN FESACK ROUTINE.
;<3-MONITOR>LPKSDV.MAC.21, 11-Oct-77 10:15:40, EDIT BY OSMAN
;MAKE CONTROL CHARACTERS WORK, AND PUT IN "FLUSH" ROUTINE TO STOP OUTPUT
;<3-MONITOR>LPKSDV.MAC.20,  6-Oct-77 13:30:27, EDIT BY OSMAN
;REMEMBER TO RESTORE BUFFER CHARACTER BEFORE RESUMING ORIGINAL PRINT JOB
;<3-MONITOR>LPKSDV.MAC.19,  6-Oct-77 13:16:30, EDIT BY OSMAN
;ALSO, SET UP LPBSAD WHEN PRINTING CONTROL CHARACTER
;SAVE BUFFER CHARACTER BEFORE PUTTING UPARROW - CHARACTER IN BUFFER
;<3-MONITOR>LPKSDV.MAC.18,  5-Oct-77 16:47:12, EDIT BY OSMAN
;WITHIN LPCINT:, USE "DPB" INSTEAD OF "DBP"!
;<3-MONITOR>LPKSDV.MAC.17,  4-Oct-77 16:34:30, EDIT BY OSMAN
;FORGOT NOCINT:
;<3-MONITOR>LPKSDV.MAC.16,  4-Oct-77 15:59:56, EDIT BY OSMAN
;PUT IN CODE TO TYPE CONTROL CHARS AS UP-ARROW CHAR
;<3-MONITOR>LPKSDV.MAC.15,  3-Oct-77 18:00:13, EDIT BY OSMAN
;CHANGE LPCCTR REF TO LPBCTR, USE RDIO INSTEAD OF MOVE, ONLY CHECK 12 BITS OF COUNTER
;<3-MONITOR>LPKSDV.MAC.14,  3-Oct-77 15:49:25, EDIT BY OSMAN
;MAKE OURTLS SET .DVFEF IF PRINTER IS DONE PRINTING WHAT IT'S BEEN SENT
;<3-MONITOR>LPKSDV.MAC.13,  3-Oct-77 09:26:14, EDIT BY OSMAN
;MAKE FESNDS SET LARGE PAGE COUNTER IF PGENB IS 0
;MAKE STATUS ERROR BIT COME ON IF PRINTER INTERRUPTS ON PAGE-COUNTER-REACHED-0
;<3-MONITOR>LPKSDV.MAC.12,  2-Oct-77 16:44:43, EDIT BY OSMAN
;CALL LODDON IN FESDTA INSTEAD OF LPINT (AS DTEQ WOULD!)
;<3-MONITOR>LPKSDV.MAC.11,  2-Oct-77 05:02:04, EDIT BY OSMAN
;MAKE FESNDS CALL LPTINT
;GET RID OF .DVOIR, AND REFER TO LP1PER INSTEAD OF LP1DPE
;FLUSH THE SETONE LPTBL IN FESNDS.  (ARNIE, YOU WERE WRONG!)
;<3-MONITOR>LPKSDV.MAC.10, 30-Sep-77 05:46:19, EDIT BY OSMAN
;DIVIDE BYTE COUNT BY 2 IN "CHANGE" TO GET CORRECT WORD COUNT, SET
;LOAD-VFU BIT WHEN LOADING RAM (REAL LOGICAL, AIN'T IT!), BEFORE
;PRINTING DATA, SET ERROR-RESET AND LOCAL INIT, MAKE FESNDS AND DESLOP
;SKIP.
;<3-MONITOR>LPKSDV.MAC.9, 29-Sep-77 23:48:18, EDIT BY OSMAN
;PASS VFU/RAM DATA TO "CHANGE" VIA 16-BIT BYTE POINTER
;USE XWD INSTEAD OF IOWD, BECAUSE LINK DOESN'T FIX UP LEFT HALF OF IOWD CORRECTLY!!!
;<3-MONITOR>LPKSDV.MAC.8, 28-Sep-77 14:43:32, EDIT BY OSMAN
;DON'T SHUFFLE RAM/VFU DATA LIKE PRINTER CHARACTERS, AND CLEAR ERROR BEFORE SENDING DATA TO PRINTER
;<3-MONITOR>LPKSDV.MAC.7, 27-Sep-77 17:11:20, EDIT BY OSMAN
;FIX GETLPA ( ADD => ADDI), FIX OURTLS ROUTINE
;<3-MONITOR>LPKSDV.MAC.6, 21-Sep-77 23:15:41, EDIT BY OSMAN
;P1 => U  (BUG AT ABOUT L2INI+5).  ALSO, @A => (A) TO AVOID POSSIBLE XADR PROBLEMS
;<3-MONITOR>LPKSDV.MAC.5, 19-Sep-77 16:03:31, EDIT BY OSMAN
;FIX TYPO (]] => ])
;<3-MONITOR>LPKSDV.MAC.4, 19-Sep-77 14:54:26, EDIT BY OSMAN
;PUT IN %P1% KLUDGE TO ALLOW US TO USE P1 WITHIN THIS MODULE ETC.
;<SM10-MONITOR>LPKSDV.MAC.27, 14-Sep-77 23:08:03, EDIT BY OSMAN
;REMOVE PRINTX'S, WHICH WERE NICE BUT DEPEND ON LPTN WHICH ISN'T DEFINED IN THIS CONTEXT
;<SM10-MONITOR>LPKSDV.MAC.26, 14-Sep-77 17:40:51, EDIT BY OSMAN
;<SM10-MONITOR>LPKSDV.MAC.25, 14-Sep-77 17:17:28, EDIT BY OSMAN
;<SM10-MONITOR>LPKSDV.MAC.24, 14-Sep-77 17:13:23, EDIT BY OSMAN
;<SM10-MONITOR>LPKSDV.MAC.23, 14-Sep-77 17:01:09, EDIT BY OSMAN
;<SM10-MONITOR>LPKSDV.MAC.21, 14-Sep-77 16:27:53, EDIT BY OSMAN
;<SM10-MONITOR>LPKSDV.MAC.20,  8-Sep-77 16:10:18, EDIT BY OSMAN
;<SM10-MONITOR>LPKSDV.MAC.19,  6-Sep-77 16:47:47, EDIT BY OSMAN
;<SM10-MONITOR>LPKSDV.MAC.18,  6-Sep-77 13:57:51, EDIT BY OSMAN
;<SM10-MONITOR>LPKSDV.MAC.17,  3-Sep-77 17:48:01, EDIT BY OSMAN
;<SM10-MONITOR>LPKSDV.MAC.16,  3-Sep-77 17:10:35, EDIT BY OSMAN
;PUT IN ALL SPECIFIC FUNCTION ROUTINES
;<SM10-MONITOR>LPKSDV.MAC.15,  3-Sep-77 16:42:11, EDIT BY OSMAN
;<SM10-MONITOR>LPKSDV.MAC.14,  3-Sep-77 14:14:03, EDIT BY OSMAN
;<SM10-MONITOR>LPKSDV.MAC.13,  3-Sep-77 11:24:41, EDIT BY OSMAN
;PUT IN SHUFFL ROUTINE
;<SM10-MONITOR>LPKSDV.MAC.12,  2-Sep-77 15:07:06, EDIT BY OSMAN
;<SM10-MONITOR>LPKSDV.MAC.11,  2-Sep-77 14:29:47, EDIT BY OSMAN
;START ADDING LINEPRINTER REGISTER DEFINITIONS
;<SM10-MONITOR>LPKS10.MAC.1,  1-Aug-77 16:38:02, EDIT BY OSMAN
;CREATE KS10 LINEPRINTER DEVICE-DEPENDENT MODULE

;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1977 BY DIGITAL EQUIPMENT CORPORATION

; DEVICE DEPENDENT CODE FOR THE LINE PRINTER
; (LP20  SERVICE) SPECIFIC CODE.

;DEFSTRS NEEDED WITHIN

DEFSTR (LPXBTS,L11A,19,2)	;PDP-11 TWO EXTENDED ADDRESSING BITS

; LINE PRINTER DEVICE DISPATCH TABLE

FELPVT:	IFIW!FESFLO		;SEND FLUSH
	IFIW!FESLOP		;PAGE COUNTER
	IFIW!FESACK		;ACK
	IFIW!FESDTA		;SEND DATA
	IFIW!FESEOF		;EOF
	IFIW!FESNDS		;STRING DATA
	IFIW!OURTLS		;SEND STATUS
	IFIW!LP20RS		;RESTART
	IFIW!LP20IN		;INITALIZE
	IFIW!LP20IE		;CHECK INTERRUPT ENABLE
   IFN <.-FELPMX>-FELPVT,<PRINTX %%INVALID DEVICE DEPENDENT TABLE SIZE>

;TABLE OF -11 HARDWARE ADDRESSES OF THE LINEPRINTER CONTROLLER REGISTERS
;LCRTAB+N SHOWS THE ADDRESS FOR THE DATA BASE FOR LINEPRINTER N.

LCRTAB:	LP11CA

;PARALLEL TABLE OF -11 INTERRUPT VECTOR ADDRESSES.  THAT IS, THE
;CONTENTS OF LPVTAB+N IS THE -11 ADDRESS WHICH WOULD CONTAIN THE
;ADDRESS OF THE INTERRUPT ROUTINE FOR LINEPRINTER N, IF WE WERE
;AN -11.

LPVTAB:	LP11IV

;TABLE OF ADDRESSES OF INTERRUPT ROUTINES, ONE FOR EVERY LINEPRINTER.

LPINTB:	LP0INT
;INITIALIZATION ROUTINE.

LP20IN:	MOVEI U,LPTN
LP20I1:	SOJL U,R		;RETURN IF ALL LP'S INITIALIZED
	SKIPE PROFLG		;IF PROFLG DON'T INITALIZE
	CALL L2INI		;INITIALIZE A LINE PRINTER
	JRST LP20I1		;LOOP FOR ALL LP'S
	RET			;DONE

;ROUTINE TO INITIALIZE A LINE PRINTER.  IT EXPECTS U TO CONTAIN 0
;THROUGH N-1 WHERE THERE ARE N LINE PRINTERS ON THE SYSTEM.

L2INI:	MOVE A,LCRTAB(U)	;GET ADDRESS ON UNIBUS FOR THIS LP
	SETZRO LPXBIT,(U)	;ASSUME NONE
	CALL UBGOOD		;CHECK FOR EXISTANCE
	RET			;RETURN NO DEVICE
	SETONE LPXBIT,(U)	;SET DEVICE EXISTS
	MOVE A,U		;SEE WHICH LINE PRINTER WE'RE DOING
	LSH A,2			;MULTIPLY BY FOUR BECAUSE XPCW NEEDS FOUR WORDS
	ADDI A,LPXPTB		;POINT XPCW AT CORRECT PLACE
	SETZM 2(A)		;CLEAR FLAGS OUT OF WHERE XPCW WILL POINT TO
	MOVE B,LPINTB(U)	;GET INTERRUPT ROUTINE ADDRESS FOR THIS LP
	MOVEM B,3(A)		;STORE IT FOR XPCW TO TRANSFER TO ON INTERRUPT
	HRLI A,(XPCW)		;MAKE THE XPCW INSTRUCTION
	MOVE B,SMTEPT+LPTUBN	;GET ADDRESS OF XPCW TABLE
	MOVE C,LPVTAB(U)	;GET -11 ADDRESS THAT HOLDS LP INTERRUPT ROUTINE ADDRESS
	LSH C,-2		;DIVIDE BY 4 TO GET OFFSET INTO XPCW TABLE
	ADD B,C			;GET ADDRESS WHERE XPCW SHOULD GO
	MOVEM A,(B)		;STORE THE XPCW
	MOVEI A,LPTUBN		;UNIBUS ADAPTOR NUMBER
	MOVEI B,1		;WE NEED ONE -11 PAGE
	CALL ALUBWA		;GET IT
	BUG(HLT,NLWA,<L2INI:  No lineprinter window available>)
	MOVEM A,LPWINA(U)	;SAVE ADDRESS OF UBA
	MOVEM B,L11A(U)		;REMEMBER -11 ADDRESS WE GOT
LP20RS:	CALL GETLPA		;GET ADDRESS OF THIS LINEPRINTER'S BUFFER
	MOVE C,A
	MOVE B,L11A(U)		;GET BUFFER ADDRESS
	LSH C,-9		;MAKE PAGE NUMBER
	TXO C,UNBD18+UNBVBT	;DISABLE 18-BIT TRANSFERS, SAY VALID TRANSFER
	WRIO C,@LPWINA(U)	;ASSOCIATE -10 PAGE WITH FAKE -11 PAGE
	CALL LPTRUE		;MAKE SURE PRINTER EXISTS
	 RET			;DON'T REFERENCE NONEXISTENT HARDWARE!
	move B,LCRTAB(U)	;GET BASE ADDRESS FOR REGISTERS
	MOVX A,LP1RSE+LP1INT	;SET ERROR RESET AND INITIALIZE
	WRIOB A,LPCSRA+1(B)
	MOVX A,LP1IEN		;INTERRUPT ENABLE BIT
	WRIOB A,LPCSRA(B)	;MAKE SURE INTERRUPTS ARE ENABLED
	RET


;ROUTINE TO CALL WITH U SET UP, WHICH SKIPS IFF LINEPRINTER EXISTS,
;AS DETERMINED DURING SYSTEM STARTUP

LPTRUE:	LOAD A,LPXBIT,(U)	;GET EXISTENCE BIT FOR THIS LP
	JUMPE A,R		;NON-SKIP IF NONX LINEPRINTER
	RETSKP			;SKIP IF EXISTENT PRINTER

;LINEPRINTER INTERRUPT ROUTINES.  

LP0INT:	MOVEM P,LPACS+P		;SAVE CALLER'S P
	MOVEI P,LPACS		;SAVE ACS
	BLT P,LPACS+16
	MOVE P,[XWD -LPSLEN,LPSTAK-1]	;GET STACK POINTER FOR LP INTERRUPT ROUTINE
	MOVEI U,0		;IDENTIFY WHICH PRINTER INTERRUPTED
;	JRST LPINT		;JOIN COMMON INTERRUPT ROUTINE

;COMMON INTERRUPT ROUTINE FOR LINEPRINTERS.  IT ASSUMES U CONTAINS UNIT
;OF LINEPRINTER THAT INTERRUPTED, THAT P IS SET UP, AND THAT THE ACS
;FROM BEFORE THE INTERRUPT ARE SAVED

LPINT:	LOAD A,LPTCC,(U)	;GET CHARACTER COUNT
	JUMPE A,LPINTA
	SETZRO LPTCC,(U)	;ZERO INTERRUPT CHARACTER COUNT
	MOVE B,U		;GET UNIT NUMBER FOR LPTINT
	CALL LPTINT		;NOTIFY INTERRUPT ROUTINE
LPINTA:	MOVE A,U		;GET UNIT NUMBER
	LSH A,2			;GET OFFSET INTO XPCW DATA TABLE
	ADD A,[XJEN LPXPTB]	;MAKE APPROPRIATE XJEN INSTRUCTION FOR DISMISSING INTERRUPT
	MOVEM A,LPXJEN		;REMEMBER THE INSTRUCTION FOR LATER
	MOVE Q2,LCRTAB(U)	;GET -11 ADDRESS OF THIS LP'S REGISTERS
	MOVX A,LPWCI+LPWDON	;CHARACTER INTERRUPT + DONE FLAG
	TIOE A,LPCSRA(Q2)	;SKIP IF NOT DONE OR CHARACTER INTERRUPT
	JRST PDJCOL		;PRINTER DIDN'T JUST COME ONLINE IF 
				;DONE IS SET OR THERE'S AN UNDEFINED CHARACTER INTERRUPT
	MOVX A,7777		;BYTE COUNTER IS 12 BITS WIDE
	MOVX B,LP1OFL+LP1DVN+LP1PER+LP1MPE+LP1RPE+LP1SYE+LP1DME+LP1GOE	;CAN'T USE LP1ERR
				;BECAUSE IT STICKS AFTER ERROR IS REMEDIED
	TIOEB B,LPCSRB(Q2)	; WAS THERE SORT OF ERROR?
	JRST [	MOVEI B,LP1OFL+LP1DVN+LP1PER+LP1MPE+LP1RPE+LP1SYE+LP1DME	;GO ERROR? OR REAL ERROR?
		TIOE B,LPCSRB(Q2)
		JRST NOCINT	;NOPE DO ERROR LOGGING
		JRST LPGO1]	;YES JUST RESTART THE DAMN THING THIS APPEARS TO BE EXTRANEOUS ERROR
	TIOE A,LPBCTR(Q2)	;SKIP IF BYTE COUNT IS 0
	JRST LPGO		;NO ERROR AND BYTE COUNT NON-0, GO RESTART PRINTER
PDJCOL:	LOAD A,ARROWF,(U)	;SEE IF DOING CTRL CHAR
	JUMPN A,FINCTL		;YES, PREPARE TO GO BACK TO ORIG BUFF
	MOVX A,LPWCI		;BIT WE WANT TO TEST
	TIOE A,LPCSRA(Q2)	;DID WE JUST GET A CHARACTER INTERRUPT?
	JRST LPCINT		;YES, GO HANDLE IT
NOCINT:	CALL OURTLS		;GET STATUS OF THIS LINEPRINTER
	MOVX A,LP1DON		;SEE IF LINEPRINTER DONE PRINTING
	MOVE B,U		;LPTINT EXPECTS UNIT NUMBER IN B
	TIOEB A,LPCSRA(Q2)	;TEST DONE FLAG
	JRST [	SETZRO LPTFE,(U) ;ZERO COUNT OF CHARACTERS
		JE LPTBL,(U),LPXIT
		SETZRO LPTBL,(U)
		MOVEI 1,0	;FAKE INTERRUPT RESTART
		CALL LPTINT
		JRST LPXIT]
;	JRST LPXIT		;DISMISS INTERRUPT

;LINEPRINTER INTERRUPT EXIT ROUTINE.  RESTORES AC'S AS BEFORE INTERRUPT
;AND DISMISSES INTERRUPT...

LPXIT:	MOVSI 17,LPACS		;MAKE BLT POINTER
	BLT 17,17		;RESTORE AC'S
	XCT LPXJEN		;RETURN TO CALLER


;GET HERE ON CHARACTER INTERRUPT

LPCINT:	RDIOB A,LPRAMD(Q2)	;GET RAM DATA FOR THIS INTERRUPT
	CAIE A,"^"		;IS THIS INTERRUPT FOR A CONTROL CHARACTER 
				;DESIRING TO BE MADE "UPARROW-CHARACTER"
	JRST NOCINT		;NO, HANDLE THIS CONDITION AS ANY OTHER ERROR
	RDIO A,LPBCTR(Q2)	;GET BYTE COUNTER SO FAR FOR THIS PRINTER
	STOR A,SAVBCT,(U)	;REMEMBER IT FOR LATER TO CONTINUE PRINTER
	RDIO A,LPBSAD(Q2)	;GET BUS ADDRESS
	STOR A,SAVBUS,(U)	;REMEMBER IT TOO
	MOVE A,L11A(U)		;GET -11 ADDRESS OF LPT DATA BUFFER
	WRIO A,LPBSAD(Q2)	;TELL LP20 WHERE DATA IS
	MOVEI A,1
	STOR A,ARROWF,(U)	;MARK THAT WE'RE DOING ARROWS
				;GET THE UP-ARROW FOR THE CONTROL CHAR
	CALL GETLPA		;GET BUFFER ADDRESS
	MOVEI B,"^"		;WHAT YOU MEAN "WE", KIMO SABE?
	DPB B,[POINT 8,(A),17]	;PUT THE ^ IN THE BUFFER
	LDB C,[POINT 8,(A),9]	;GET CHARACTER THAT HASN'T BEEN PRINTED YET
	STOR C,SAVCHR,(U)	;SAVE IT BECAUSE WE NEED THE BUFFER SPACE
	RDIOB B,LPCBUF(Q2)	;GET CONTROL CHARACTER
	TRO B,100		;MAKE IT A PRINTING CHARACTER
	ANDI B,177		;AND OFF GARBAGE BITS
	DPB B,[POINT 10,(A),9]	;MAKE ^ CHARACTER IN BUFFER & CLR B0/B1
	MOVNI A,2		;GET NEG OF # OF CHARS
	WRIO A,LPBCTR(Q2)	;SET UP BYTE COUNT TO 2
LPGO1:	CALL SETGOA
	JRST LPXIT		;DON'T SEND STATUS FOR EACH CONTROL CHARACTER

LPGO:	CALL SETGOA		;START THE LP
	CALL OURTLS		;ALWAYS REPORT STATUS AFTER RESTARTING PRINTER
	JRST LPXIT		;WAIT FOR TWO CHARS TO PRINT

;GET HERE TO FINISH INTERRUPTED BUFFER

FINCTL:	MOVEI A,0
	STOR A,ARROWF,(U)	;SAY NOT DOING CTRL CHAR
	LOAD A,SAVBCT,(U)
	JUMPE A,NOCINT		;QUIT IF THIS WAS THE LAST CHARACTER
	WRIO A,LPBCTR(Q2)	;RESTORE ORIG BYTE COUNTER
	LOAD A,SAVBUS,(U)
	WRIO A,LPBSAD(Q2)	;RESTORE ORIG BUS ADDRESS
	CALL GETLPA		;GET BUFFER ADDRESS
	LOAD B,SAVCHR,(U)	;GET SAVED BUFFER CHARACTER
	DPB B,[POINT 8,(A),9]	;RESTORE BUFFER CHARACTER
	JRST LPGO1		;START PRINTER AGAIN
; ROUTINE TO SEND A FLUSH 
;THIS CAUSES LINEPRINTER TO IMMEDIATELY STOP PRINTING

FESFLO:	CALL LPTRUE		;MAKE SURE PRINTER EXISTS
	 RET			;DOESN'T!
	MOVE B,LCRTAB(U)	;GET REGISTER FOR THIS LP
	MOVEI A,LPWINT+LP1IEN	;SET INTERRUPT ENABLE
	WRIO A,(B)		;AND STOP DEVICE WITH LOCAL INIT
	MOVEI A,LP1IEN+LP1GO	;SET IENERRUPT ENABLE
	WRIO A,(B)
	SETZRO LPTFE,(U)	;ZERO COUNT OF BYTES IN FE
	RET			;RETURN
;SET page counter
;SKIPS IFF SUCCESFUL

FESLOP:	CALL LPTRUE		;DOES LINEPRINTER EXIST?
	 RET			;NO, GIVE FAILURE RETURN
	LOAD A,PGCTR,(U)	;GET VALUE TO BE SET
	MOVE B,LCRTAB(U)	;GET BASE REGISTER
	WRIO A,LPPCTR(B)	;SET THE PAGE COUNTER
	RETSKP			;DONE

; ROUTINE TO SEND AN ACK
;THIS IS CALLED TO GET THE PRINTER ROLLING AGAIN AFTER IT HAS
;STOPPED DUE TO SOME ERROR.

FESACK:	CALL LPTRUE		;MAKE SURE PRINTER EXISTS
	 RET			;DOESN'T
	MOVE B,LCRTAB(U)	;GET REGISTER FOR THIS LP
	MOVEI A,0
	WRIO A,LPPCTR(B)	;CLEAR PAGE COUNTER IN CASE THERE WAS A PAGE COUNTER INTERRUPT
	RDIO A,LPBCTR(B)	;SEE HOW MANY CHARACTERS LEFT IN BUFFER
	TXNE A,7777		;ANY CHARACTERS LEFT TO PRINT?
	CALL SETGO		;YES, SET THE GO FLAG
	RET			;RETURN
;ROUTINE TO LOAD VFU OR RAM DATA.  ACCEPTS:
;	B/	FUNCTION-CODE,,0	;.DFLVF => LOAD VFU
;					;.DFLTR => LOAD TRANSLATION RAM
;	D/	NUMBER OF 8-BIT BYTES


FESDTA:	STKVAR <LVFU,N8BB>
	SETOM LVFU		;FIRST ASSUME LOADING VFU
	CAMN B,[.DFLTR,,0]	;LOADING RAM??
	SETZM LVFU		;YES, SO NOT LOADING VFU!
	MOVEM D,N8BB		;REMEMBER NUMBER OF 8-BIT BYTES
	CALL LPTRUE
	 RET			;JUST RETURN IF PRINTER DOESN'T EXIST
	CALL GETLPA		;GET BUFFER ADDRESS FOR THIS LINEPRINTER
	MOVE B,LPTRLP(U)	;FIGURE OUT WHERE DATA TO BE LOADED IS
	OPSTR <SKIPN>,ALTP,(U)
	ADDI B,NLPBF
	HRLI B,(<POINT 16,0>)	;EACH BYTE IS 8+8 BITS
	MOVE C,N8BB		;LOAD UP NUMBER OF BYTES TO DIGEST
	CALL CHANGE		;REARRANGE DATA THE WAY IT WOULD BE IN AN -11
	MOVE B,U		;LODDON ROUTINE EXPECTS UNIT NUMBER IN B
	CALL LODDON		;TELL WORLD WE'VE RECEIVED THE DATA
	MOVE D,LCRTAB(U)	;GET BASE REGISTER FOR THIS LP
	MOVE A,L11A(U)		;GET LPT BUFFER ADDRESS
	WRIO A,LPBSAD(D)	;TELL PRINTER WHERE DATA IS
	MOVN A,N8BB		;GET NEGATIVE OF NUMBER OF BYTES
	WRIO A,LPBCTR(D)	;TELL PRINTER HOW MUCH DATA WE'RE SENDING
	MOVX B,LP1PEN+LP1DVU+LP1IEN+LP1GO	;PARITY ENABLE, LOAD VFU, INTERRUPT ENABLE
	SKIPN LVFU		;SKIP IF REALLY LOADING VFU
	MOVX B,LP1PEN+LP1TM+LP1DVU+LP1IEN+LP1GO	;PARITY, TEST MODE, LOAD DVU, INTERRUPT ENABLE
	CALL SETGOB		;START THE PRINTER
	RET			;DONE
FESEOF:	CALL OURTLS		;WHEN EOF REQUESTED, ASK FOR STATUS
	RET			;RETURN

;ROUTINE TO SEND DATA TO THE LINE PRINTER TO BE PRINTED.
;PASS IT COUNT IN F OF NUMBER OF BYTES
;THIS ROUTINE SKIPS IFF SUCCESSFUL

FESNDS:	STOR F,LPTCC,(U)	;SAVE COUNT OF CHARACTERS
	CALL LPTRUE
	 RET			;FAILURE RETURN IF PRINTER DOESN'T EXIST
	MOVE D,LCRTAB(U)	;GET -11 BASE ADDRESS FOR HARDWARE LP REGISTERS
	CALL GETLPA		;GET BUFFER ADDRESS FOR THIS PRINTER
	MOVE B,LPTCCW(U)	;GET POINTER TO DATA BEING SENT
	LOAD C,LPTCC,(U)	;GET NUMBER OF CHARACTERS BEING SENT
	CALL SHUFFL		;PUT BYTES IN -11 FORMAT
	MOVE D,LCRTAB(U)	;GET -11 BASE ADDRESS FOR HARDWARE LP REGISTERS
	MOVEI A,1000		;ARBITRARY LARGE NUMBER OF PAGES
	LOAD B,PGENB,(U)	;GET INFORMATION ABOUT PAGING
	CAIN B,0		;DOES USER WANT TO STOP AFTER CERTAIN NUMBER OF PAGES?
	WRIO A,LPPCTR(D)	;NO, SO PUT IN LARGE NUMBER SO PRINTER WON'T STOP
	MOVE A,L11A(U)		;GET -11 ADDRESS OF LPT DATA BUFFER
	WRIO A,LPBSAD(D)	;TELL LP20 WHERE DATA IS
	LOAD A,LPTCC,(U)	;GET NUMBER OF BYTES BEING SENT
	MOVNS A			;NEGATE IT
	WRIO A,LPBCTR(D)	;TELL LP20 HOW MANY
	CALL SETGO		;START THE PRINTER
	LOAD A,LPTCC,(U)	;SET NUMBER OF CHARACTERS SENT
	RETSKP			;ALL DONE

;ROUTINE TO START THE PRINTER.

SETGO:	MOVX B,LP1IEN+LP1GO	;INTERRUPT ENABLE + GO
SETGOB:	LOAD A,LPXBTS,(U)	;GET PDP-11 EXTENDED ADDRESS BITS
	STOR A,LP1A17+LP1A16,B	;SET HIGH ORDER ADDRESS BITS IN WORD BEING WRITTEN TO PRINTER
	MOVE A,LCRTAB(U)	;GET REGISTER ADDRESS FOR THIS PRINTER
	WRIOB B,LPCSRA(A)	;START THE PRINTER
	RET

SETGOA:	CALL CLRERR		;CLEAR ALL ERRORS
	MOVX B,LP1IEN+LP1GO	;SET GO
	MOVE A,LCRTAB(U)	;GET DEVICE ADDRESS
	BSIOB B,LPCSRA(A)	;START DEVICE
	RET			;RETURN

;ROUTINE TO CALL BEFORE SENDING DATA TO PRINTER.  IT DOES THE
;APPROPRIATE ERROR CLEARING.

CLRERR:	MOVX A,LPWERR	;GET BIT BEING TESTED
	MOVX B,LPWRSE+LP1IEN	;GET BIT BEING SET
	MOVE D,LCRTAB(U)	;GET REGISTER FOR THIS PRINTER
	TION A,LPCSRA(D)	;SKIP IF ERROR
	RET			;NO ERROR, SO JUST RETURN
	WRIO B,LPCSRA(D)	;THERE'S AN ERROR, SO CLEAR IT
	MOVX B,LP1IEN		;RESET INTERRUPT ENABLE
	WRIO B,LPCSRA(D)
	RDIO A,