Google
 

Trailing-Edge - PDP-10 Archives - AP-4178E-RM - swskit-sources/linepr.mac
There are 52 other files named linepr.mac in the archive. Click here to see a list.
;<3.SM10-RELEASE-3>LINEPR.MAC.19, 11-Mar-78 21:29:36, Edit by MCLEAN
;RACE CONDITION FOR KS10 WITH LPSHA IN LPTNOP
;<3.SM10-RELEASE-3>LINEPR.MAC.2, 27-Feb-78 17:54:28, Edit by MCLEAN
;<3.SM10-RELEASE-3>LINEPR.MAC.17, 12-Feb-78 23:31:10, Edit by MCLEAN
;<3.SM10-RELEASE-3>LINEPR.MAC.16, 12-Feb-78 23:00:52, Edit by MCLEAN
;ADD LPTCC
;<1MCLEAN>LINEPR.MAC.15,  9-Feb-78 17:57:29, Edit by MCLEAN
;<1MCLEAN>LINEPR.MAC.14,  9-Feb-78 16:36:32, Edit by MCLEAN
;<1MCLEAN>LINEPR.MAC.13,  9-Feb-78 16:34:46, Edit by MCLEAN
;<1MCLEAN>LINEPR.MAC.12,  8-Feb-78 23:20:24, Edit by MCLEAN
;<1MCLEAN>LINEPR.MAC.11,  8-Feb-78 16:51:44, Edit by MCLEAN
;<1MCLEAN>LINEPR.MAC.10,  8-Feb-78 16:09:13, Edit by MCLEAN
;<3.SM10-RELEASE-3>LINEPR.MAC.9,  8-Feb-78 15:44:18, Edit by MCLEAN
;<3.SM10-RELEASE-3>LINEPR.MAC.8,  8-Feb-78 15:30:09, Edit by MCLEAN
;<1MCLEAN>LINEPR.MAC.8,  7-Feb-78 15:34:19, Edit by MCLEAN
;ADD INTRRUPT ENABLE CHECK FOR KS10 AND ADD RESTART CODE
;<3.SM10-RELEASE-3>LINEPR.MAC.7,  9-Dec-77 10:09:55, EDIT BY MILLER
;REMOVE EXTN ON LPTCHR
;<3.SM10-RELEASE-3>LINEPR.MAC.6,  5-Dec-77 21:28:44, EDIT BY OSMAN
;REDEFINE SAVCHR SO IT DOESN'T OVERLAP LPXBIT!!
;<3.SM10-RELEASE-3>LINEPR.MAC.5, 10-Nov-77 22:01:34, EDIT BY OSMAN
;<3.SM10-RELEASE-3>LINEPR.MAC.4, 10-Nov-77 21:53:55, EDIT BY OSMAN
;DEFINE LPXBIT
;<3.SM10-RELEASE-3>LINEPR.MAC.3, 25-Oct-77 11:23:12, EDIT BY MURPHY
;<3.SM10-RELEASE-3>LINEPR.MAC.2, 21-Oct-77 17:16:37, EDIT BY MURPHY
;SEARCH PROKL OR PROKS DEPENDING ON KLFLG, SMFLG
;<3.SM10-RELEASE-3>LINEPR.MAC.1, 18-Oct-77 14:50:45, EDIT BY OSMAN
;IN LPLD15, USE (U) INSTEAD OF (A) ON SETZRO LPLHC,(A)
;<3-MONITOR>LINEPR.MAC.174, 12-Oct-77 13:54:34, EDIT BY KIRSCHEN
;UPDATE COPYRIGHT FOR RELEASE 3
;<3-MONITOR>LINEPR.MAC.173,  6-Oct-77 13:21:16, EDIT BY OSMAN
;ADD LPTST3
;ADD SAVCHR DEFSTR
;<3-MONITOR>LINEPR.MAC.172,  4-Oct-77 16:37:29, EDIT BY OSMAN
;PUT LPTST2 IN EXTN CALL
;<3-MONITOR>LINEPR.MAC.171,  4-Oct-77 16:19:00, EDIT BY OSMAN
;ADD DEFSTRS FOR LPTST2
;<3-MONITOR>LINEPR.MAC.170, 26-Sep-77 15:57:25, EDIT BY OSMAN
;ADD KSLPTN TO EXTERNALS
;<3-MONITOR>LINEPR.MAC.169, 26-Sep-77 15:32:55, EDIT BY OSMAN
;PUT INITIALIZATION LOOP IN FOR KS LINEPRINTERS
;<3-MONITOR>LINEPR.MAC.168, 24-Sep-77 00:18:21, EDIT BY OSMAN
;MOVE CALL TO SYSTEM-DEPENDENT LPT INITIALIZATION OUT OF PER LPT LOOP
;<3-MONITOR>LINEPR.MAC.167, 21-Sep-77 23:17:16, EDIT BY OSMAN
;CALL SYSTEM-DEPENDENT LPT INITIALIZATION FROM LPTINI.
;<3-MONITOR>LINEPR.MAC.166, 17-Aug-77 14:45:49, EDIT BY HURLEY
;<3-MONITOR>LINEPR.MAC.165, 29-Jun-77 08:22:15, EDIT BY MILLER
;DON'T GIVE ERRORS ON -11 RELOAD UNLESS IT IS THE MASTER
;<3-MONITOR>LINEPR.MAC.164, 10-May-77 15:48:44, EDIT BY HURLEY
;<3-MONITOR>LINEP1.MAC.163, 10-May-77 14:03:22, EDIT BY HURLEY
;<3-MONITOR>LINEP1.MAC.162, 10-May-77 14:00:30, EDIT BY HURLEY
;FIX UP TITLES FOR THE VARIOUS ASSEMBLIES
;<3-MONITOR>LINEP1.MAC.161,  6-May-77 11:50:47, EDIT BY HURLEY
;ADD SET INPUT/OUTPUT AND ATTRIBUTE CHECK ENTRIES IN DISPATCH TABLE
;<3-MONITOR>LINEP1.MAC.160,  4-May-77 22:52:47, Edit by MCLEAN
;ADD FELPMX TO CHECK FOR VECTOR SIZE
;<3-MONITOR>LINEP1.MAC.159,  2-May-77 20:34:53, EDIT BY BOSACK
;<3-MONITOR>LINEP1.MAC.158, 30-Apr-77 23:11:43, Edit by MCLEAN
;FIX LPTCHK TO JUST RETURN IF NO UNITS
;<3-MONITOR>LINEP1.MAC.157, 29-Apr-77 16:12:34, EDIT BY MILLER
;DON'T DO LPINI IF NOT DOING PRIMARY PROTOCOL
;<3-MONITOR>LINEP1.MAC.156, 28-Apr-77 17:51:08, EDIT BY MILLER
;MORE ERROR RECOVERY
;<3-MONITOR>LINEP1.MAC.155, 28-Apr-77 13:12:45, EDIT BY MILLER
;MORE ERROR HANDLING FIXES
;<3-MONITOR>LINEP1.MAC.154, 26-Apr-77 11:35:34, EDIT BY MILLER
;FIX ERROR HANDLING TO AVOID HUNG LPT
;<3-MONITOR>LINEP1.MAC.153, 13-Mar-77 02:29:30, Edit by MCLEAN
;<3-MONITOR>LINEP1.MAC.152, 12-Mar-77 20:23:26, Edit by MCLEAN
;<3-MONITOR>LINEP1.MAC.151, 12-Mar-77 13:30:48, Edit by MCLEAN
;BREAK INTO TWO MODULES FOR DEVICE INDEPENDENCE
;<3-MONITOR>LINEP1.MAC.149, 28-Feb-77 22:01:50, Edit by MCLEAN
;FIX COMMENT ALIGNMENTS I BROKE
;<3-MONITOR>LINEP1.MAC.148, 15-Jan-77 17:12:02, Edit by MCLEAN
;<3-MONITOR>LINEP1.MAC.147, 11-Jan-77 15:46:43, Edit by MCLEAN
;<3-MONITOR>LINEP1.MAC.146, 11-Jan-77 15:37:38, Edit by MCLEAN
;<3-MONITOR>LINEP1.MAC.145, 27-Dec-76 17:33:47, EDIT BY HURLEY
;<2-MONITOR>LINEP1.MAC.144, 24-Nov-76 15:43:13, EDIT BY KIRSCHEN
;TCO 1668 - ONLY RESET BUFFER POINTERS ON VFU RELOAD IF DATA WAS LOST
;<2-MONITOR>LINEP1.MAC.143,  9-Nov-76 09:08:32, EDIT BY MILLER
;REINITIALIZE BUFFER POINTERS,COUNTS ON HARD ERROR IN LPTNOP
;<2-MONITOR>LINEP1.MAC.142,  8-Nov-76 13:34:05, EDIT BY MILLER
;CHANGE SCHED TEST IN NOOP TO WAKE UP ON ERROR
;<2-MONITOR>LINEP1.MAC.141, 28-Oct-76 16:00:20, EDIT BY MILLER
;ONE MORE FIX TO LPTNOP
;<2-MONITOR>LINEP1.MAC.140, 27-Oct-76 14:54:47, EDIT BY MILLER
;FIX LPTNOP CODE TO HANDLE ERRORS CORRECTLY
;<2-MONITOR>LINEP1.MAC.139, 26-Oct-76 10:25:32, EDIT BY MILLER
;FIX BUFFER SCREW-UP ON -11 RELOAD
;<2-MONITOR>LINEP1.MAC.138, 21-Oct-76 10:31:22, EDIT BY MILLER
;TCO 1611. REDUCE RESIDENT MONITOR SIZE
;<2-MONITOR>LINEP1.MAC.137, 16-Oct-76 13:42:20, EDIT BY MILLER
;FIX LPTEOF
;<2-MONITOR>LINEP1.MAC.136, 16-Oct-76 11:42:58, EDIT BY MILLER
;ASK FOR EOF IN LPTCLZ
;<2-MONITOR>LINEP1.MAC.135, 16-Oct-76 10:42:20, EDIT BY MILLER
;MORE LPTSQO FIXES
;<2-MONITOR>LINEP1.MAC.134, 16-Oct-76 10:22:12, EDIT BY MILLER
;MAKE LPTSQO CONTINUE EOF WAIT IF LPOBF IS UP
;<2-MONITOR>LINEP1.MAC.133, 15-Oct-76 16:01:46, EDIT BY MILLER
;MAKE INIFIL CLEAR LPOBF
;<2-MONITOR>LINEP1.MAC.132, 15-Oct-76 13:24:51, EDIT BY HURLEY
;<2-MONITOR>LINEP1.MAC.131, 14-Oct-76 19:22:10, EDIT BY HURLEY
;TCO 1598 - ADD OF%OFL BIT TO OPENF
;<2-MONITOR>LINEP1.MAC.130, 29-Sep-76 14:47:26, EDIT BY KIRSCHEN
;TCO 1553 - DO NOT CLEAR LP%RLD BEFORE PROCESS RECEIVES THE ERROR
;<2-MONITOR>LINEP1.MAC.129, 20-Sep-76 14:21:42, EDIT BY MILLER
;MAKE SURE NAME OF VFU FILE IS STORED
;<2-MONITOR>LINEP1.MAC.128, 16-Aug-76 11:22:06, EDIT BY KIRSCHEN
;TCO 1494 - SET MO%RLD WHEN FRONT END HAS BEEN RELOADED
;<2-MONITOR>LINEP1.MAC.127,  3-Aug-76 22:14:08, Edit by HESS
;<2-MONITOR>LINEP1.MAC.126,  3-Aug-76 20:33:12, EDIT BY HURLEY
;CHANGED THE CALLING SEQUENCE OF IGTDAL
;<HESS>LINEP1.MAC.4, 29-Jul-76 13:32:45, Edit by HESS
;TCO 1478 - QUOTA CHECKING
;<2-MONITOR>LINEP1.MAC.14, 23-Jun-76 09:06:39, EDIT BY KIRSCHEN
;<2-MONITOR>LINEP1.MAC.13, 22-Jun-76 15:42:42, EDIT BY KIRSCHEN
;<2-MONITOR>LINEP1.MAC.12, 22-Jun-76 13:41:47, EDIT BY KIRSCHEN
;TCO 1451 - FIX .MONOP BUG
;<2-MONITOR>LINEP1.MAC.11, 21-Jun-76 17:26:08, EDIT BY MILLER
;MANUAL 1B EDITS
;<2-MONITOR>LINEP1.MAC.10, 17-Jun-76 12:18:54, EDIT BY MILLER
;REMOVE SJFN. ADD MLJFN
;<1B-MONITOR>LINEP1.MAC.118, 24-MAY-76 11:16:42, EDIT BY KIRSCHEN
;<1B-MONITOR>LINEP1.MAC.117, 24-MAY-76 09:22:50, EDIT BY KIRSCHEN
;<1B-MONITOR>LINEP1.MAC.116, 24-MAY-76 09:09:34, EDIT BY KIRSCHEN
;TCO 1308 - ALWAYS SAVE NAME OF RAM/VFU FILE ON THE LPINI
;<2-MONITOR>LINEP1.MAC.6, 14-MAY-76 07:48:56, EDIT BY MILLER
;TCO 1288 AGAIN. CHECK FOR HARD ERROR AT LPTCL2
;<2-MONITOR>LINEP1.MAC.5, 13-MAY-76 15:52:50, EDIT BY KIRSCHEN
;TCO 1290 - IGNORE VFU ERRORS FROM PRINTERS WITH OPTICAL VFU'S
;<2-MONITOR>LINEP1.MAC.3, 12-MAY-76 10:25:43, EDIT BY MILLER
;TCO 1288. FIX LPTCLZ TO WAIT FOR ACK FROM -11
;<2-MONITOR>LINEP1.MAC.2, 11-MAY-76 11:39:46, EDIT BY MILLER
;GET STRUCTURE NUMBER FROM JFN BLOCK BEFORE CALL TO ASOFN
;<2-MONITOR>LINEP1.MAC.1, 18-APR-76 18:13:26, EDIT BY MILLER
;<1B-MONITOR>LINEP1.MAC.6, 13-APR-76 11:08:01, EDIT BY KIRSCHEN
;TCO 1248 - PREVENT OPENS IF NEVER GOING TO USE PRIMARY PROTOCOL
;<1B-MONITOR>LINEP1.MAC.5, 13-APR-76 09:26:04, EDIT BY KIRSCHEN
;TCO 1247 - USE FILBYN CORRECTLY
;<1B-MONITOR>LINEP1.MAC.4,  9-APR-76 10:31:56, EDIT BY KIRSCHEN
;<1B-MONITOR>LINEP1.MAC.3,  8-APR-76 14:33:06, EDIT BY KIRSCHEN
;<1B-MONITOR>LINEP1.MAC.2,  8-APR-76 11:32:46, EDIT BY KIRSCHEN
;<1B-MONITOR>LINEP1.MAC.1,  8-APR-76 11:17:01, EDIT BY KIRSCHEN
;TCO 1243 - ADD CODE TO HANDLE 8-BIT BYTESIZE
;<1A-MONITOR>LINEP1.MAC.111,  5-APR-76 12:39:50, EDIT BY MILLER
;<1A-MONITOR>LINEP1.MAC.110,  5-APR-76 12:28:01, EDIT BY MILLER
;<1A-MONITOR>LINEP1.MAC.109,  5-APR-76 11:27:05, EDIT BY KIRSCHEN
;REQUEST PSI INTERRUPTS IN LPTCHK, INSTEAD OF LPTTLS
;<1A-MONITOR>LINEP1.MAC.108,  2-APR-76 16:26:44, EDIT BY MILLER
;<1A-MONITOR>LINEP1.MAC.107,  2-APR-76 08:12:11, EDIT BY MILLER
;<1A-MONITOR>LINEP1.MAC.106,  1-APR-76 17:43:40, EDIT BY MILLER
;<1A-MONITOR>LINEP1.MAC.105,  1-APR-76 11:22:04, EDIT BY MILLER
;<1A-MONITOR>LINEP1.MAC.104,  1-APR-76 10:21:12, EDIT BY MILLER
;<1A-MONITOR>LINEP1.MAC.103,  1-APR-76 09:29:38, EDIT BY KIRSCHEN
;<1A-MONITOR>LINEP1.MAC.102, 31-MAR-76 21:13:29, EDIT BY MILLER
;<1A-MONITOR>LINEP1.MAC.101, 31-MAR-76 10:05:10, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.100, 27-MAR-76 08:22:09, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.99, 26-MAR-76 18:48:21, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.98, 26-MAR-76 18:42:32, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.97, 26-MAR-76 15:38:03, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.96, 26-MAR-76 15:14:44, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.95, 26-MAR-76 15:07:30, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.94, 26-MAR-76 10:20:43, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.93, 26-MAR-76 10:00:03, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.92, 25-MAR-76 18:59:50, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.91, 25-MAR-76 10:24:29, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.90, 23-MAR-76 18:15:52, EDIT BY HURLEY
;<1MONITOR>LINEP1.MAC.89, 23-MAR-76 17:21:03, EDIT BY HURLEY
;<1MONITOR>LINEP1.MAC.88, 23-MAR-76 17:06:30, EDIT BY HURLEY
;TCO 1216 - MAKE ALL UNSUPPORTED DISPATCH ENTRIES RETURN AN ERROR CODE
;<1MONITOR>LINEP1.MAC.87, 23-MAR-76 15:05:51, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.86, 23-MAR-76 14:54:18, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.85, 23-MAR-76 14:50:49, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.84, 23-MAR-76 14:39:46, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.83, 21-MAR-76 14:08:16, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.82, 19-MAR-76 15:47:06, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.81, 19-MAR-76 13:28:51, EDIT BY MILLER
;TCO 1196. FIX GLPTST
;<1MONITOR>LINEP1.MAC.80, 19-MAR-76 09:53:01, EDIT BY KIRSCHEN
;TCO 1194 - ALLOW PROGRAMS TO SUPPRESS "PROBLEM ON DEVICE" MESSAGES
;<1MONITOR>LINEP1.MAC.79, 16-MAR-76 13:14:13, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.78, 12-MAR-76 13:05:04, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.77, 10-MAR-76 11:49:40, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.76, 10-MAR-76 11:12:36, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.75, 10-MAR-76 11:08:29, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.74, 10-MAR-76 11:05:20, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.73,  9-MAR-76 20:20:27, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.72,  9-MAR-76 19:58:18, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.71,  9-MAR-76 19:30:02, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.70,  9-MAR-76 14:30:40, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.69,  9-MAR-76 11:18:32, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.68,  9-MAR-76 11:16:03, EDIT BY KIRSCHEN
;ADD LPMWS, LPRBR AND REMOVE MDISMS'S.  FIX OTHER BUGS.
;<1MONITOR>LINEP1.MAC.67,  9-MAR-76 08:54:53, EDIT BY KIRSCHEN
;FIX TEST OF CZ%ABT; ADD LPTRLD ROUTINE FOR -11 RELOADS
;<1MONITOR>LINEP1.MAC.66,  8-MAR-76 12:39:07, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.65,  8-MAR-76 12:36:15, EDIT BY KIRSCHEN
;ADD CHECK FOR OFF-LINE IN VFU/RAM LOADING ROUTINE. ERROR IF OFF-LINE
;<1MONITOR>LINEP1.MAC.64,  8-MAR-76 09:40:02, EDIT BY KIRSCHEN
;CHANGE LPTFLO TO SNDFLO, FLUSH -10 SIDE ALSO.
;<1MONITOR>LINEP1.MAC.63,  5-MAR-76 17:04:55, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.62,  5-MAR-76 16:19:50, EDIT BY KIRSCHEN
;CHECK CAPABILITIES IN LPINI.  ALSO CHECK FOR UNIT ALREADY OPEN
;<1MONITOR>LINEP1.MAC.61,  4-MAR-76 19:38:37, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.60,  4-MAR-76 15:06:50, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.59,  4-MAR-76 15:05:42, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.58,  4-MAR-76 13:56:07, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.57,  4-MAR-76 13:45:09, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.56,  4-MAR-76 09:39:47, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.55,  4-MAR-76 09:13:57, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.54,  4-MAR-76 08:55:37, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.53,  3-MAR-76 22:59:15, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.52,  3-MAR-76 22:50:06, EDIT BY SAMBERG
;<1MONITOR>LINEP1.MAC.51,  3-MAR-76 16:04:14, EDIT BY KIRSCHEN
;<1MONITOR>LINEP1.MAC.50,  3-MAR-76 13:32:36, EDIT BY KIRSCHEN
;ADD .MONOP CODE
;<1MONITOR>LINEP1.MAC.49,  3-MAR-76 11:04:42, EDIT BY KIRSCHEN
;ADD -11 RELOAD ROUTINE
;<1MONITOR>LINEP1.MAC.48,  3-MAR-76 09:12:55, EDIT BY MILLER
;<1MONITOR>LINEP1.MAC.47,  2-MAR-76 19:10:26, EDIT BY MILLER
;<1KIRSCHEN>LINEP1.MAC.2,  6-FEB-76 17:10:51, EDIT BY KIRSCHEN
; ADD DISPATCH TABLE FOR MTOPR, LPLVF & LPLTR IN LPTSTS
;<2MONITOR>LINEP1.MAC.40, 16-JAN-76 17:50:12, EDIT BY MURPHY
;<2MONITOR>LINEP1.MAC.39, 23-DEC-75 12:50:38, EDIT BY LEWINE
;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

	SEARCH PROLOG

   IFN KLFLG,<
	TTITLE LINEPRINTER
	SEARCH PROKL
>
   IFN SMFLG,<
	TTITLE LINEPRINTER,LINPSM
	SEARCH PROKS
	SEARCH PROKL		;*********** THIS SHOULD BE REMOVED SOMETIME *********
	SEARCH SERCOD
>


;LOCAL STORAGE DECLARED IN STG.MAC

EXTN <FELPTN,KSLPTN,LPFLSZ,LPTRLP,LPTTIM,LPTTYP,LPTICT>
EXTN <NLPBF,LPTSTS,LPTST1,LPTST2,LPTST3,LPTCNT,LPTBUF>
EXTN <LPTCLS,LPTCCW,LPTCKT,LPTLCK,LPTERR>
EXTN <LPTOFN,PGDATA>

MAXLPT==2			;MAXIMUM NUMBER LPTS
MAXLPA==NLPBF*5			;DEFAULT LINE ALLOCATION
INIPSI==77			;PSI CHANNEL FIELD IF NO ENABLE HAS BEEN DONE
JSBITS==<FLD(.JSAOF,JS%DEV)+FLD(.JSAOF,JS%DIR)+FLD(.JSAOF,JS%GEN)+FLD(.JSAOF,JS%NAM)+FLD(.JSAOF,JS%TYP)+JS%PAF>

;SPECIAL AC DEFINITIONS USED HEREIN

DEFAC (U,Q1)			;UNIT NUMBER
DEFAC (STS,P1)			;SEE GTJFN FOR FUNCTIONS
DEFAC (JFN,P2)
DEFAC (DEV,P4)

; Externally defined symbols


; Entries to this part

INTERN	LPTCHK			; Check routine
; Parameters and fixed core locations


;DEFINITIONS FOR DEVICE DEPENDENT DISPATCH TABLE

SNDFLO=0		;SEND FLUSH
SNDLDP=1		;SPECIAL DEVICE FUNCTION
SENACK=2		;ACK
SNDDAT=3		;SEND DATA
SNDEOF=4		;SEND EOF
SNDSTD=5		;SEND STRING DATA
GLPTST=6		;LINPRINTER TEST
SNDRST=7		;RESTART
SNDINI=10		;INITILIZATION
FEIEN==11		;INTERRUPT ENABLE CHECK
FELPMX==12		;MAX TABLE SIZE

;SYMBOLS AND DEFSTR'S FOR LPTSTS

DEFSTR (LPDEVT,LPTTYP,35,18)


LP%FE==7777B11			;BYTES NOW IN THE FE
LP%MX==7777B23			;MAX BYTES ALLOWED IN FE
LP%ALP==1B35			;BUFFER POINTER
LP%ALI==1B34			;INTERRUPT BUFFER POINTER
LP%OPN==1B33			;LPT IS OPENED
LP%THN==1B32			;LPT IS HUNG (LINE PR CONTROL FAILED)
LP%TWT==1B31			;REQUEST ON QUEUE
LP%TBL==1B30			;LPT IS BLOCKED (OVER LINE ALLOCATION)
LP%OL==1B29			;LPT IS ON LINE
LP%ER==1B28			;VFU HAD AN ERROR
LP%MWS==1B27			;MTOPR WAITING FOR STATUS TO ARRIVE
LP%OBF==1B26			;OUTPUT BEING FLUSHED (E.G., ON CLOSE OR .MONOP)
LP%HE==1B25			;LPT HAS A HARD ERROR
LP%LHC==1B24			;LOADING HAS COMPLETED FLAG

DEFSTR (LPTFE,LPTSTS,11,12)	;BYTES NOW IN THE FE
DEFSTR (LPTMX,LPTSTS,23,12)	;MAX BYTES ALLOWED IN FE
DEFSTR (ALTP,LPTSTS,35,1)	;BUFFER POINTER
DEFSTR (ALTI,LPTSTS,34,1)	;INTERRUPT BUFFER POINTER
DEFSTR (LPOPN,LPTSTS,33,1)	;LPT IS OPENED
DEFSTR (LPTHN,LPTSTS,32,1)	;LINE PR CONTROL FAILED
DEFSTR (LPTWT,LPTSTS,31,1)	;BIT INDICATING REQUEST ON Q
DEFSTR (LPTBL,LPTSTS,30,1)	;LPT IS OVER ALLOCATION
DEFSTR (LPTOL,LPTSTS,29,1)	;LPT ON-LINE BIT
DEFSTR (LPTER,LPTSTS,28,1)	;LPT HAD AN ERROR
DEFSTR (LPMWS,LPTSTS,27,1)	;MTOPR IS WAITING FOR A STATUS TO ARRIVE
DEFSTR (LPOBF,LPTSTS,26,1)	;OUTPUT IS BEING FLUSHED
DEFSTR (LPTHE,LPTSTS,25,1)	;HARD ERROR ON THIS LPT
DEFSTR (LPLHC,LPTSTS,24,1)	;LOADING-HAS-COMPLETED FLAG FOR RAM OR VFU LOADS

;SYMBOLS AND DEFSTRS FOR SECOND STATUS WORD

LP%SST==177777B35		;SOFTWARE STATUS WORD
LP%LCP==1B18			;LOWER CASE PRINTER
LP%SHA==1B19			;STATUS HAS ARRIVED
LP%PAG==7777B17			;PAGE COUNTER FIELD
LP%PSI==77B5			;PSI CHANNEL FOR PAGE CTR & ON-LINE INTERRUPTS

DEFSTR (LPSST,LPTST1,35,16)	;SOFTWARE STATUS WORD
DEFSTR (LPLCP,LPTST1,18,1)	;LOWER-CASE PRINTER
MSKSTR (LPSHA,LPTST1,LP%SHA)	;STATUS HAS ARRIVED
DEFSTR (LPPAG,LPTST1,17,12)	;PAGE COUNTER
DEFSTR (LPPSI,LPTST1,5,6)	;CHANNEL NUMBER ON WHICH PSI'S ARE DESIRED

;DEFSTRS FOR LPTST2

DEFSTR (ARROWF,LPTST2,0,1)	;SAYS WE'RE CONVERTING CONTROL TO ARROW CHARACTER
DEFSTR (SAVBCT,LPTST2,12,12)	;SAVED BYTE COUNTER DURING ARROW HACK
DEFSTR (SAVBUS,LPTST2,28,16)	;SAVED BUS ADDRESS REGISTER

;DEFSTRS FOR LPTST3

DEFSTR (LPTCC,LPTST3,35,12)	;COUNT OF CHARACTERS SENT TO PRINTER
DEFSTR (SAVCHR,LPTST3,8,8)	;SAVED LP BUFFER CHARACTER WHILE SOING CONTROL HACK
DEFSTR (LPXBIT,LPTST3,0,1)	;ON IFF PRINTER EXISTS (AS DETERMINED DURING INITIALIZATION) CAUTION:  ONLY FOR KS (10/10/77)
;DEFSTR FOR LPTERR WORD

LP%ERR==177777B35		;HARDWARE STATUS FIELD
LP%FRK==777777B17		;FORK ID OF OWNING PROCESS
LP%MSG==1B18			;SUPPRESS STANDARD MESSAGE
LP%PCI==1B19			;PAGE COUNTER HAS INTERRUPTED

DEFSTR (LPERR,LPTERR,35,16)	;LAST ERROR INDICATION
DEFSTR (LPFRK,LPTERR,17,18)	;FORK ID OF OWNING PSI PROCESS
DEFSTR (LPMSG,LPTERR,18,1)	;IF =1, SUPPRESS STANDARD MESSAGE
DEFSTR (LPPCI,LPTERR,19,1)	;PAGE COUNTER HAS INTERRUPTED

; DEFSTRS FOR LPTOFN WORD

DEFSTR (VFUOFN,LPTOFN,17,18)	;VFU OFN
DEFSTR (RAMOFN,LPTOFN,35,18)	;RAM OFN

.LRPAG==10			;BYTE OFFSET TO PAGE COUNTER REGISTER
LP%IRP==1B32			;INTERRUPT REQUEST PENDING
LP%RBR==1B33			;RAM (OR VFU) BEING RELOADED
LP%LTR==1B34			;RAM REQUIRES RELOADING
LP%LVF==1B35			;VFU REQUIRES RELOADING


DEFSTR (PGFNC,PGDATA,15,16)	;FUNCTION CODE - LOAD PAGE COUNTER
DEFSTR (PGENB,PGDATA,16,1)	;ENABLE INTERRUPTS BIT
DEFSTR (PGCTR,PGDATA,31,15)	;PAGE COUNTER VALUE
DEFSTR (LPLVF,PGDATA,35,1)	;VFU REQUIRES RELOADING
DEFSTR (LPLTR,PGDATA,34,1)	;TRANSLATION RAM REQUIRES RELOADING
DEFSTR (LPRBR,PGDATA,33,1)	;RAM (OR VFU) BEING RELOADED
DEFSTR (LPIRP,PGDATA,32,1)	;INTERRUPT REQUEST PENDING

; DEFSTRS FOR LPTCLS WORD

LP%BSZ==77B5			;BYTE SIZE OF OPENF
LP%NOE==1B17			;NOTE OCCURRENCE OF END-OF-FILE
LP%RLD==1B16			;FRONT END WAS RELOADED

MSKSTR (LPBSZ,LPTCLS,LP%BSZ)	;BYTE SIZE OF OPENF
MSKSTR (LPNOE,LPTCLS,LP%NOE)	;NOTE OCCURRENCE OF EOF
MSKSTR (LPRLD,LPTCLS,LP%RLD)	;FRONT END WAS RELOADED
	SWAPCD			; IS SWAPPABLE
LPTDTB::DTBBAD (DESX9)		; Set directory
	DTBBAD (DESX9)		; Name lookup
	DTBBAD (DESX9)		; Extension
	DTBBAD (DESX9)		; Version
	DTBBAD (DESX9)		;PROTECTION INSERTION
	DTBBAD (DESX9)		;ACCOUNT INSERTION
	DTBBAD (DESX9)		;STATUS INSERTION
	IFIW!LPTOPN
	DTBBAD (DESX9)
	IFIW!LPTSQO		; Output
	IFIW!LPTCLZ
	DTBBAD (DESX9)		; Rename
	DTBBAD (DESX9)		; Delete
	DTBBAD (DUMPX6)		; DUMPI
	DTBBAD (DUMPX6)		; DUMPO
	DTBBAD (DESX9)		; Mount
	DTBBAD (DESX9)		; Dismount
	DTBBAD (DESX9)		; Initialize directory
	IFIW!LPTMTO		; MTOPR
	IFIW!LPDSTS		; GET STATUS
	DTBBAD (DESX9)		; Set status
	DTBSKP			; RECORD OUT
	IFIW!RFTADN		; READ TAD
	IFIW!SFTADN		; SET TAD
	DTBDSP (BIOINP)		;SET JFN FOR INPUT
	DTBDSP (BIOOUT)		;SET JFN FOR OUTPUT
	DTBBAD (GJFX49)		;CHECK ATTRIBUTE

	DTBLEN==:.-LPTDTB	;GLOBAL LENGTH OF DISPATCH TABLE
; Initialize line printer

	RESCD

LPTINI::
	MOVEI U,FELPTN		;GET THE NUMBER OF FE LPT'S
	MOVEI B,FELPVT		;GET VECTOR TABLE ADDRESSES
FELPLP:	SOJL U,NXTLPT		;LEAVE LOOP IF NO MORE FE LPT'S
	STOR B,LPDEVT,(U)	;UPDATE UNIT NUMBER
	JRST FELPLP		;LOOP FOR REST OF FE LPT'S
NXTLPT:	MOVEI U,KSLPTN		;GET NUMBER OF LP20'S ON KS
	MOVEI B,FELPVT		;GET VECTOR TABLE NAME
KSLPIN:	SOJL U,NXTLP1		;LEAVE LOOP IF NO MORE
	STOR B,LPDEVT,(U)	;STORE VECTOR TABLE ADDRESS
	JRST KSLPIN		;LOOP FOR REST OF KS LP20'S
NXTLP1:	MOVEI U,0
	LOAD A,LPDEVT,(U)
	CALL @SNDINI(A)		;DO SYSTEM-DEPENDENT LINEPRINTER INITIALIZATION
	MOVSI U,-LPTN		;INIT ALL UNITS
LPI1:	MOVEI A,^D60000		;CHECK ALL UNITS ONCE A MINUTE
	ADD A,TODCLK		;FROM NOW
	MOVEM A,LPTCKT(U)	;LPTTIM INTERVAL
	SETZM LPTSTS(U)
	SETZM LPTST1(U)		;CLEAR SECOND STATUS WORD
	SETZM LPTERR(U)		;NO ERROR YET
	SETOM LPTOFN(U)		;INDICATE NO OFN'S FOR RAM, VFU FILES
	SETOM LPTCNT(U)
	SETOM LPTLCK(U)
	MOVEI C,MAXLPA		;DEFAULT LINE ALLOCATION
	STOR C,LPTMX,(U)	;DEFAULT LINE ALLOCATION
	MOVX C,INIPSI		;GET CODE INDICATING PSI NOT ENABLED
	STOR C,LPPSI,(U)	;MARK THAT PSI CHANNEL NOT DECLARED YET
	LOAD A,LPDEVT,(U)
	CALL @GLPTST(A)		;ASK FOR THE STATAS
	AOBJN U,LPI1
	RET

LPTRST::MOVSI U,-LPTN		;SET UP TO LOOP THRU LP'S
LPRST1:	LOAD A,LPDEVT,(U)	;GET TABLE ENTRY ADDRESS
	CALL @SNDRST(A)		;DO INIT
	AOBJN U,LPRST1		;LOOP UNTIL DONE
	RET			;RETURN
	SWAPCD

; Open line printer

LPTOPN:	SKIPN PROFLG		;EVER GOING TO USE PRIMARY PROTOCOL ?
	RETBAD (OPNX18)		;NO, DO NOT ALLOW ANY LPT OPEN'S
	HLRZ U,DEV		;GET UNIT NUMBER
	LOCK LPTLCK(U),<CALL LCKTST>
	JN LPOPN,(U),[	UNLOCK LPTLCK(U)
		MOVEI A,OPNX9
		RET]		;FAIL
	JE LPTOL,(U),[CALL CHKOFL ;SEE IF OPENF'S ALLOWED IF OFFLINE
		 SKIPA		;NO
		JRST .+1	;YES, LET THE OPENF PROCEDE
		UNLOCK LPTLCK(U) ;LPT IS OFFLINE
		MOVEI A,OPNX8	;TELL PROGRAM
		RET]		;AND DONE
	TQNE <WRTF>		;WANT WRITE?
	TQNE <READF>		;YES. AND NO READ?
	JRST [	UNLOCK LPTLCK(U) ;NO. CAN'T DO IT THAT WAY
		RETBAD (OPNX13)] ;BOMB IT
	SETONE LPOPN,(U)	;LPT IS NOW OPENED
	MOVE A,FORKX		;GET ID OF OPENER
	STOR A,LPFRK,(U)	;REMEMBER FOR SYSERR
	MOVX A,INIPSI		;GET FLAG INDICATING NO PSI ENABLED
	STOR A,LPPSI,(U)	;MARK THAT NO PSI IS ENABLED
	SETZB A,B		;SET TO 0, NO INTERRUPTS
	CALL LODPAG		;GO INITIALIZE THE PAGE COUNTER
	 JFCL			;SHOULD NOT FAIL
	SETZRO LPPCI,(U)	;INDICATE PAGE COUNTER HASN'T INTERRUPTED YET
	SETZRO LPTHE,(U)	;CLEAR HARD ERROR
	HRRZ A,LPTRLP(U)	;BUFFER ADDRESS
	MOVES (A)
	CALL FPTA		; Get ptn.pn for buffer
	CALL MLKPG		; Lock the RLP(U)	;BUFFER ADDRESS
	SETZRO LPNOE,(U)	;DO NOT NOTE OCCURRENCE OF EOF
	LDB A,PBYTSZ		;GET BYTE SIZE SPECIFIED ON OPENF
	STOR A,LPBSZ,(U)	;STORE BYTE SIZE OF OPENF
	CALL INIFIL		;GO SET UP ALL POINTERS
	SETZM FILBYN(JFN)	;INITIALIZE COUNT OF TOTAL BYTES OUTPUT
	UNLOCK LPTLCK(U)
	RETSKP
; ROUTINE TO INITIALIZE THE INTERRUPT COUNTS AND BUFFER FLAGS

INIFIL:	NOSKED			;TURN OFF SCHEDULER
	CHNOFF LPTCHN		;TURN OFF THE LP CHANNEL
	SETZRO <LPOBF,ALTP,ALTI>,(U) ;INTIALZIE POINTERS
	SKIPLE LPTICT(U)	;WORKING ON A BUFFER?
	SKIPGE LPTCNT(U)	;DOING ANY PRINTING?
	JRST INFL1		;NO. ALL DONE
	SETZM LPTCNT(U)		;YES. MAKE NEXT POST STOP THE OUTPUT
	SETONE ALTI,(U)		;INITIALIZE BUFFER POINTERS
INFL1:	SETZM LPTICT(U)		;ZERO INTERRUPT COUNT
	CHNON LPTCHN		;TURN ON LP CHANNEL
	OKSKED			;AND THE SCHEDULER
	CALLRET SETBUF		;AND GO INIT BUFFERS AS WELL


; ROUTINE TO SET UP JFN BLOCK POINTERS AND COUNTS


SETBUF:	HRRZ A,LPTRLP(U)	;GET BASE ADDRESS OF LPT BUFFERS
	OPSTR <SKIPE>,ALTP,(U)	;USING SECOND BUFFER FOR THIS UNIT ?
	ADDI A,NLPBF		;YES, GET ADDRESS OF SECOND BUFFER
	HRLI A,(POINT 7,)	;GET POINTER FOR 7-BIT BYTES
	LOAD B,LPBSZ,(U)	;GET BYTE SIZE FROM OPENF
	CAIN B,^D8		;USING 8-BIT BYTES ?
	HRLI A,(POINT 8,)	;YES, GET POINTER FOR 8-BIT BYTES
	MOVEM A,FILBYT(JFN)	;STORE POINTER TO CURRENT BUFFER
	MOVEI A,^D36		;GET NUMBER OF BITS PER WORD
	LOAD B,LPBSZ,(U)	;GET BYTE SIZE FROM OPENF
	CAIE B,^D8		;USING 8-BIT BYTES ?
	MOVEI B,7		;NO, ASSUME 7-BIT BYTES
	IDIV A,B		;COMPUTE # OF BYTES PER WORD
	IMULI A,NLPBF		;COMPUTE # OF BYTES PER BUFFER
	MOVEM A,FILCNT(JFN)	;STORE # OF BYTES PER BUFFER
	RET			;RETURN
; Close line printer

LPTCLZ:	HLRZ U,DEV		;GET UNIT NUMBER
	JN LPOBF,(U),LPTCL2	;IF BEING CLOSED, DON'T BLOCK
	TXNN A,CZ%ABT		;DOING AN ABORT CLOSE ?
	JRST [	CALL LPTEOF	;NO. SEND LAST BUFFER
		TQNE <ERRF>	;SERVICE ROUTINE FOUND AN ERROR?
		RET		;YES. RETURN NOW
		LOAD A,LPDEVT,(U)
		CALL @SNDEOF(A)	;GO ASK FOR EOF JUST IN CASE
		MOVSI A,0(U)	;NO. SET UP SCHEDULER TEST
		HRRI A,LPTDIS	;TO WAIT FOR BUFFERS AND ACK
		RET]		;AND DONE
	CALL LPTFLO		;YES. GO DO FLUSH
	 JFCL			;WILL GO
	JRST LPTCL3		;GO FORCE THE CLOSE

;NORMAL CLOSE. CHECK FOR ERROR

LPTCL2:	JN LPTHE,(U),[	SETZRO LPOBF,(U) ;NOT CLOSING ANYMORE
			JRST GIVERR] ;AND GIVE AN ERROR
LPTCL3:	LOCK LPTLCK(U),<CALL LCKTST> ;LOCK UP THIS LPT
	SETZM LPTCLS(U)		;CLEAR BYTE SIZE FROM OPENF
	SETOM LPTCNT(U)		;SET # OF BUFFERS TO ZERO
	SETZM LPTICT(U)		;NO BYTES TO SEND
	LOAD A,LPTOL,(U)	;GET ON-LINE INDICATION
	LOAD B,LPTMX,(U)	;SAVE ALLOCATION
	SETZM LPTSTS(U)		;CLEAR FLAGS
	STOR A,LPTOL,(U)	;PRESERVE THIS INDICATION
	STOR B,LPTMX,(U)	;RESTORE ALLOCATION
	MOVX A,INIPSI		;GET FLAG SAYING NO PSI ENABLE WAS DONE
	STOR A,LPPSI		;SAVE FLAG IN STATUS WORD
	SETZRO LPMSG,(U)	;DO NOT SUPPRESS CTY MESSAGES ANY MORE
	HRRZ A,LPTRLP(U)	;NOW UNLOCK BUFFER PAGE
	CALL FPTA
	CALL MULKPG
	UNLOCK LPTLCK(U)	;RELEASE THE LPT LOCK
	RETSKP

;SCHEDULER TEST FOR LPTCLZ

	RESCD
LPTDIS:	JN LPTHE,(A),1(4)	;IF FOUND ERROR, WAKE UP NOW
	OPSTR <SKIPN>,LPTFE,(A)	;BYTES STILL IN FE?
	SKIPL LPTCNT(A)		;NO. ALL BUFFERS CLEARED?
	JRST 0(4)		;CAN'T WAKE UP YET
	JRST 1(4)		;TEST SATISFIED
	SWAPCD			;RETURN TO SWAPPABLE MONITOR
; ROUTINE TO FORCE OUT REMAINING DATA TO LPT

LPTEOF:	MOVEI A,.CHNUL		;FILL REMAINDER OF BUFFER WITH NULLS
LPTEO1:	JN LPTHE,(U),[		;GOT AN ERROR?
		CALL GIVERR	;GENERATE ERROR, FIX BUFFERS
		RETBAD()]	;AND RETURN
	SKIPN FILCNT(JFN)	;AT END OF BUFFER NOW?
	JRST LPEOF1		;YES, GO WAIT FOR ALL BUFFERS TO FINISH
	CALL LPTSQO
	TQNN <ERRF>		;SERVICE ROUTINE FIND AN ERROR?
	TQNE <BLKF>		;SERVICE ROUTINE WANTS TO BLOCK?
	RET			;YES, TELL CALLER THAT
	JRST LPTEO1		;NO. FILL UP ALL OF BUFFER

LPEOF1:	SETONE LPOBF,(U)	;SET OUTPUT BEING FLUSHED
	AOSN LPTCNT(U)		;TELL INTERRUPT LEVEL OF THIS BUFFER
	CALL LPTSND		;START LPT IF WASNT GOING ALREADY
LPEOF2:	MOVSI A,0(U)		;SAVE UNIT NO OF LPT
	HRRI A,LPTDIS		;WAIT FOR END OF BUFFERS OR ERROR
	TQO <BLKF>		;REQUEST CALLER TO BLOCK
	RET			;AND RETURN
; Line printer sequential character output

LPTSQO:	ASUBR <CHARIN>		;ALLOCATE SPACE AND REMEMBER THE BYTE
	HLRZ U,DEV
LPSQO:	JE LPLVF,(U),LPSQ05	;VFU REQUIRE RELOADING ?
	JE LPTOL,(U),[LOAD A,LPDEVT,(U)
			CALL @SNDFLO(A) ;FLUSH REMAINING OUTPUT
		      JRST GIVERR] ;GIVE PROCESS ERROR AND RETURN
	MOVEI B,VFUFIL		;GET BASE ADDRESS OF VFU FILENAME BUFFER
	MOVEI C,.MOLVF		;GET FUNCTION TO PERFORM
	CALL LPTLOD		;GO RE-LOAD THE VFU
	 RET			;ERROR OR BLOCK NEEDED, RETURN TO SOUT

LPSQ05:	JE LPLTR,(U),LPSQ10	;DOES THE RAM NEED RELOADING ?
	MOVEI B,RAMFIL		;GET BASE ADDRESS OF RAM FILENAME BUFFER
	MOVEI C,.MOLTR		;GET FUNCTION TO PERFORM
	CALL LPTLOD		;GO RELOAD THE RAM
	 RET			;ERROR OR BLOCK NEEDED, RETURN TO SOUT

LPSQ10:	JN LPTHE,(U),GIVERR	;HARD ERROR UP ON DEVICE
	JN LPOBF,(U),[	CALL LPNOP2 ;IF WAITING FOR -11, CONTINUE
			 RET	;WANTS TO BLOCK, OR ERROR
			JRST .+1] ;ALL DONE WAITING
	SETZRO LPRLD,(U)	;FORGET RELOADED STATUS OF FRONT END
	SKIPN FILCNT(JFN)	;IS BUFFER READY FOR PRINTING?
	JRST [	AOSN LPTCNT(U)	;GIVE BUFFER TO INTERRUPT LEVEL
		CALL LPTSND	;AND START IT IF NECESSARY
		JRST .+1]
	SOSGE FILCNT(JFN)	;ANY MORE ROOM IN BUFFER?
	JRST [	CALL LPSQ20	;NO. GET ANOTHER BUFFER
		 RET		;WANTS TO BLOCK
		JRST LPSQO]	;GOT ONE. GO USE IT
	MOVE A,CHARIN		;RECOVER THE BYTE
	IDPB A,FILBYT(JFN)	;YES, STORE THE CHARACTER
	AOS FILBYN(JFN)		;INCREMENT TOTAL # OF BYTES OUTPUT
	RET			;THEN RETURN
;SUBROUTINE TO GET NEXT BUFFER FOR PRINTING.
;RETURNS:	+1 NO BUFFER AVAILABLE. ARRANGE FOR BLOCK
;		+2 BUFFER SET UP IN JFN BLOCK

LPSQ20:	CALL BUFWAT		;GO SEE IF THERE IS A BUFFER FREE
	 RET			;NO. RETURN TO BLOCK
	LOAD C,ALTP,(U)		;GET BUFFER POINTER
	XORI C,1		;TOGGLE IT
	STOR C,ALTP,(U)		;NEW POINTER
	CALL SETBUF		;GO SET UP JFN BLOCK COUNTS AND BUFFERS
	RETSKP			;DONE


; HERE TO GIVE PROCESS AN ERROR

GIVERR:	SETZRO LPTHE,(U)	;CLEAR ERROR BIT IN STATUS WORD
	CALL INIFIL		;RESET BUFFER POINTERS AND COUNTS
	TQO <ERRF>		;TELL PROCESS ABOUT ERROR
	RETBAD (IOX5)		;RETURN ERROR
; ROUTINE TO RE-LOAD THE VFU OR RAM WITH LAST FILE USED FOR LOADING
;
; CALL:	B/  RAMFIL	OR	 VFUFIL
;	C/  .MOLTR	OR	 .MOLVF
;		CALL LPTLOD
; RETURNS: +1	 ERROR, COULD NOT LOAD
;	   +2	SUCCESS

LPTLOD:	STKVAR <BASADR,CODE,CAPS>	;ALLOCATE SPACE FOR ADDRESS, CODE, CAPS
	MOVEM B,BASADR		;SAVE BASE ADR OF FILENAME BUFFER AREA
	MOVEM C,CODE		;SAVE FUNCTION TO PERFORM
	JE LPTHE,(U),LPTLD1	;WAS DATA POSSIBLY LOST ?
	CALL LPTFLO		;YES, FLUSH BUFFERS, AND INIT LPT
	 JFCL			;IT BETTER WORK
LPTLD1:	MOVE T1,CAPENB		;GET CURRENTLY ENABLE CAPABILITIES
	MOVEM T1,CAPS		;SAVE CURRENT CAPABILITIES
	MOVX T1,SC%WHL		;GET WHEEL CAPABILITY
	MOVEM T1,CAPENB		;MAKE THIS PROCESS A WHEEL
	MOVE B,BASADR		;GET BACK BASE ADDRESS OF FILENAME BUFFER
	MOVEI A,LPFLSZ		;GET SIZE OF FILENAME BUFFERS
	IMULI A,(U)		;GET OFFSET TO PROPER FILENAME BUFFER
	ADDI B,(A)		;GET POINTER TO PROPER FILENAME BUFFER
	MOVX A,177B6		;SEE IF NAME ASSIGNED YET
	TDNN A,0(B)		;IS IT
	JRST GIVERR		;NO. SET ERRF AND RETURN
	HRLI B,(POINT 7,)	;FORM POINTER TO FILENAME BUFFER
	MOVX A,GJ%SHT!GJ%OLD	;SHORT CALL GTJFN, EXISTING FILE
	GTJFN			;GET A JFN FOR FILE TO BE LOADED
	 JRST [	TQO <ERRF>	;SAY SOMETHING FAILED
		JRST FIXCAP]	;AND GO GIVE UP
	MOVE B,CODE		;GET FUNCTION TO BE PERFORMED
	CALL LODLPT		;CALL ROUTINE TO DO THE WORK
	 SKIPA			;FAIL, DO NOT SKIP RETURN
	AOS (P)			;SUCCESS, GIVE SKIP RETURN
				; AND FALL THROUGH TO FIXCAP

; HERE ON AN ERROR TO RESTORE ORIGINAL CAPABILITIES

FIXCAP:	MOVE T4,CAPS		;GET ORIGINAL CAPABILITIES
	MOVEM T4,CAPENB		;RESTORE INITIAL CAPABILITIES
	RET			;RETURN

; ROUTINE TO WAIT UNTIL A BUFFER IS FREE

BUFWAT:	SKIPG LPTCNT(U)		;ANY FREE BUFFERS?
	RETSKP			;YES, GIVE OK RETURN
	HRLI A,LPTCNT(U)	;GET ADDRESS OF COUNT
	HRRI A,DISLET		;WANT TO WAIT TILL ONE IS FREE
	TQO <BLKF>		;TELL BOUT TO BLOCK
	RET			;AND RETURN
;GET DEVICE DEPENDENT STATUS

LPDSTS:	HLRZ U,DEV		;GET UNIT
	LOAD A,LPPAG,(U)	;GET LAST PAGE COUNTER VALUE
	UMOVEM A,3		;STORE PAGE COUNTER IN USER'S AC 3
	CALLRET GETSTS		;GO GET SOFTWARE,,HARDWARE STATUS AND RETURN


; ROUTINE TO RETURN SOFTWARE,,HARDWARE STATUS
;
; CALL:		CALL GETSTS
; RETURNS: +1 ALWAYS, WITH
;		A/ SOFTWARE,,HARDWARE STATUS + MO%LCP IF LPT IS LOWER CASE

GETSTS:	LOAD A,LPERR,(U)	;GET LAST HARDWARE STATUS WORD
	LOAD B,LPSST,(U)	;GET LAST SOFTWARE STATUS WORD
	HRL A,B			;GET SOFTWARE,,HARDWARE STATUS
	LOAD B,LPLCP,(U)	;GET "PRINTER IS LOWER CASE" FLAG
	SKIPE B			;IS PRINTER LOWER CASE ?
	TXO A,MO%LCP		;YES, INDICATE LOWER CASE LPT
	JE LPRLD,(U),R		;DONE IF FRONT END HASN'T BEEN RELOADED,
	TXO A,MO%RLD		; ELSE, MARK THAT FRONT-END WAS RELOADED
	RET			;AND DONE


; JSYS TO INTITIALLY LOAD THE VFU AND RAM FILES
;
; ACCEPTS IN USER AC'S:
;	A/ JFN OF FILE TO BE LOADED
;	B/ MO%LCP IF LOWERCASE PRINTER + FUNCTION CODE
;					(.MOLVF TO LOAD VFU; .MOLTR TO LOAD RAM)
;	C/ UNIT NUMBER OF PRINTER
;		LPINI
; RETURNS +1 ALWAYS

.LPINI::MCENT			;MONITOR CONTEXT ENTRANCE
	MOVE A,CAPENB		;GET ENABLED CAPABILTIES
	TXNN A,SC%WHL!SC%OPR	;IS THIS PROCESS CURRENTLY PRIVILEGED ?
	ITERR (LPINX2)		;NO, ISSUE ERROR
	SKIPN PROFLG		;DOING PRIMARY PROTOCOL?
	ITERR (OPNX18)		;NO. DON'T LOAD IT THEN
	UMOVE U,3		;GET UNIT NUMBER TO BE LOADED
	CAIL U,0		;CHECK FOR VALID UNIT NUMBER,
	CAILE U,LPTN		; BETWEEN 0 AND LPTN
	ITERR (LPINX1)		;INVALID UNIT NUMBER
	JN LPOPN,(U),[ITERR (LPINX3)] ;ERROR IF ALREADY OPENED
	XCTU [HRRZ A,2]		;GET FUNCTION CODE
	UMOVE B,1		;GET JFN OF FILE TO BE LOADED
	CALL SAVNAM		;SAVE AWAY NAME OF FILE, EVEN IF LOADING ERROR
	UMOVE A,1		;GET JFN OF FILE TO BE LOADED
	UMOVE B,2		;GET FUNCTION CODE AND FLAG (.MOLVF OR .MOLTR)
	TXZE B,MO%LCP		;IS PRINTER SUPPOSED TO BE LOWERCASE ?
	JRST [ SETONE LPLCP,(U)	;YES, INDICATE PRINTER IS LOWERCASE
		JRST .+1]	;CONTINUE
	CALL LODLPT		;GO LOAD THE VFU OR RAM
	 JFCL			;IGNORE ERRORS
	JRST MRETN		;RETURN TO USER
;ROUTINE TO IMPLEMENT THE MTOPR FUNCTIONS

LPTMTO:	HLRZ U,DEV		;GET UNIT NUMBER
	MOVSI A,-LPMSIZ		;SET UP AOBJN POINTER TO SEARCH FOR FUNCTION
LPMT10:	HLRZ C,LPMTAB(A)	;GET FUNCTION CODE FROM TABLE
	CAMN C,B		;FOUND REQUESTED FUNCTION ?
	JRST LPMT20		;YES, GO DISPATCH
	AOBJN A,LPMT10		;NO, LOOP OVER DISPATCH TABLE
	RETBAD (MTOX1)		;NOT FOUND, RETURN INVALID FUNCTION ERROR

; HERE WITH A VALID FUNCTION CODE

LPMT20:	HRRZ C,LPMTAB(A)	;GET ROUTINE TO PROCESS REQUEST
	CALLRET (C)		;CALL PROCESSING ROUTINE AND RETURN

; DISPATCH TABLE FOR LPT MTOPR FUNCTIONS

LPMTAB:	.MOLVF,,LPTLVF		;LOAD VFU
	.MOLTR,,LPTLTR		;LOAD TRANSLATION RAM
	.MOSTS,,LPSTAT		;SET STATUS
	.MORST,,LPRSTS		;READ STATUS
	.MORVF,,LPTRVF		;READ VFU FILE NAME
	.MORTR,,LPTRTR		;READ RAM FILE NAME
	.MOFLO,,LPTFLO		;FLUSH OUTPUT
	.MOPSI,,LPTPSI		;ENABLE INTERRUPTS
	.MONOP,,LPTNOP		;NOP (WAIT FOR I/O TO COMPLETE)

	LPMSIZ==.-LPMTAB	;SIZE OF LPMTAB
; .MOLVF - LOAD VFU FUNCTION

LPTLVF:	JN LPRBR,(U),LODCMP	;JUMP IF RAM ALREADY BEING RELOADED
	MOVEI T1,1		;GET OFFSET TO JFN IN ARGUMENT BLOCK
	CALL GETWRD		;GET JFN FROM USER
	 RETBAD (MTOX13)	;RETURN ARGUMENT BLOCK TOO SMALL
	MOVE A,B		;GET JFN OF VFU FILE
	MOVEI B,.MOLVF		;GET FUNCTION FOR "LOAD VFU"
	CALL LODLPT		;GO LOAD THE VFU
	 JRST LODBLK		;GO SEE IF BLOCK WANTED
	RETSKP			;SUCCESS, RETURN

; .MOLTR - LOAD TRANSLATION RAM

LPTLTR:	JN LPRBR,(U),LODCMP	;JUMP IF RAM ALREADY BEING RELOADED
	MOVEI A,1		;GET OFFSET TO JFN IN ARGUMENT BLOCK
	CALL GETWRD		;GET JFN FROM USER
	 RETBAD (MTOX13)	;RETURN ARGUMENT BLOCK TOO SMALL
	MOVE A,B		;GET JFN FOR RAM FILE
	MOVEI B,.MOLTR		;GET CORRECT FUNCTION CODE
	CALL LODLPT		;GO LOAD RAM
	 JRST LODBLK		;GO SEE IF BLOCK WANTED
	RETSKP			;RETURN


;HERE ON RETURN FROM LODLPT TO SEE IF BLOCK NEEDED

LODBLK:	TQNN <BLKF>		;BLOCK REQUESTED?
	RET			;NO. GIVE UP
	SETONE LPRBR,(U)	;YES. REMEBER ONCE HERE
	RET			;AND GO BLOCK

; HERE WHEN RAM ALREADY BEING RELOADED, INDICATE LOADING COMPLETE

LODCMP:	SETZRO LPRBR,(U)	;MARK THAT RAM NO LONGER BEING RELOADED
	RETSKP			;SUCCESS RETURN
; .MOPSI - ENABLE FOR PSI INTERRUPTS ON OPERATOR-ATTENTION CONDITIONS

LPTPSI:	MOVEI A,1		;GET OFFSET TO PSI CHANNEL IN ARG BLOCK
	CALL GETWRD		;GET PSI CHANNEL TO ENABLE
	 RETBAD (MTOX13)	;ARGUMENT BLOCK TOO SMALL
	CAIL B,0		;CHECK THAT GIVEN PSI CHANNEL IS A VALID
	CAILE B,5		; ASSIGNABLE CHANNEL
	JRST [	CAIL B,^D24	;CHECK THAT GIVEN PSI CHANNEL IS A VALID
		CAILE B,^D35	; ASSIGNABLE CHANNEL
		RETBAD (MTOX14)	;BAD PSI CHANNEL NUMBER GIVEN
		JRST .+1 ]	;PSI CHANNEL OK, RETURN
	STOR B,LPPSI,(U)	;SAVE PSI CHANNEL TO INTERRUPT ON
	MOVEI A,2		;GET OFFSET TO FLAG WORD
	CALL GETWRD		;GET FLAGS FROM USER
	 RETSKP			;NO FLAG WORD, RETURN
	TXNN B,MO%MSG		;USER WANT TO SUPPRESS MESSAGES ?
	RETSKP			;NO, RETURN
	SETONE LPMSG,(U)	;YES, MARK THAT "PROBLEM ON DEVICE" ISN'T WANTED
	RETSKP			;RETURN TO USER


; SCHEDULER TEST ROUTINE TO WAIT FOR COMPLETION OF RAM OR VFU LOADING

	RESCD
LODWAT:	JE LP%LHC,(1),0(4)	;RETURN IF LOADING-HAS-COMPLETED FLAG IS OFF
	JRST 1(4)		;LOADING-HAS-COMPLETED FLAG ON, RETURN SUCCESS
	SWAPCD
; .MOFLO - FLUSH OUTPUT TO LPT

LPTFLO:	CALL INIFIL		;GO INITIALIZE BUFFER FLAGS AND INTERRUPT COUNT
	LOAD A,LPDEVT,(U)
	CALL @SNDFLO(A)		;NOW SEND A FLUSH TO THE -11
	LOAD A,LPDEVT,(U)
	CALL @GLPTST(A)		;ASK FOR STATUS IN CASE ITS NEEDED
	RETSKP			;RETURN SUCCESS





; .MORST - READ LINE PRINTER STATUS

LPRSTS:	JN LPMWS,(U),HAVSTS	;JUMP IF MTOPR WAITING FOR STATUS ALREADY
	SETZRO LPSHA,(U)	;INITIALIZE STATUS HAS ARRIVED FLAG
	LOAD A,LPDEVT,(U)
	CALL @GLPTST(A)		;GO ASK -11 FOR LPT STATUS
	SETONE LPMWS,(U)	;REMEBER WAITING FOR STATUS
	MOVSI A,LPTST1(U)	;GET STATUS WORD ADDRESS
	HRRI A,STSWAT		;GET ADR OF ROUTINE TO CHECK FOR STATUS ARRIVAL
	TQO <BLKF>		;TELL MTOPR TO BLOCK
	RET			;RETURN

; HERE WHEN STATUS REQUESTED BY .MORST HAS ARRIVED

HAVSTS:	SETZRO LPMWS,(U)	;MARK THAT MTOPR NOT WAITING FOR STATUS ANY MORE
	CALL GETSTS		;GET SOFTWARE,,HARDWARE STATUS IN A
	MOVE B,A		;COPY STATUS FOR PUTWRD ROUTINE
	MOVEI A,1		;GET OFFSET INTO USER'S ARGUMENT BLOCK
	CALL PUTWRD		;STORE STATUS IN USER ARGUMENT BLOCK
	 RETBAD (MTOX13)	;ARGUMENT BLOCK TOO SMALL
	MOVEI A,2		;GET OFFSET INTO USER'S ARGUMENT BLOCK
	LOAD B,LPPAG,(U)	;GET LPT PAGE COUNTER REGISTER
	CALL PUTWRD		;STORE PAGE COUNTER IN USER'S ARG BLOCK
	 RETBAD (MTOX13)	;ARGUMENT BLOCK TOO SMALL
	RETSKP			;RETURN TO USER

	RESCD
; ROUTINE TO TEST FOR STATUS ARRIVAL
; CALLED FROM SCHEDULER

STSWAT:	JE LP%SHA,(1),0(4)	;RETURN NON-SKIP IF STATUS NOT HERE YET
	JRST 1(4)		;RETURN SKIP, STATUS HAS ARRIVED

	SWAPCD
; .MOSTS - SET LPT STATUS

LPSTAT:	MOVEI A,1		;GET OFFSET INTO USER'S ARGUMENT BLOCK
	CALL GETWRD		;GET USER'S FLAGS
	 RETSKP			;RAN OUT OF ARGUMENTS, RETURN
	TXNE B,MO%SER		;CLEAR SOFTWARE ERROR ?
	CALL SNDACK		;YES, GO SEND AN ACK TO THE -11
	MOVEI A,1		;GET OFFSET INTO USER'S ARGUMENT BLOCK
	CALL GETWRD		;GET USER'S FLAGS
	 RETSKP			;RAN OUT OF ARGUMENTS, RETURN
	LOAD A,LPDEVT,(U)	;ASSUME CALL TO SNDEOF
	TXNE B,MO%EOF		;SEND AN EOF TO THE -11 ?
	CALL @SNDEOF(A)		;YES GO SEND AN EOF TO THE -11
	MOVEI A,2		;GET OFFSET TO PAGE COUNTER IN ARG BLOCK
	CALL GETWRD		;GET PAGE COUNTER FROM USER ARGUMENT BLOCK
	 RETSKP			;RETURN, PAGE COUNTER NOT GIVEN
	CAMN B,[-1]		;DID USER WANT TO IGNORE PAGE COUNTER ?
	RETSKP			;YES, RETURN
	MOVE A,B		;NO, GET VALUE TO SET INTO PAGE COUNTER
	SKIPE B			;DID USER WANT TO ENABLE PSI INTERRUPTS ?
	SETOM B			;YES, INDICATE INTERRUPTS SHOULD BE ENABLED
	CALL LODPAG		;GO LOAD THE PAGE COUNTER
	 JFCL			;SHOULD NOT FAIL
	RETSKP			;RETURN TO THE USER


; ROUTINE TO LOAD THE PAGE COUNTER
;
; CALL:	A/ VALUE TO BE LOADED INTO THE PAGE COUNTER
;	B/ 0 - DO NOT ENABLE FOR INTERRUPTS ON PAGE COUNTER OVERFLOW
;	   1 - ENABLE FOR INTERRUPTS ON PAGE COUNTER OVERFLOW
;		CALL LODPAG
; RETURNS: +1	 FAILURE, CALL TO LINE PR CONTROL FAILED
;	   +2	SUCCESS

LODPAG:	SETZRO LPPCI,(U)	;CLEAR PAGE COUNTER INTERRUPTED FLAG
	STOR A,PGCTR,(U)	;STORE VALUE TO BE LOADED INTO PAGE COUNTER
	STOR B,PGENB,(U)	;STORE ENABLE/DISABLE INTERRUPTS BIT
	MOVX A,.DFLPC		;GET SPECIAL DEVICE OPERATION: LOAD PAGE COUNTER
	STOR A,PGFNC,(U)	;STORE SPECIAL DEVICE OPERATION
	LOAD A,LPDEVT,(U)	;FIND CORRECT ROUTINE
	CALLRET @SNDLDP(A)
; ROUTINE TO SEND AN ACK TO THE FRONT-END

SNDACK:	SETZRO LPPCI,(U)	;CLEAR PAGE-COUNTER-INTERRUPTED FLAG
	LOAD A,LPDEVT,(U)	;FIND CORRECT ROUTINE
	CALL @SENACK(A)		;SEND ACK
	JFCL			;IGNORE ERROR
	RET			;RETURN
; .MORVF - READ FILENAME OF LAST VFU FILE LOADED
; .MORTR - READ FILENAME OF LAST RAM FILE LOADED

LPTRVF:	SKIPA C,[VFUFIL]	;GET BASE ADDRESS OF VFU FILENAME BUFFER
LPTRTR:	MOVEI C,RAMFIL		;GET BASE ADDRESS OF RAM FILENAME BUFFER
	STKVAR <REDCNT,REDIPT,REDOPT> ;ALLOCATE SPACE FOR COUNT AND POINTERS
	MOVEI D,LPFLSZ		;GET SIZE OF FILENAME BUFFERS
	IMULI D,(U)		;COMPUTE OFFSET TO PROPER BUFFER
	ADDI C,(D)		;GET ADDRESS OF PROPER FILENAME BUFFER
	HRLI C,(POINT 7,)	;FORM POINTER TO LAST FILENAME LOADED
	MOVEM C,REDIPT		;SAVE INPUT POINTER
	MOVEI A,1		;GET OFFSET TO POINTER IN USER ARG BLOCK
	CALL GETWRD		;GET POINTER TO USER BUFFER
	 RETBAD (MTOX13)	;ARG BLOCK TOO SMALL
	CAML B,[777777,,0]	;-1,,ADR GIVEN ?
	HRLI B,(POINT 7,)	;YES, CHANGE TO STANDARD POINTER
	MOVEM B,REDOPT		;SAVE POINTER TO USER BUFFER
	MOVEI A,2		;GET OFFSET TO COUNT IN USER ARG BLOCK
	CALL GETWRD		;GET COUNT FROM USER ARG BLOCK
	 RETBAD (MTOX13)	;USER ARG BLOCK TOO SMALL
	MOVEM B,REDCNT		;SAVE COUNT

; LOOP TO RETURN FILENAME STRING TO USER

LPTR10:	SOSGE REDCNT		;DECREMENT COUNT, SKIP IF A CHARACTER LEFT
	RETSKP			;DONE, RETURN
	ILDB A,REDIPT		;GET A CHARACTER FROM FILENAME
	XCTBU [IDPB A,REDOPT]	;STORE CHARACTER IN USER BUFFER
	JUMPN A,LPTR10		;IF NOT A NULL, GO CHECK NEXT CHARACTER
	MOVEI A,1		;GET OFFSET TO POINTER IN USER ARG BLOCK
	MOVE B,REDOPT		;GET FINAL POINTER TO USER SPACE
	CALL PUTWRD		;STORE POINTER IN USER ARG BLOCK
	 JFCL			;IGNORE FAILURE
	MOVEI A,2		;GET OFFSET TO COUNT IN USER ARGUMENT BLOCK
	MOVE B,REDCNT		;GET FINAL BYTE COUNT
	CALL PUTWRD		;STORE FINAL BYTE COUNT IN USER ARGUMENT BLOCK
	 JFCL			;IGNORE ERRORS
	RETSKP			;NULL SEEN, RETURN
; .MONOP - WAIT FOR I/O TO STOP
;
; THIS FUNCTION IS ACCOMPLISHED BY SENDING AN END-OF-FILE TO THE -11.  THIS
; TELLS THE -11 TO RETURN AN EOF BACK WHEN ALL DATA RECIEVED PRIOR TO THE
; EOF HAS BEEN OUTPUT.

LPTNOP:	JN LPOBF,(U),LPNOP2	;ALREADY BEEN HERE?
	SETZRO LPSHA,(U)	;CLEAR STATUS ARRIVED
	CALL LPTEOF		;NO. GO SEND SOME DATA
	TQNE <ERRF>		;MADE AN ERROR?
	RETBAD()		;YES. RETURN ERROR INFORMATION
	SETONE LPNOE,(U)	;NOTE OCCURRENCE OF EOF
	RET			;AND GO WAIT FOR BUFFERS TO CLEAR -10