	.TITLE *** PR....
/ 
/ 
/                   FIRST PRINTING, FEBRUARY 1974
/ 
/ 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 RESPON-
/ SIBILITY FOR ANY ERRORS THAT MAY APPEAR IN THIS
/ DOCUMENT.
/ 
/ THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FUR-
/ NISHED 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 PRO-
/ VIDED IN WRITING BY DIGITAL.
/ 
/ DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY
/ FOR THE USE OR RELIABILITY OF ITS SOFTWARE ON EQUIP-
/ MENT THAT IS NOT SUPPLIED BY DIGITAL.
/ 
/ COPYRIGHT (C) 1974, BY DIGITAL EQUIPMENT CORPORATION
/ 
/ 
        .EJECT
/
/ COPYRIGHT 1971, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. 01754
/
/ PC15 PAPER TAPE READER I/O DEVICE HANDLER FOR THE
/ PDP-15 RSX-15 MONITOR SYSTEM.
/
/	EDIT	#15		30 NOV 71
/
/				C. PROTEAU
/
/ RECOGNIZED I/O FUNCTIONS:
/
/	17	ABORT
/	24	ATTACH
/	25	DETACH
/	26	INPUT (READ)
/	34	CLOSE
/	36	HINF
/	777	DISCONNECT AND EXIT
/
/ LEGAL DATA MODES:
/
/	0	IOPS BINARY
/	1	IMAGE BINARY
/	2	IOPS ASCII
/	3	IMAGE ASCII
/
/ LABELLING CONVENTION:
/
/	ALL ADDRESS TAGS DEFINED WITHIN THIS TASK
/	BEGIN WITH "PR".
/
/ EVENT VARIABLES RETURNED:
/
/	+200006		VALUE SET BY THE HINF FUNCTION TO INDI-
/			CATE DEVICE CODE 6 AND NON-DIRECTORY-ORIENTED
/			INPUT ONLY.
/
/	+1		NORMAL VALUE RETURNED FOR COMPLETION OF
/			OPERATION.
/
/	-5		ILLEGAL HEADER WORD (IOPS BINARY HEADER
/			WORD 0 READ FROM PAPER TAPE INDICATES
/			THAT THE DATA MODE IS NOT IOPS BINARY OR
/			THE DATA VALIDITY BITS ARE SET NON-0).
/			AN END-OF-FILE BLOCK IS AN EXCEPTION
/			SINCE THE MODE INDICATOR IS 5, NOT 0.
/
/	-6		UNIMPLEMENTED OR ILLEGAL CAL FUNCTION.
/
/	-7		ILLEGAL DATA MODE.
/
/	-16		ILLEGAL BUFFER SIZE (SIZE MUST BE +3 OR LARGER FOR MODES
/			0, 1, AND 3.  SIZE MUST BE +4 OR LARGER FOR IOPS ASCII).
/
/	-23		ILLEGAL WORD PAIR COUNT (IOPS BINARY HEADER WORD 0
/			READ FROM PAPER TAPE HAS A WORD PAIR COUNT=0).
/
/	-24		I/O REQUEST REJECTED BECAUSE THE LUN VIA
/			WHICH THE REQUEST WAS MADE HAS BEEN RE-
/			ASSIGNED AWAY FROM THIS PHYSICAL DEVICE.
/
/	-30		I/O PARAMETER FOR A NORMAL MODE TASK EXCEEDS
/			THE TASK'S PARTITION BOUNDS.
/
/	-203		I/O REQUEST (ATTACH OR DETACH) WAS REJECTED
/			BECAUSE IT WAS NOT ISSUED FROM TASK LEVEL.
/
/ DEFINITION OF REGISTERS LOCATED WITHIN THE RSX EXECUTIVE.
/
R1=101				/GENERAL REGISTER #1.
R2=102				/GENERAL REGISTER #2.
R3=103				/GENERAL REGISTER #3.
R4=104				/GENERAL REGISTER #4.
NADD=107			/ENTRY POINT TO "ADD
				/NODE TO DEQUE" SUBROUTINE.
SNAM=123			/ENTRY POINT TO "SEARCH FOR NODE IN DEQUE
				/UNDER THIS NAME" SUBROUTINE.
POOL=240			/HEAD OF THE EMPTY NODES DEQUE.
PDVL=252			/HEAD OF THE PHYSICAL DEVICE LIST QUEUE.
ALAD=325			/ENTRY POINT TO "ATTACH LUN & DEVICE" SUBROUTINE.
DLAD=332			/ENTRY POINT TO "DETACH LUN & DEVICE" SUBROUTINE.
DQRQ=337			/ENTRY POINT TO "DE-QUEUE REQUEST" SUBROUTINE.
VAJX=342			/ENTRY POINT TO "VERIFY AND ADJUST I/O TRANSFER
				/PARAMETERS TO 17 BITS" SUBROUTINE.
IOCD=345			/ENTRY POINT TO "DECREMENT I/O PENDING
				/COUNT" SUBROUTINE.
DMTQ=361			/ENTRY POINT TO "DETACH AND EMPTY I/O
				/REQUEST DEQUE" SUBROUTINE.
/
/ IOT AND PARAMETER DEFINITIONS.
/
.INH=705522			/INHIBIT INTERRUPTS.
.ENB=705521			/ENABLE INTERRUPTS.
IORS=700314			/READ IORS STATUS WORD INTO AC. BIT 8 INDI-
				/CATES READER OFF LINE OR OUT OF TAPE.
RRB=700112			/READ READER BUFFER INTO THE AC
				/AND CLEAR THE READER FLAG.
RSA=700104			/SELECT READER IN ALPHANUMERIC MODE.
				/CLEAR THE READER FLAG AND THEN
				/READ ONE 8-BIT CHARACTER (RIGHT
				/JUSTIFIED) INTO THE READER BUFFER.
IDX=ISZ				/IDX IS USED INSTEAD OF ISZ WHEN THE
				/INTENT IS TO ADD 1 BUT NOT TO SKIP.
LUN=3				/LUN FOR NOT-READY MESSAGE.
	.TITLE *** INITIALIZATION CODE/VARIABLES
/
/ HANDLER INITIALIZATION CODE -- CONTROL STARTS AT THIS
/ POINT AS A RESULT OF A "REQUEST" BY THE MCR
/ TASK "REASSIGN".
/
/ THIS CODE IS EXECUTED ONLY ONCE; HENCE,
/ THESE REGISTERS ARE REUSED TO STORE
/ DATA VARIABLES.
/
/ *******************************************************************
/
/ ************************* OVERLAYED *******************************
/
PRINIT	LAC	PRPDVL		/ADDRESS OF THE PHYSICAL DEVICE LIST QUEUE.
	DAC*	(R1)
	LAC	PRPNAM		/ADDRESS OF: .SIXBT "PR@@@@".
	DAC*	(R2)
	JMS*	(SNAM)		/SCAN THE PHYSICAL DEVICE
				/LIST FOR THE PAPER TAPE
				/READER'S NODE.
				/(R1, R2, R6, X17, XR & AC ARE ALTERED).
				/WAS THE NODE FOUND?
	CAL	(10)		/NO -- EXIT.
	DAC	PRPDNA		/YES -- SAVE THE NODE ADDRESS.
/
/ SAVE THE ADDRESS OF THE REGISTER IN THE PHYSICAL DEVICE LIST NODE
/ WHICH IS SUPPOSED TO CONTAIN THE ADDRESS OF PR'S TRIGGER EVENT 
/ VARIABLE.  THEN, STORE THE TRIGGER EVENT VARIABLE ADDRESS IN THE 
/ PHYSICAL DEVICE LIST NODE.
/
	AAC	+10
	DAC	PRPDEV
	LAC	PRPTTG		/PICK UP THE ADDRESS OF THE TRIGGER EVENT VARIABLE.
	DAC*	PRPDEV
/
/ COMPUTE AND STORE THE INDEX REGISTER ADJUSTMENT FACTOR.  WHEN USING
/ THE CONTENTS OF THE INDEX REGISTER AS A BASE ADDRESS AND THE ADDRESS
/ OPERAND AS A CONSTANT OFFSET, AS IN  LAC 3,X  , ONE MUST ADD AN 
/ ADJUSTMENT FACTOR TO THE CONTENTS OF THE XR TO OFFSET THE ADDRESS
/ OPERAND'S IMPLIED PAGE BITS.
/
	AND	PR70K		/SAVE THE PAGE BITS
	TCA			/AS A NEGATIVE
	DAC	PRXADJ		/ADJUSTMENT FACTOR.
/
/ CONNECT THE INTERRUPT LINE (API CHANNEL 10)
/ TO PR'S INTERRUPT SERVICE ROUTINE (PR.INT).
/
	CAL	PRCNCT		/"CONNECT".
	IDX	PRCNCT		/CHANGE THE "CONNECT" CPB
	DZM	PRCNCT+1	/TO A "DISCONNECT" CPB.
	LAC	PR.EV		/WAS THE CONNECT
	SPA			/SUCCESSFULLY PERFORMED?
	JMP	PRUNDO		/NO -- EXIT.
	JMP	PR.TW		/YES -- WAIT FOR TRIGGER.
/
/ DATA CONSTANTS USED ONLY DURING THE INITIALIZATION CODE.
/
PRNAME	.SIXBT	"PR@@@@"
PRPDVL	PDVL			/ADDRESS OF THE PHYSICAL DEVICE
				/LIST QUEUE.
PRPNAM	PRNAME
PR70K	070000			/PAGE BIT MASK.
PRPTTG	PRTGEV			/ADDRESS OF THE TRIGGER EVENT VARIABLE.
/
/ ********************* END OF OVERLAYABLE CODE *******************
/
/ *****************************************************************
/
PRIEND=.			/USED FOR .LOC CONDITIONAL BELOW.
/
	.EJECT
/ THE FOLLOWING DATA VARIABLES, WHICH DO NOT NEED TO START OUT WITH A
/ SPECIFIED VALUE, OVERLAY THE ONCE-ONLY INITIALIZATION CODE AT THE 
/ BEGINNING OF THIS PROGRAM.
/
PRPDNA=PRINIT+0			/ADDRESS OF THE PHYSICAL DEVICE NODE.
PRXADJ=PRINIT+1			/INDEX REGISTER ADJUSTMENT FACTOR (SEE
				/INITIALIZATION CODE FOR EXPLANATION).
PR.EV=PRINIT+2			/PR'S EVENT VARIABLE.  WHEN THE TASK
				/HAS STARTED TO READ, IT WAITS FOR THIS
				/VARIABLE TO BE SET BY THE INTERRUPT
				/SERVICE ROUTINE AS FOLLOWS: BIT 0 =
				/UNUSED; BIT 1 = 1 ALWAYS; BITS 10-
				/17 = 8-BIT TAPE LINE READ IN. 
				/WHEN NOT READING, PR USES THIS SAME
				/VARIABLE WHEN ISSUING SYSTEM DIRECTIVES.
PRPDEV=PRINIT+3			/ADDRESS OF THE WORD IN THE PHYSICAL
				/DEVICE NODE THAT CONTAINS THE TRIGGER
				/EVENT VARIABLE ADDRESS.
PRRQEV=PRINIT+4			/ADDRESS OF THE REQUESTOR'S
				/EVENT VARIABLE.
PRMODE=PRINIT+5			/THE DATA MODE.
PRHEAD=PRINIT+6			/ADDRESS OF THE REQUESTOR'S LINE 
				/BUFFER HEADER.
PRDPTR=PRINIT+7			/POINTER TO A DATA WORD WITHIN THE 
				/REQUESTOR'S LINE BUFFER.
PRBFSZ=PRINIT+10		/REQUESTOR'S LINE BUFFER SIZE.
PRRQND=PRINIT+11		/ADDRESS OF THE CURRENT I/O REQUEST NODE.
PR.CNT=PRINIT+12		/COUNTER.
PR.PAR=PRINIT+13		/PARITY OF THE CURRENT TAPE FRAME
				/(IN BIT 17).
PRCHAR=PRINIT+14		/THE CURRENT TAPE FRAME (BITS 10-17)
				/BITS 0-9 = 0.
PRXCES=PRINIT+15		/INITIALLY SET TO 0.  SET NON-0 TO 
				/INDICATE "EXCESS DATA" WHEN THE 
				/REQUESTOR'S LINE BUFFER IS TOO SHORT.
PRPERR=PRINIT+16		/PARITY ERROR FLAG (USED BY IOPS ASCII
				/AND IOPS BINARY).  0 = NO ERROR.
				/NON-0 = ERROR.
PR3CNT=PRINIT+17		/COUNTER FOR 3 TAPE FRAMES PER BINARY
				/WORD (IOPS OR IMAGE BINARY).
PRIBHD=PRINIT+20		/SET INITIALLY TO -1 SO THAT, BY USING
				/AN ISZ, THE IOPS BINARY HEADER WORD
				/CAN BE DETECTED WHEN READ IN.
PR.WC=PRINIT+21			/NEGATIVE WORD-COUNTER.
PRDTWC=PRINIT+22		/POSITIVE COUNT OF THE # OF DATA WORDS
				/STORED (USED TO COMPUTE THE HEADER WORD
				/PAIR COUNT).
PRCKSM=PRINIT+23		/CHECKSUM.
PRBCNT=PRINIT+24		/IOPS ASCII BYTE COUNT USED IN DATA 
				/PACKING.  RANGE:  -5 TO 0.
PRTBUF=PRINIT+25		/5 WORD TEMPORARY
/	     +26		/BUFFER USED FOR
/	     +27		/IOPS ASCII PACKING.
/	     +30		/ONE CHARACTER IS
/	     +31		/STORED PER WORD.
PREOFF=PRINIT+32		/END-OF-FILE FLAG (USED BY IOPS ASCII).
				/SET NON-0 WHEN A CTRL D CHARACTER IS
				/READ TO SIGNAL AN END-OF-FILE CONDITION.
PR.AC=PRINIT+33			/TEMPORARY STORAGE FOR THE AC WHILE IN
				/THE INTERRUPT SERVICE ROUTINE.
PRABNA=PRINIT+34		/ADDRESS OF THE "ABORT" I/O REQUEST NODE.
PRABSN=PRINIT+35		/STL NODE ADDRESS OF THE TASK BEING ABORTED.
PRIOSN=PRINIT+36		/STL NODE ADDRESS OF THE TASK FOR THE I/O
				/REQUEST UNDER WAY.
PRRDEV=PRINIT+37		/EVENT VARIABLE ADDRESS FOR THE I/O
				/RUNDOWN TASK.
/
/ THE .LOC BELOW IS NECESSARY IN CASE THE NUMBER OF VARIABLES
/ EXCEEDS THE SIZE OF THE INIT CODE.
/
PR.LOC=PRINIT+40
/
	.IFNEG	PRIEND-PR.LOC
	.LOC	PR.LOC
	.ENDC
	.TITLE *** I/O REQUEST PROCESSING
/
/ WAIT FOR THE TASK TO BE TRIGGERED (BY 'I/O CAL' CAL SERVICE ROUTINE
/ OR BY THE "I/O RUNDOWN" TASK) TO SIGNAL THAT A REQUEST HAS BEEN QUEUED.
/
PR.TW	CAL	PRWFTG		/"WAITFOR" PAPER TAPE READER TRIGGER
				/EVENT VARIABLE TO BE SET.
	DZM	PRTGEV		/CLEAR THE TRIGGER.
/
/ THE TASK HAS BEEN TRIGGERED -- PICK A REQUEST FROM THE QUEUE (IF ANY).
/
PRPICK	LAC	PRPDNA		/PUT THE PHYSICAL DEVICE NODE ADDRESS
	DAC*	(R1)		/INTO R1.
	JMS*	(DQRQ)		/DE-QUEUE AN I/O REQUEST.
				/(R1, R2, R4, R5, R6, XR & AC ARE ALTERED).
				/WAS A REQUEST FOUND?
	JMP	PR.TW		/NO -- WAIT FOR TRIGGER.
	DAC	PRRQND		/YES -- SAVE THE NODE'S ADDRESS.
/
/ AN I/O REQUEST NODE HAS BEEN FOUND.  PICK UP THE PARAMETERS FROM
/ THE NODE.
/
	JMS	PRADJX		/SET UP THE XR TO ACCESS THE REQUEST NODE.
/
	LAC	2,X		/STL NODE ADDRESS OF THE TASK FOR WHICH
	DAC	PRIOSN		/I/O IS NOW UNDER WAY.
	LAC	6,X		/SAVE THE ADDRESS (OR 0
	DAC	PRRQEV		/IF NONE) OF THE REQUESTOR'S
				/EVENT VARIABLE.
	LAC	7,X		/SAVE THE DATA MODE.
	DAC	PRMODE
	LAC	10,X		/SAVE THE ADDRESS OF
	DAC	PRHEAD		/THE LINE BUFFER HEADER.
	LAC	11,X		/SAVE THE BUFFER SIZE.
	DAC	PRBFSZ
	TCA
	DAC	PR.WC		/INITIALLY, THE # OF WORDS TO BE STORED
				/IS ASSUMED TO = THE BUFFER SIZE.
/
	.EJECT
/ FETCH THE CAL FUNCTION CODE AND DISPATCH TO THE APPROPRIATE ROUTINE.
/
	LAC	5,X		/THE CAL CODE IS IN THE RIGHT
	AND	(777)		/HALF OF THE WORD.
	SAD	(017)
	JMP	PRABOR		/ABORT.
	SAD	(024)
	JMP	PRATCH		/ATTACH.
	SAD	(025)
	JMP	PRDTCH		/DETACH.
	SAD	(026)
	JMP	PRREAD		/INPUT (READ).
	SAD	(034)
	JMP	PRCLOS		/CLOSE.
	SAD	(036)
	JMP	PRHINF		/HINF.
	SAD	(777)
	JMP	PREXIT		/DISCONNECT & EXIT.
/
/ UNIMPLEMENTED OR ILLEGAL FUNCTION.
/
PRIFNC	LAW	-6
	JMP	PRSREV		/SET REQUESTOR'S EVENT VARIABLE.
	.TITLE *** ATTACH/DETACH
/
/ ATTACH THE PAPER TAPE READER TO A TASK.
/
PRATCH	LAC	PRPDNA		/PUT THE PHYSICAL DEVICE NODE ADDRESS
	DAC*	(R1)		/INTO R1.
	LAC	PRRQND		/PUT THE I/O REQUEST NODE ADDRESS INTO R2.
	DAC*	(R2)
	JMS*	(ALAD)		/ATTACH THE LUN & PHYSICAL DEVICE TO THE TASK.
				/(R3, R4, R5, R6, X10, X11, XR & AC ARE
				/ALTERED).
				/WAS THE ATTACH DONE?
	JMP	PRSREV		/NO -- THE PROPER EVENT VARIABLE SETTING
				/IS IN THE AC.
	JMP	PRRQOC		/YES -- REQUESTED OPERATION COMPLETED.
/
/ DETACH THE PAPER TAPE READER FROM THE TASK.
/
PRDTCH	LAC	PRPDNA		/PUT THE PHYSICAL DEVICE NODE ADDRESS
	DAC*	(R1)		/INTO R1.
	LAC	PRRQND		/PUT THE I/O REQUEST NODE ADDRESS INTO R2.
	DAC*	(R2)
	JMS*	(DLAD)		/DETACH THE LUN & PHYSICAL DEVICE FROM
				/THE TASK.
				/(R3, R4, R5, R6, X10, X11, XR & AC ARE
				/ALTERED).
				/WAS THE DETACH DONE?
	JMP	PRSREV		/NO -- THE PROPER EVENT VARIABLE SETTING
				/IS IN THE AC.
	JMP	PRRQOC		/YES -- REQUESTED OPERATION COMPLETED.
	.TITLE *** ABORT
/
/ ABORT ALL I/O INITIATED BY THIS TASK.
/
/ NOTE THAT ABORT, IN THOSE CASES WHERE I/O IS IN PROGRESS, IS HANDLED
/ BY THE PRABRT SUBROUTINE. HERE, ABORT WAS DE-QUEUED WHEN NO READER I/O
/ WAS UNDER WAY.
/
PRABOR	XOR	5,X		/"ABORT" IS AN ILLEGAL FUNCTION FOR ALL
	SZA			/TASKS EXCEPT 'IORD', WHO SETS THE LUN = 0.
	JMP	PRIFNC
/
	LAC	PRPDNA		/ADDRESS OF THE PHYSICAL DEVICE NODE.
	DAC*	(R1)
	LAC	PRRQND		/ADDRESS OF THE I/O REQUEST NODE.
	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
				/AND AC ARE ALTERED).
	JMP	PRRQOC		/DONE.
	.TITLE *** EXIT/HINF
/
/ DISCONNECT THE INTERRUPT LINE AND THEN EXIT.  THIS I/O REQUEST IS
/ MADE BY THE "REASSIGN" MCR TASK.
/
/ FIRST, RETURN THE I/O REQUEST NODE TO THE POOL OF EMPTY NODES.
/
PREXIT	LAC	(POOL)		/ADDRESS OF THE HEAD
	DAC*	(R1)		/OF THE EMPTY POOL.
	LAC	PRRQND		/ADDRESS OF THE NODE
	DAC*	(R2)		/TO BE RETURNED.
	JMS*	(NADD)		/ADD THE NODE TO THE POOL.
				/(R1, R2, R6, XR & AC ARE ALTERED).
/
/ NOTE -- CONTROL COMES HERE FROM THE PRINIT CODE IF THE CONNECT
/ IS NOT SUCCESSFUL.
/
	CAL	PRCNCT		/DISCONNECT THE INTERRUPT LINE.
PRUNDO	.INH			/INHIBIT INTERRUPTS.
	DZM*	PRPDEV		/CLEAR THE TRIGGER EVENT VARIABLE ADDRESS
	IDX	PRPDEV		/AND THE "REQUEST INHIBIT" FLAG IN THE
	DZM*	PRPDEV		/PHYSICAL DEVICE NODE.
	.ENB			/ENABLE INTERRUPTS.
	CAL	(10)		/EXIT.
/
/ HINF (HANDLER INFORMATION) FUNCTION. SET THE REQUESTOR'S EVENT
/ VARIABLE TO INDICATE DEVICE CODE 6 AND THAT THE HANDLER PERFORMS
/ ONLY NON-DIRECTORY-ORIENTED INPUT.
/
PRHINF	LAC	(200006)
	JMP	PRSREV
	.TITLE *** READ INITIATION
/
/ READ FROM THE READER.
/
PRREAD	LAC	PRMODE		/LEGAL MODES: 0 THRU 3.
	SPA
	JMP	PRIMDE		/ILLEGAL DATA MODE.
	AAC	-4
	SMA
	JMP	PRIMDE		/ILLEGAL DATA MODE.
/
/ IF THE DATA MODE IS IOPS ASCII, TRUNCATE THE BUFFER SIZE TO AN
/ EVEN NUMBER SINCE WORD PAIRS ARE ALWAYS STORED.
/
	SAD	PRMIN2
	SKP
	JMP	.+4
PRMIN2	777776
	AND	PRBFSZ
	DAC	PRBFSZ
/
/ THE BUFFER SIZE MUST BE LARGER THAN 2, SINCE MODES 0 THRU 3 REQUIRE
/ A LINE BUFFER HEADER.
/
	LAC	PRBFSZ
	SPA
	JMP	PRIBSZ		/ILLEGAL BUFFER SIZE.
	AAC	-3
	SPA
	JMP	PRIBSZ		/ILLEGAL BUFFER SIZE.
	TAD	(-773)		/DOES THE SIZE EXCEED 776?
	SPA!SNA
	JMP	.+3		/NO.
	LAC	(776)		/YES -- LIMIT THE SIZE TO
	DAC	PRBFSZ		/776 SINCE THE LARGEST RE-
				/CORDABLE WORD-PAIR-COUNT
				/IS 377.
/
/ VERIFY THAT THE LINE BUFFER LIES ENTIRELY WITHIN THE TASK'S PARTITION
/ AND ADJUST THE HEADER ADDRESS TO 17 BITS.
/
	LAC	PRRQND		/ADDRESS OF THE I/O REQUEST NODE.
	DAC*	(R2)
	LAC	PRHEAD		/ADDRESS OF THE HEADER.
	DAC*	(R3)
	LAC	PRBFSZ		/BUFFER SIZE.
	DAC*	(R4)
	JMS*	(VAJX)		/(R3, R5, XR & AC ARE ALTERED).
				/ERROR?
	JMP	PRXPER		/YES -- LINE BUFFER EXCEEDS PARTITION BOUNDS.
	LAC*	(R3)		/NO -- STORE THE ADJUSTED HEADER ADDRESS
	DAC	PRHEAD		/AND ALSO SET UP THE DATA POINTER.
	DAC	PRDPTR
/
/ INITIALIZE DATA VARIABLES AND FLAGS.
/
	DZM	PRDTWC		/CLEAR THE DATA WORD COUNT (USED TO
				/COMPUTE THE HEADER WORD PAIR COUNT).
	DZM	PRPERR		/CLEAR THE FLAG THAT SAYS (IF NON-0)
				/A PARITY ERROR WAS DETECTED.
	DZM	PRXCES		/CLEAR THE FLAG THAT SAYS (IF NON-0)
				/THAT ANY DATA READ FROM THE READER IS
				/"EXCESS DATA".  THIS WILL OCCUR WHEN
				/THE REQUESTOR'S LINE BUFFER IS TOO 
				/SMALL TO HOLD THE ENTIRE TAPE RECORD.
	DZM	PRSKXS		/CLEAR THE FLAG THAT INDICATES (IF NEGATIVE)
				/THE NUMBER OF EXCESS IOPS BINARY DATA
				/WORDS IN THE CURRENT RECORD.
	DZM	PREOFF		/CLEAR THE IOPS ASCII END-OF-FILE FLAG.
	LAW	-1		/SET "IOPS BINARY HEADER FLAG"
	DAC	PRIBHD		/SO THAT ISZ CAN BE USED TO
				/DETECT THE FIRST WORD READ IN AN IOPS
				/BINARY RECORD.
	LAW	-3		/INITIALIZE IOPS & IMAGE
	DAC	PR3CNT		/BINARY COUNT OF 3 TAPE FRAMES
				/PER BINARY WORD.
	LAC	PRHEAD		/SET XR TO POINT TO HEADER.
	JMS	PRADJX
	DZM	0,X		/INITIALIZE HEADER WORD 0 TO 0
				/(CLEAR THE DATA VALIDITY BITS).
	DZM	PRCKSM		/INITIALIZE THE CHECKSUM WORD TO 0.
	LAW	-5		/INITIALIZE THE 5/7 ASCII
	DAC	PRBCNT		/BYTE COUNT USED BY THE CHARACTER
				/PACKING ROUTINE.
/
/ THE DATA POINTER IS NOW POINTING TO THE LINE BUFFER HEADER ADDRESS.
/ FOR IOPS BINARY MODE (MODE 0) THE HEADER WORD PAIR MUST
/ FIRST BE READ IN FROM THE TAPE, SO DON'T CHANGE THE DATA POINTER.
/ FOR IMAGE MODES AND FOR IOPS ASCII THERE IS NO HEADER ON THE TAPE;
/ THEREFORE, THE DATA POINTER MUST BE MOVED PAST THE HEADER WORD PAIR.
/
	LAC	PRMODE		/DATA MODE.
	SNA
	JMP	.+3		/IOPS BINARY.
	JMS	PRNXWD		/ADD 2 TO THE DATA
	JMS	PRNXWD		/POINTER & DATA WORD COUNT.
				/(PRDPTR & PRDTWC ARE ALTERED).
/
/ REQUEST 1 TAPE LINE TO BE READ AND WAIT FOR THE EVENT VARIABLE TO 
/ BE SET BY THE INTERRUPT SERVICE ROUTINE.
/
PRLINE	DZM	PR.EV		/CLEAR THE EVENT VARIABLE.
	IORS			/BEFORE READING, CHECK STATUS
	AND	(001000)	/TO SEE IF THE READER IS
	SZA			/"OFF LINE" OR "OUT-OF-TAPE".
	JMP	PRNOTP		/YES.
/
	RSA			/READ AN 8-BIT TAPE FRAME. IF THE
				/READER HAPPENS TO BE SET "OFF LINE"
				/AT THIS POINT, THE CONDITION IS IGNORED.
	JMS	PRABRT		/WAITFOR COMPLETION, THEN CHECK IF
				/AN ABORT REQUEST HAS BEEN QUEUED. IF SO,
				/PERFORM I/O RUNDOWN. CONTROL WILL NOT
				/RETURN HERE IF THE I/O IN PROGRESS WAS
	JMP	PRRDOK		/INITIATED BY THE ABORTED TASK.
/
/ READER IS EITHER "OUT OF TAPE" OR "OFF LINE".  "TYPE" A MESSAGE TO 
/ THAT EFFECT ON LUN 3, THE OUTPUT SIDE OF THE MCR TTY.
/
PRNOTP	CAL	PRTYPE		/TYPE MESSAGE AND
	JMS	PRABRT		/WAITFOR COMPLETION, THEN CHECK IF AN
				/ABORT REQUEST HAS BEEN QUEUED. IF SO,
				/PERFORM I/O RUNDOWN. CONTROL WILL NOT
				/RETURN HERE IF THE I/O IN PROGRESS WAS
				/INITIATED BY THE ABORTED TASK.
/
/ PERIODICALLY CHECK TO SEE IF THE "OUT OF TAPE" OR "OFF LINE" CONDITION
/ HAS BEEN REMEDIED.
/
PRDLAY	CAL	PRMKTM		/MARK TIME FOR 10 TICKS.
	JMS	PRABRT		/WAITFOR COMPLETION, THEN CHECK IF AN
				/ABORT REQUEST HAS BEEN QUEUED. IF SO,
				/PERFORM I/O RUNDOWN. CONTROL WILL NOT
				/RETURN HERE IF THE I/O IN PROGRESS WAS
				/INITIATED BY THE ABORTED TASK.
	IORS			/READ I/O STATUS.
	AND	(001000)
	SNA			/TAPE READER O.K.?
	JMP	PRLINE		/YES -- TRY AGAIN.
	JMP	PRDLAY		/NO -- CHECK AGAIN LATER.
/
/ TAPE FRAME HAS BEEN READ IN.
/
PRRDOK	LAC	PR.EV
	AND	(377)		/STORE 8-BIT TAPE
	DAC	PRCHAR		/FRAME.
/
/ DISPATCH TO THE APPROPRIATE DATA MODE PROCESSING ROUTINE.
/
	LAC	PRMODE
	PAX
	JMP	PRDTAB,X
/
/ DISPATCH TABLE.
/
PRDTAB	JMP	PRMDE0		/IOPS BINARY.
	JMP	PRMDE1		/IMAGE BINARY.
	JMP	PRMDE2		/IOPS ASCII.
	JMP	PRMDE3		/IMAGE ASCII.
	.TITLE ***   IOPS BINARY (MODE 0)
/
/ PROCESS IOPS BINARY TAPE FRAME.
/
PRMDE0	JMS	PRPRTY		/COMPUTE THE PARITY OF THE 8-BIT TAPE
				/FRAME (RESULT IN PR.PAR).  (LINK, AC,
				/PR.CNT & PR.PAR ARE ALTERED).
/
/ TAPE FRAME BIT 8 IS IN THE LINK AND TAPE FRAME BITS 7 THRU 1 ARE IN
/ BITS 0 THRU 6 OF THE AC.
/
/ IN IOPS BINARY, ALL TAPE FRAMES MUST HAVE BIT 8=1.
/
	SNL!RCL			/BINARY FRAME?
	JMP	PRLINE		/NO -- IGNORE IT
				/AND READ ANOTHER FRAME.
	LMQ			/YES -- SAVE THE 6-BIT DATA FRAME IN
				/BITS 0-5 OF THE MQ.
/
/ CHECK IF THIS IS EXCESS DATA (REQUESTOR'S LINE BUFFER IS TOO SMALL
/ TO HOLD THE CURRENT IOPS BINARY LINE).
/
	LAC	PRXCES		/IS THIS EXCESS DATA?
	SZA
	JMP	PRIBXS		/YES -- IGNORE IT.
/
/ ADD THE CURRENT 6-BIT FRAME TO THE CURRENT DATA WORD.
/
	LAC	PRDPTR		/SET THE DATA WORD POINTER IN THE XR.
	JMS	PRADJX
	CLL
	LAC	0,X
	LLS	6
	DAC	0,X
/
/ CHECK THE TAPE FRAME PARITY (PR.PAR).  IF BIT 17=1, THE PARITY IS ODD
/ (O.K.).  IF NOT, SET "PRPERR" NON-0 TO INDICATE THAT A PARITY 
/ ERROR OCCURRED.
/
	LAC	PR.PAR
	RAR			/BIT 17 TO LINK.
	SNL!CLC			/SKIP IF ODD PARITY.
	DAC	PRPERR		/NO -- FLAG A PARITY ERROR.
/
/ HAVE 3 TAPE FRAMES BEEN ASSEMBLED YET?
/
	ISZ	PR3CNT		/INDEX 3 BYTE COUNT.
	JMP	PRLINE		/NO -- STILL ASSEMBLING A WORD.
				/GO GET NEXT TAPE FRAME.
/
	.EJECT
/ "PRIBHD" IS SET INITIALLY TO -1 SO THAT THE ISZ BELOW WILL SKIP ONLY
/ WHEN THE FIRST DATA WORD IS IN.  THE FIRST DATA WORD IS THE FIRST 
/ WORD OF THE LINE BUFFER HEADER, AND IT CONTAINS THE WORD PAIR COUNT
/ WHICH INDICATES THE SIZE OF THE IOPS BINARY RECORD.
/
	ISZ	PRIBHD		/IS THIS THE HEADER?
	JMP	PRDATA		/NO -- NORMAL DATA WORD.
/
/ HEADER WORD 0 WAS JUST READ IN FROM THE TAPE.  VALIDATE IT BY MAKING
/ SURE THAT THE DATA MODE IS IOPS BINARY (0) OR END-OF-FILE (5), THAT THE
/ DATA VALIDITY BITS ARE ZERO, AND THAT THE WORD PAIR COUNT IS NON-0.
/ IGNORE BITS 9-10-11 WHICH MAY BE NON-0 IF THE TAPE WAS PUNCHED IN THE
/ ADVANCED SOFTWARE SYSTEM.
/
	LAC	PRHEAD		/SET THE HEADER ADDRESS IN THE XR.
	JMS	PRADJX
	LAC	0,X		/EXAMINE RIGHT HALF OF HEADER WORD 0
	AND	(077)		/IGNORING BITS 9-10-11.
	SAD	(5)		/END-OF-FILE?
	JMP	.+3		/YES -- O.K.
	SZA
	JMP	PRIIBH		/ILLEGAL IOPS BINARY HEADER.
/
	LAC	0,X		/GET HEADER WORD 0.
	SWHA			/CONVERT THE WORD
	RAL			/PAIR COUNT TO A
	AND	(776)		/WORD COUNT.
	SNA
	JMP	PRIWPC		/ERROR -- WORD PAIR COUNT = 0.
	PAL			/TEMPORARILY SAVE WORD COUNT OF
				/RECORD SIZE.
	TCA			/COMPARE TAPE RECORD SIZE
	TAD	PRBFSZ		/TO LINE BUFFER SIZE.
	SMA
	JMP	PRBFOK		/BUFFER SIZE IS LARGE ENOUGH.
/
/ THE REQUESTOR'S LINE BUFFER IS NOT LARGE ENOUGH TO HOLD THE ENTIRE 
/ IOPS BINARY RECORD.  STORE ONLY SO MUCH AS WILL FIT AND FLAG THIS
/ CONDITION IN THE LINE BUFFER HEADER.  "PR.WC" IS ALREADY SET WITH THE
/ 2'S COMPLEMENT OF THE BUFFER SIZE SO THAT ONLY THAT AMOUNT IS STORED.
/ SET "PRSKXS" WITH THE 2'S COMPLEMENT OF THE NUMBER OF EXCESS DATA
/ WORDS IN THE BINARY RECORD.  WHEN "PR.WC" GOES TO 0 AND "PRSKXS"
/ IS NEGATIVE, THE "PRXCES" FLAG IS SET NON-0 TO INDICATE THAT INCOMING
/ TAPE WORDS ARE TO BE IGNORED AS EXCESS DATA.  BUFFER SIZE MINUS RECORD
/ SIZE IS IN THE AC.
/
	DAC	PRSKXS
	LAC	PRBFSZ		/CHANGE THE WORD-PAIR-COUNT IN THE LINE
	DAC	PRDTWC		/BUFFER HEADER TO INDICATE THE BUFFER
				/SIZE, NOT THE RECORD SIZE.
	JMS	PRSETH		/(XR, LINK & AC ARE ALTERED).
/
	.EJECT
/ NOTE -- PRDTWC WILL BE INCREMENTED AS DATA WORDS ARE STORED AND THEREFORE
/ WILL NOT REFLECT THE TRUE DATA COUNT. HOWEVER, PRDTWC IS NO LONGER
/ REFERENCED.
/
	LAC	(60)		/SET DATA VALIDITY BITS TO
	JMS	PRSETV		/INDICATE "SHORT BUFFER".
				/(XR, AC & MQ ARE ALTERED).
	JMP	PRDATA
/
/ THE REQUESTOR'S LINE BUFFER IS LARGE ENOUGH TO HOLD THIS IOPS
/ BINARY RECORD.  THEREFORE, SET "PR.WC" WITH THE 2'S COMPLEMENT OF
/ THE RECORD SIZE.  THE RECORD SIZE IS NOW IN THE LR.
/
PRBFOK	PLA
	TCA
	DAC	PR.WC
/
/ ADD THE CURRENT DATA WORD TO THE CHECKSUM, INDEX THE DATA WORD 
/ POINTER AND DATA WORD COUNT, AND TEST FOR THE "END OF RECORD OR BUFFER"
/ CONDITION.
/
PRDATA	LAC	PRDPTR		/SET THE DATA WORD ADDRESS IN THE XR.
	JMS	PRADJX
	LAC	0,X
	TAD	PRCKSM
	DAC	PRCKSM
	JMS	PRNXWD		/INDEX DATA POINTER & COUNT
				/(PRDPTR & PRDTWC ALTERED).
	ISZ	PR.WC
	JMP	PRNXIB		/PREPARE FOR NEXT DATA WORD.
/
/ EITHER THE LINE BUFFER IS FULL OR THE END OF RECORD WAS REACHED.  IF
/ THE FORMER (INDICATED BY THE FACT THAT THE CONTENTS OF "PRSKXS"
/ IS NEGATIVE), THEN THE REMAINDER OF THE RECORD MUST BE READ IN AND
/ IGNORED.  DO SO BY SETTING "PRXCES" NON-0.
/
	LAC	PRSKXS		/IS THE RECORD TOO LONG?
	SMA
	JMP	PRIBND		/NO -- IOPS BINARY END.
	DAC	PRXCES		/YES -- SET "EXCESS DATA" FLAG.
/
/ PREPARE FOR NEXT IOPS OR IMAGE BINARY WORD.
/
PRNXIB	LAW	-3		/RESET THE COUNT OF 3
	DAC	PR3CNT		/TAPE FRAMES PER BINARY WORD.
	JMP	PRLINE		/READ IN NEXT WORD.
/
	.EJECT
/ COME HERE TO BYPASS EXCESS IOPS BINARY DATA WHEN THE REQUESTOR'S LINE
/ BUFFER IS TOO SHORT TO HOLD THE ENTIRE RECORD.  NOTE THAT CONTROL 
/ COMES HERE ON EVERY TAPE FRAME (INSTEAD OF ON EVERY BINARY WORD), SO
/ THAT THE FRAME IS NOT ADDED TO THE REQUESTOR'S LINE BUFFER AND A
/ PARITY ERROR CHECK IS NOT MADE.
/
PRIBXS	ISZ	PR3CNT		/SKIP WHEN 3 TAPE FRAMES ARE IN.
	JMP	PRLINE		/NO -- READ NEXT FRAME.
	ISZ	PRSKXS		/INDEX COUNT OF EXCESS WORDS.
	JMP	PRNXIB		/NOT DONE -- READ ANOTHER WORD.
/
/ END OF IOPS BINARY INPUT -- THE IOPS BINARY RECORD HAS BEEN COMPLETELY
/ READ.  ONLY ONE OF THREE ERROR CONDITIONS CAN BE STORED IN THE LINE
/ BUFFER HEADER, SO IF TWO ERRORS OCCUR AT ONE TIME THE ORDER OF PRECE-
/ DENCE IS AS FOLLOWS:  PARITY ERROR, THEN SHORT LINE BUFFER (ALIAS 
/ RECORD TOO LONG), AND FINALLY CHECKSUM ERROR.
/
PRIBND	LAC	PRPERR		/DID A PARITY ERROR OCCUR?
	SZA!CLA
	JMP	PRPARE		/YES -- TAKES PRECEDENCE.
/
/ BEFORE TESTING FOR A CHECKSUM ERROR, SEE IF THE DATA VALIDITY BITS 
/ HAVE ALREADY BEEN SET BECAUSE OF A "SHORT BUFFER" ERROR.
/
	LAC	PRHEAD		/SET THE HEADER ADDRESS IN THE XR.
	JMS	PRADJX
	LAC	0,X		/"SHORT BUFFER" ERROR?
	AND	(60)
	SZA
	JMP	PRRQOC		/YES -- READ REQUEST COMPLETED.
	SAD	PRCKSM		/NO -- IS THE CHECKSUM 0.
	JMP	PRRQOC		/YES -- CHECKSUM O.K.
	LAC	(20)		/NO -- CHECKSUM ERROR.
PRPARE	TAD	(20)		/PARITY ERROR.
	JMS	PRSETV		/SET ERROR CODE IN DATA VALIDITY BITS 
				/IN LINE BUFFER HEADER WORD 0.
				/(XR, AC & MQ ARE ALTERED).
	JMP	PRRQOC		/READ REQUEST OPERATION COMPLETED.
	.TITLE ***   IMAGE BINARY (MODE 1)
/
/ PROCESS IMAGE BINARY TAPE FRAME.
/
PRMDE1	JMS	PRPRTY		/COMPUTE THE PARITY OF THE 8-BIT 
				/TAPE FRAME.  (LINK, AC, PR.CNT &
				/PR.PAR ARE ALTERED).
/
/ THE PARITY IS IGNORED IN THIS MODE (AS IT WOULD HAVE BEEN HAD THE
/ RSB IOT BEEN USED INSTEAD OF RSA).  TAPE FRAME BIT 8 IS IN THE LINK
/ AND TAPE FRAME BITS 7 THRU 1 ARE IN BITS 0 THRU 6 OF THE AC.
/
	SNL!RCL			/BINARY FRAME?
	JMP	PRLINE		/NO -- IGNORE IT AND READ NEXT FRAME.
	LMQ			/YES -- SAVE THE 6-BIT DATA FRAME IN 
				/BITS 0-5 OF THE MQ.
/
/ ADD THE 6-BIT DATA FRAME TO THE CURRENT DATA WORD.
/
	LAC	PRDPTR		/SET THE DATA WORD ADDRESS IN THE XR.
	JMS	PRADJX
	CLL
	LAC	0,X
	LLS	6
	DAC	0,X
/
/ HAVE 3 TAPE FRAMES BEEN ASSEMBLED YET?
/
	ISZ	PR3CNT
	JMP	PRLINE		/NO -- STILL ASSEMBLING A BINARY WORD.
				/READ IN NEXT TAPE FRAME.
/
/ A DATA WORD HAS BEEN STORED IN THE REQUESTOR'S LINE BUFFER.  INDEX
/ THE DATA POINTER AND DATA WORD COUNT AND TEST TO SEE IF THE BUFFER IS
/ FULL.  THIS CODE IS USED IN COMMON WITH IMAGE ASCII.
/
PRNEXT	JMS	PRNXWD		/INDEX THE DATA POINTER & COUNT.
				/(PRDPTR & PRDTWC ARE ALTERED).
	LAC	PRDTWC		/IS THE BUFFER FULL?
	SAD	PRBFSZ
	SKP
	JMP	PRNXIB		/NO -- PREPARE FOR THE NEXT IMAGE BINARY
				/WORD BY RESETTING THE "3 FRAMES PER
				/BINARY WORD" COUNT AND THEN READING THE
				/NEXT FRAME.  NOTE -- THIS HAS NO EFFECT
				/ON IMAGE ASCII.
/
/ THE REQUESTOR'S LINE BUFFER IS FULL.  SET HEADER WORD 0 IN THE LINE
/ BUFFER WITH THE WORD PAIR COUNT AND THE DATA MODE.
/
	JMS	PRSETH		/SET LINE BUFFER HEADER.
				/(XR, LINK & AC ARE ALTERED).
	JMP	PRRQOC		/READ REQUEST OPERATION COMPLETE.
	.TITLE ***   IOPS ASCII (MODE 2)
/
/ PROCESS IOPS ASCII TAPE FRAME.
/
PRMDE2	LAC	PRCHAR
	AND	(177)
/
/ IF THE CHARACTER IS ONE OF THE 3 POSSIBLE FORMS OF
/ ALTMODE (33, 175, OR 176), CONVERT IT TO THE
/ PDP-15 STANDARD CODE 175.  IN ADDITION, TO FACIL-
/ ITATE END-OF-LINE TESTING LATER ON, MAKE ALTMODE
/ AND CARRIAGE RETURN NEGATIVE.  ALSO, CHECK FOR
/ CTRL D (EOT) WHICH IS TO BE TREATED AS AN
/ END-OF-FILE. LEAVE THE RESULT IN THE LR.
/
	SAD	(15)		/CARRIAGE RETURN.
	LAW	15
	SAD	(175)		/STANDARD PDP-15 ALTMODE.
	LAW	175
	SAD	(176)		/OLD FORM OF ALTMODE.
	LAW	175
	SAD	(33)		/NEW ASCII STANDARD ALTMODE.
	LAW	175
	SAD	(04)		/CTRL D -- EOT?
	DAC	PREOFF		/YES -- SIGNAL END-OF-FILE.
	SAD	(04)		/CTRL D -- EOT?
	LAW	15		/YES -- CHANGE IT INTO A
				/CARRIAGE RETURN.
	PAL			/SAVE VALUE IN LR.
/
/ CHECK IF THIS IS EXCESS DATA (REQUESTOR'S LINE
/ BUFFER IS TOO SMALL TO HOLD THE CURRENT
/ IOPS ASCII LINE).
/
	LAC	PRXCES		/IS THIS EXCESS DATA?
	SZA
	JMP	PRIAXS		/YES -- IGNORE IT.
/
/ CHECK CHARACTER PARITY.
/
	JMS	PRPRTY		/COMPUTE THE PARITY OF THE
				/8-BIT TAPE FRAME
				/(RESULT IN PR.PAR).
				/(LINK, AC, PR.CNT & PR.PAR ALTERED).
/
/ IOPS ASCII REQUIRES EVEN PARITY CHARACTERS,
/ I.E., BIT 17 OF "PR.PAR" MUST BE 0.
/
	LAC	PR.PAR	
	RAR			/BIT 17 TO LINK.
	SZL!CLC			/SKIP IF EVEN PARITY.
	DAC	PRPERR		/NO -- FLAG A PARITY ERROR.
/
/ IGNORE ALL NULL AND RUBOUT CHARACTERS, NULLS
/ TYPICALLY APPEAR AS THE BLANK LEADER AT THE
/ BEGINNING OF A TAPE. RUBOUTS APPEAR WHERE
/ CHARACTERS WERE DELETED DURING OFF-LINE
/ TAPE PREPARATION OR AS FILLERS TO PROVIDE
/ A NECESSARY DELAY AFTER SUCH CHARACTERS
/ AS HORIZONTAL TAB, VERTICAL TAB, AND
/ FORM FEED.
/
	PLA			/GET THE CHARACTER.
	SZA			/SKIP IF NULL.
	SAD	(177)		/SKIP IF NOT RUBOUT.
	JMP	PRLINE		/IGNORE NULL OR RUBOUT
				/AND READ ANOTHER TAPE FRAME.
/
/ STORE THE CHARACTER IN THE REQUESTOR'S LINE BUFFER.
/
	PLA	
	JMS	PRPACK		/PACK IN IOPS ASCII FORMAT
				/(LINK, AC, MQ & XR ARE ALTERED).
/
/ CHECK IF THE CHARACTER IS A LINE TERMINATOR.
/
	PLA			/THE LR IS NEGATIVE IF THE
	SMA			/CHARACTER IS CAR. RET. OR ALTMODE.
	JMP	PRLINE		/NO -- READ ANOTHER CHARACTER.
/
/ LINE TERMINATOR FOUND.  IN CASE THE LAST IOPS ASCII
/ WORD PAIR WAS NOT COMPLETELY FILLED, STORE ZEROS
/ (NULL CHARACTERS) TO FILL IT OUT.
/
PR.PAD	LAW	-5		/IS THE LAST WORD PAIR FULL?
	SAD	PRBCNT
	JMP	PRFULL		/YES.
	CLA			/NULL CHARACTER -- DON'T MODIFY THE LR.
	JMS	PRPACK		/PACK IOPS ASCII CHARACTER.
				/(LINK, AC, MQ & XR ARE ALTERED).
	JMP	PR.PAD
/
/ SET LINE BUFFER HEADER WORD 0 WITH THE WORD
/ PAIR COUNT AND DATA MODE, AND SET THE DATA VALIDITY
/ BITS TO INDICATE A PARITY ERROR IF ONE OCCURRED.
/
PRFULL	JMS	PRSETH		/SET HEADER WORD 0.
				/(XR, LINK & AC ARE ALTERED).
	LAC	PRPERR		/DID A PARITY ERROR OCCUR?
	SNA
	JMP	.+3		/NO.
	LAC	(20)		/YES -- SET THE DATA
	JMS	PRSETV		/VALIDITY BITS.
				/(XR, AC & MQ ARE ALTERED).
/
	.EJECT
/ IF AN END-OF-FILE WAS ENCOUNTERED, CHANGE THE MODE IN HEADER WORD 0
/ TO 5 (WHICH MEANS END-OF-FILE).
/
PRCEOF	LAC	PREOFF		/SKIP IF AN END-OF-FILE OCCURRED.
	SNA
	JMP	PRCHKS		/NO.
	LAC	PRHEAD		/YES -- CHANGE THE MODE FROM 2 TO 5.
	JMS	PRADJX
	LAC	0,X
	AAC	+3
	DAC	0,X
/
/ A CHECKSUM IS NOT COMPUTED FOR IOPS ASCII INPUT.
/
PRCHKS	IDX	PRHEAD		/INDEX THE HEADER POINTER TO HEADER WORD 1,
	LAC	PRHEAD		/SET THE CHECKSUM WORD TO 0.
	JMS	PRADJX
	DZM	0,X
	JMP	PRRQOC		/READ REQUEST OPERATION COMPLETED.
/
/ TRANSFER HERE TO BYPASS EXCESS DATA ON TAPE.  THE END
/ OF THE REQUESTOR'S LINE BUFFER WAS REACHED BEFORE
/ A LINE TERMINATOR WAS READ FROM THE TAPE.  CON-
/ TINUE READING UNTIL A TERMINATOR IS FOUND, BUT
/ IGNORE THE CHARACTERS.  A TERMINATOR IS FOUND
/ WHEN THE LR IS NEGATIVE.
/
PRIAXS	PLA			/TERMINATOR?
	SMA
	JMP	PRLINE		/NO -- FETCH ANOTHER CHARACTER.
	JMP	PRCEOF		/YES -- CHECK FOR END-OF-FILE.
/
	.EJECT
/ SUBROUTINE PRPACK -- PACKS CHARACTERS FROM THE AC INTO
/ THE REQUESTOR'S LINE BUFFER IN IOPS ASCII FORMAT.
/ EACH CHARACTER IS STORED SEPARATELY IN AN INTERMED-
/ IATE 5-WORD BUFFER UNTIL 5 CHARACTERS HAVE BEEN
/ RECEIVED.  THEN THE 5 CHARACTERS ARE PACKED INTO 
/ IOPS ASCII FORM (2 WORDS) AND STORED IN THE
/ LINE BUFFER.  IF THE LAST WORD PAIR IS ABOUT TO
/ BE STORED AND A LINE DELIMITER IS NOT IN THE
/ LR (LR POSITIVE IN SUCH A CASE), BUFFER OVERFLOW
/ HAS OCCURRED AND THE LINE BUFFER DATA VALI-
/ DITY BITS ARE SET TO INDICATE A "SHORT BUFFER"
/ ERROR.  IN ADDITION, THE LAST STORED CHARACTER
/ IS CHANGED TO A CARRIAGE RETURN, SINCE MANY
/ PROGRAMS EXPECT A LINE TERMINATOR.  THE "EXCESS
/ DATA" FLAG IS SET NON-0 TO INDICATE THAT THE
/ REMAINDER OF THE TAPE LINE MUST BE READ AND
/ IGNORED (TO GET IN POSITION FOR THE NEXT LINE).
/ FINALLY, IF BUFFER OVERFLOW OCCURRED, THE DATA
/ VALIDITY BITS ARE SET TO INDICATE A PARITY
/ ERROR (IF ONE EXISTED); A PARITY ERROR ANNOUNCE-
/ MENT TAKES PRECEDENCE OVER A SHORT LINE BUFFER.
/
/ PRIOR TO THE FIRST CALL TO THIS SUBROUTINE, "PRBCNT"
/ (5 CHARACTER BYTE COUNT) MUST BE SET TO -5.
/
/ CALLING SEQUENCE:
/
/	LAST-DATA-CHARACTER IN THE LR (MUST REMAIN UNCHANGED)
/	CHARACTER-TO-BE-STORED IN THE AC
/	JMS	PRPACK
/	(UNCONDITIONAL RETURN)
/
/ ALTERED REGISTERS:
/
/	LINK, AC, MQ & XR
/
PRPACK	0
	AND	(177)
	LMQ			/SAVE CHARACTER IN THE MQ.
	LAC	PRBCNT		/5/7 ASCII BYTE COUNT (STARTS AT -5).
	PAX
	LACQ			/RESTORE CHARACTER TO AC
	DAC	PRTBUF+5,X	/AND STORE IT IN THE 
				/TEMPORARY BUFFER.
/
/ CHECK IF 5 CHARACTERS HAVE BEEN RECEIVED.
/
	ISZ	PRBCNT
	JMP*	PRPACK		/NO -- WAIT FOR MORE.
/
	.EJECT
/ 5 CHARACTERS ARE IN THE TEMPORARY BUFFER.  ADD 2
/ TO THE DATA WORD COUNT AND TEST TO SEE IF
/ THE LAST WORD PAIR IN THE LINE BUFFER IS ABOUT
/ TO BE FILLED.
/
	LAC	PRDTWC
	AAC	+2
	DAC	PRDTWC
	SAD	PRBFSZ		/END OF BUFFER REACHED?
	SKP			/YES.
	JMP	PRCONV		/NO -- CONVERT & STORE.
/
/ THE END OF THE REQUESTOR'S LINE BUFFER HAS BEEN
/ REACHED.  DOES THE FINAL WORD PAIR CONTAIN A LINE
/ TERMINATOR (ALTMODE OR CARRIAGE RETURN)?  IF SO,
/ THIS FACT IS DETERMINED BY CHECKING IF THE
/ CONTENTS OF THE LR ARE NEGATIVE.  IF NOT, THE
/ REQUESTOR'S LINE BUFFER IS TOO SHORT.
/
	PLA			/IS THE LAST SIGNIFICANT CHARACTER
	SPA!CLC			/(THIS EXCLUDES NULLS) A LINE TERMINATOR?
	JMP	PRCONV		/YES -- O.K. TO CONVERT & STORE.
/
/ THE BUFFER IS FULL BUT A LINE TERMINATOR HASN'T YET
/ BEEN ENCOUNTERED.  SET "PRXCES" NON-0 TO INDICATE
/ THAT SUBSEQUENT CHARACTERS ARE EXCESS DATA
/ AND ARE TO BE IGNORED.  CHANGE THE FIFTH CHARACTER
/ IN THE FINAL WORD PAIR TO A CARRIAGE RETURN.
/
	DAC	PRXCES		/SET "EXCESS DATA" FLAG NON-0.
	LAC	(15)		/CARRIAGE RETURN.
	DAC	PRTBUF+4
/
/ SET UP LINE BUFFER HEADER WORD 0 WITH THE WORD
/ PAIR COUNT, DATA MODE, AND DATA VALIDITY BITS.
/ DATA VALIDITY WILL BE SET TO "SHORT BUFFER"
/ UNLESS OVERRIDDEN BY "PARITY ERROR".
/
	JMS	PRSETH		/SET LINE BUFFER HEADER.
				/(XR, LINK & AC ARE ALTERED).
	LAC	PRPERR		/DID A PARITY ERROR OCCUR?
	SNA!CLA
	LAC	(40)		/NO -- SET "SHORT LINE" ERROR.
	TAD	(20)		/YES -- SET "PARITY ERROR".
	JMS	PRSETV		/SET DATA VALIDITY BITS.
				/(XR, AC & MQ ARE ALTERED).
/
	.EJECT
/ CONVERT THE 5 CHARACTERS INTO PACKED 5/7 ASCII
/ AND STORE THE WORD PAIR IN THE REQUESTOR'S LINE
/ BUFFER.  ALSO, ADD THE WORD PAIR INTO THE CHECKSUM.
/
PRCONV	LAC	PRTBUF+2	/ASSEMBLE THE FIRST 2+1/2
	LRS	7		/CHARACTERS INTO THE MQ
	LAC	PRTBUF+1	/AS THE FIRST WORD OF
	LRS	7		/THE IOPS ASCII WORD PAIR.
	LAC	PRTBUF+0
	LRS	7
	LAC	PRDPTR		/SET THE DATA WORD ADDRESS IN THE XR.
	JMS	PRADJX
	LACQ			/STORE MQ IN LINE BUFFER.
	DAC	0,X
	IDX	PRDPTR		/INDEX THE DATA POINTER.
/
	CLQ			/ASSEMBLE THE LAST 2+1/2
	LAC	PRTBUF+4	/CHARACTERS INTO THE MQ
	LRS	7		/AS THE SECOND WORD OF
	LAC	PRTBUF+3	/THE IOPS ASCII WORD PAIR.
	LRS	7
	LAC	PRTBUF+2
	LRS	3
	LAC	PRDPTR		/SET THE DATA WORD ADDRESS IN THE XR.
	JMS	PRADJX
	LACQ			/STORE MQ IN LINE BUFFER.
	DAC	0,X
	IDX	PRDPTR		/INDEX THE DATA POINTER.
	LAW	-5		/RESET THE 5 CHARACTER BYTE COUNT.
	DAC	PRBCNT
	JMP*	PRPACK
	.TITLE ***   IMAGE ASCII (MODE 3)
/
/ PROCESS IMAGE ASCII TAPE FRAME.
/
PRMDE3	LAC	PRDPTR		/SET THE DATA WORD ADDRESS IN THE XR.
	JMS	PRADJX
	LAC	PRCHAR		/STORE THE 8-BIT FRAME,
	DAC	0,X		/UNMODIFIED, IN THE REQUESTOR'S
				/LINE BUFFER.
	JMP	PRNEXT		/CODE USED IN COMMON WITH
				/IMAGE BINARY.
	.TITLE *** CLOSE
/
/ THE CLOSE FUNCTION ADVANCES TAPE THROUGH THE READER, IGNORING ALL
/ DATA THEREON. THIS METHOD OF UNLOADING A TAPE IS USED SO THAT THE
/ TRAILING EDGE OF A TAPE IS NOT READ AS AN ERRONEOUS DATA FRAME.
/
PRCLOS	DZM	PR.EV		/CLEAR THE EVENT VARIABLE.
	IORS			/CHECK STATUS TO SEE IF THE READER IS
	AND	(001000)	/"OUT-OF-TAPE" OR "OFF LINE".
	SZA
	JMP	PRRQOC		/YES -- DONE.
	RSA			/NO -- READ IN AN 8-BIT TAPE FRAME,
	JMS	PRABRT		/WAITFOR COMPLETION, AND IGNORE IT.
				/THEN, CHECK IF AN "ABORT" REQUEST HAS
				/BEEN QUEUED. IF SO, PERFORM I/O RUNDOWN.
				/CONTROL WILL NOT RETURN HERE IF THE I/O
				/IN PROGRESS WAS INITIATED BY THE ABORTED
				/TASK.
	JMP	PRCLOS		/SEE IF READER IS NOW OUT OF TAPE.
	.TITLE *** REQUEST COMPLETED
/
/ REQUEST OPERATION COMPLETED.
/
PRRQOC	CLA!IAC			/+1 MEANS SUCCESSFUL COMPLETION.
/
/ SET THE REQUESTOR'S EVENT VARIABLE (IF ANY).
/ IF AN ERROR OCCURRED, THE ERROR CODE IS IN
/ THE AC AND ENTRY IS AT THIS LOCATION. THE
/ HINF FUNCTION TRANSFERS HERE WITH THE HINF
/ CODE IN THE AC.
/
PRSREV	PAL			/SAVE VALUE TEMPORARILY.
	LAC	PRRQND		/ADDRESS OF THE I/O REQUEST NODE.
	DAC*	(R2)
	JMS*	(IOCD)		/DECLARE I/O COMPLETED BY DECREMENTING
				/THE COUNT OF PENDING TRANSFERS TO THE
				/TASK'S PARTITION (NORMAL MODE TASK ONLY).
				/(R5, XR & AC ARE ALTERED).
	LAC	PRRQEV		/DID THE REQUESTOR SPECIFY
	SNA			/AN EVENT VARIABLE ADDRESS?
	JMP	PRNOEV		/NO.
	JMS	PRADJX		/YES -- SET ITS ADDRESS IN THE XR.
	PLA
	DAC	0,X		/SET THE EVENT VARIABLE.
/
/ DECLARE A SIGNIFICANT EVENT BY POSTING
/ AN API LEVEL 6 INTERRUPT.
/
PRNOEV	LAC	(401000)
	ISA
/
/ RETURN THE I/O REQUEST NODE TO THE POOL OF EMPTY NODES.
/
	LAC	(POOL)		/ADDRESS OF THE HEAD
	DAC*	(R1)		/OF THE EMPTY POOL.
	LAC	PRRQND		/ADDRESS OF THE NODE
	DAC*	(R2)		/TO BE RETURNED.
	JMS*	(NADD)		/ADD THE NODE TO THE POOL.
				/(R1, R2, R6, XR & AC ARE ALTERED).
	JMP	PRPICK		/PICK ANOTHER I/O REQUEST
				/(IF ANY) FROM THE QUEUE.
/
PRIIBH	LAW	-5		/ILLEGAL IOPS BINARY HEADER WORD 0.
	JMP	PRSREV
PRIMDE	LAW	-7		/ILLEGAL DATA MODE GIVEN IN THE READ CPB.
	JMP	PRSREV
PRIBSZ	LAW	-16		/ILLEGAL BUFFER SIZE GIVEN IN THE READ CPB.
	JMP	PRSREV
PRIWPC	LAW	-23		/ILLEGAL WORD-PAIR-COUNT READ FROM THE TAPE.
	JMP	PRSREV
PRXPER	LAW	-30		/I/O TRANSFER PARAMETER EXCEEDS PARTITION
	JMP	PRSREV		/BOUNDS.
	.TITLE *** INTERRUPT SERVICE
/
/ PAPER TAPE READER INTERRUPT SERVICE ROUTINE.
/
/ THIS LOCATION IS ENTERED AT API LEVEL 2
/ BY THE "JMS* (PR.INT)" INSTRUCTION IN
/ API CHANNEL 10.  THE "CONNECT" WAS
/ PERFORMED IN PR'S INITIALIZATION ROUTINE.
/
PR.INT	0
	DBA			/ENTER PAGE ADDRESSING MODE.
	DAC	PR.AC		/SAVE THE AC.
	RRB			/READ THE READER BUFFER INTO THE
				/AC (10-17) AND CLEAR THE READER FLAG.
	XOR	(200000)	/SET BIT 1 TO INSURE THAT THE EVENT
	DAC	PR.EV		/VARIABLE IS SET NON-0.
/
	LAC	(401000)	/DECLARE A SIGNIFICANT
	ISA			/EVENT BY POSTING AN
				/API LEVEL 6 INTERRUPT.
/
	LAC	PR.AC		/RESTORE THE AC.
	DBR			/DEBREAK AND RESTORE.
	JMP*	PR.INT		/RETURN TO INTERRUPTED LOCATION.
	.TITLE *** MISCELLANEOUS
/
/ SUBROUTINE PRNXWD -- INDEX THE DATA WORD
/ POINTER AND DATA WORD COUNT.
/
/ CALLING SEQUENCE:
/
/	JMS	PRNXWD
/	(UNCONDITIONAL RETURN)
/
/ ALTERED REGISTERS:
/
/	PRDPTR & PRDTWC
/
PRNXWD	0
	IDX	PRDPTR		/INDEX DATA POINTER.
	IDX	PRDTWC		/INDEX DATA WORD COUNT.
	JMP*	PRNXWD
/
/
/
/
/
/ SUBROUTINE PRPRTY -- COMPUTE THE PARITY OF
/ THE 8-BIT TAPE FRAME IN "PRCHAR" AND
/ LEAVE THE RESULT IN BIT 17 OF "PR.PAR".
/ ON RETURN, BIT 8 OF THE FRAME WILL
/ BE IN THE LINK AND BITS 7-1 OF THE
/ FRAME WILL BE IN BITS 0-6 OF THE AC.
/
/ CALLING SEQUENCE:
/
/	JMS	PRPRTY
/	(UNCONDITIONAL RETURN)
/
/ ALTERED REGISTERS:
/
/ 	LINK, AC, PR.CNT & PR.PAR
/
PRPRTY	0
	LAW	-10		/COUNTER FOR 8 BITS.
	DAC	PR.CNT
	DZM	PR.PAR
	LAC	PRCHAR
	RAR
	SZL			/ADD 1 TO PR.PAR FOR
	IDX	PR.PAR		/EVERY 1 BIT.
	ISZ	PR.CNT
	JMP	.-4
	JMP*	PRPRTY
/
	.EJECT
/ SUBROUTINE PRSETH -- SET THE REQUESTOR'S LINE
/ BUFFER HEADER WORD 0 WITH THE WORD PAIR
/ COUNT AND THE DATA MODE.
/
/ CALLING SEQUENCE:
/
/	JMS	PRSETH
/	(UNCONDITIONAL RETURN)
/
/ ALTERED REGISTERS:
/
/	XR, LINK & AC
/
PRSETH	0
	LAC	PRHEAD		/SET THE HEADER ADDRESS IN THE XR.
	JMS	PRADJX
	LAC	PRDTWC		/DATA WORD COUNT (INCLUDES
	IAC			/THE EXISTENCE OF A LINE
	AND	(776)		/BUFFER HEADER WORD PAIR).
	SWHA
	RCR
	XOR	PRMODE		/ADD IN THE DATA MODE.
	DAC	0,X		/STORE IN HEADER WORD 0.
	JMP*	PRSETH
/
/ SUBROUTINE PRSETV -- SETS LINE BUFFER HEADER
/ WORD 0 WITH THE DATA VALIDITY BITS IN THE AC.
/
/ CALLING SEQUENCE:
/
/	DATA VALIDITY BITS (12,13)
/	SET IN THE AC -- REMAINDER
/	OF THE AC SET TO 0
/	JMS	PRSETV
/	(UNCONDITIONAL RETURN)
/
/ ALTERED REGISTERS:
/
/	XR, AC & MQ
/
PRSETV	0
	LMQ			/SAVE AC IN THE MQ.
	LAC	PRHEAD		/SET THE HEADER ADDRESS IN THE XR.
	JMS	PRADJX
	777717			/LAW 17717.
	AND	0,X		/0 THE DATA VALIDITY
				/BITS (12,13) IN THE
				/LINE BUFFER HEADER
	OMQ			/AND OR IN THE DESIRED
				/VALUE FROM THE MQ.
	DAC	0,X
	JMP*	PRSETV
/
/ SUBROUTINE PRADJX -- ADD THE INDEX REGISTER ADJUSTMENT FACTOR TO THE
/ AC AND STORE THE RESULT IN THE XR.
/
/ CALLING SEQUENCE:
/
/	VALUE IN THE AC
/	JMS	PRADJX
/	(UNCONDITIONAL RETURN)
/
/ ALTERED REGISTERS:
/
/	XR & AC
/
PRADJX	0
	TAD	PRXADJ
	PAX
	JMP*	PRADJX
/
/ SUBROUTINE PRABRT -- CALLED TO WAITFOR I/O OR MARK TIME COMPLETION AND
/ THEN TO CHECK IF AN
/ ABORT NODE HAS BEEN PLACED IN THE I/O REQUEST QUEUE. IF SO, I/O RUNDOWN
/ IS PERFORMED. IF THE TASK BEING ABORTED IS NOT THE ONE FOR WHICH I/O
/ IS UNDER WAY, CONTROL WILL RETURN TO THE CALLER. OTHERWISE, THE I/O
/ UNDER WAY IS ALSO ABORTED AND CONTROL PASSES TO THE 'OPERATION COMPLETED'
/ CODE.
/
/ CALLING SEQUENCE:
/
/	JMS	PRABRT
/	(CONDITIONAL RETURN -- SEE ABOVE)
/
/ ALTERED REGISTERS:
/
/	EFFECTIVELY ALL (FOR SIMPLICITY)
/
PRABRT	0
	CAL	PRWFEV		/WAITFOR I/O OR MARK TIME COMPLETION.
	LAC	PRTGEV		/EXAMINE BIT 2 IN THE TRIGGER EVENT
	RTL			/VARIABLE TO SEE IF AN ABORT REQUEST
	SMA			/HAS BEEN QUEUED.
	JMP*	PRABRT		/NO -- RETURN.
/
/ DE-QUEUE THE ABORT REQUEST.
/
	DZM	PRTGEV		/CLEAR THE TRIGGER.
	LAC	PRPDNA		/ADDRESS OF THE PDVL NODE.
	DAC*	(R1)
	JMS*	(DQRQ)		/DE-QUEUE I/O REQUEST.
				/(R1, R2, R4, R5, R6, XR & AC ARE ALTERED).
				/WAS A REQUEST FOUND?
	JMP	PR.TW		/NO -- SHOULD NEVER COME HERE.
	DAC	PRABNA		/YES -- SAVE THE ABORT NODE ADDRESS.
	DAC*	(R2)
	LAC	PRPDNA		/PHYSICAL DEVICE NODE ADDRESS.
	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).
/
/ SAVE PARAMETERS FROM THE ABORT NODE.
/
	LAC	PRABNA		/SET THE XR WITH THE ABORT NODE ADDRESS.
	JMS	PRADJX
	LAC	6,X		/SAVE THE I/O RUNDOWN TASK'S EVENT
	DAC	PRRDEV		/VARIABLE ADDRESS.
	LAC	2,X		/SAVE THE STL NODE ADDRESS OF THE TASK
	DAC	PRABSN		/BEING ABORTED.
/
/ DECREMENT THE 'TRANSFERS PENDING' COUNT.
/
	LAC	PRABNA		/ADDRESS OF THE ABORT REQUEST NODE.
	DAC*	(R2)
	JMS*	(IOCD)		/(R5, XR & AC ARE ALTERED).
/
/ RETURN THE ABORT NODE TO THE EMPTY POOL. THE ABORT NODE ADDRESS
/ SHOULD STILL BE IN 'R2'.
/
	LAC	(POOL)		/ADDRESS OF THE EMPTY POOL LISTHEAD.
	DAC*	(R1)
	JMS*	(NADD)		/ADD NODE TO DEQUE.
				/(R1, R2, R6, XR & AC ARE ALTERED).
/
/ IS THE TASK BEING ABORTED THE ONE FOR WHICH I/O IS UNDER WAY?
/
	LAC	PRABSN
	SAD	PRIOSN
	JMP	PRSUBS		/YES.
	LAC	PRRDEV		/NO -- SET THE XR WITH THE I/O RUNDOWN
	JMS	PRADJX		/EVENT VARIABLE ADDRESS.
	CLA!IAC			/SET THE EVENT VARIABLE.
	DAC	0,X
	JMP*	PRABRT		/CONTINUE I/O.
/
/ CLEAN UP BUT DON'T RETURN FROM THIS SUBROUTINE SINCE THE I/O IN PRO-
/ GRESS IS HEREBY CANCELLED.
/
PRSUBS	LAC	PRRDEV		/SUBSTITUTE THE I/O RUNDOWN TASK'S EVENT
	DAC	PRRQEV		/VARIABLE FOR THAT OF THE TASK BEING
	JMP	PRRQOC		/ABORTED, AND THEN EXIT TO THE 'I/O COM-
				/PLETED' CODE.
	.EJECT
PRTGEV	0			/PR'S TRIGGER EVENT VARIABLE.
PRSKXS	0			/NORMALLY 0. SET NEGATIVE WITH THE TWOS
				/COMPLEMENT OF THE # OF EXCESS IOPS
				/BINARY DATA WORDS WHEN THE USER'S LINE
				/BUFFER IS TOO SMALL.
/
/ CAL PARAMETER BLOCKS.
/
PRWFTG	20			/"WAITFOR"
	PRTGEV			/TRIGGER EVENT VARIABLE.
/
PRWFEV	20			/"WAITFOR"
	PR.EV			/EVENT VARIABLE.
/
/ "CONNECT" AND "DISCONNECT" CPB -- INITIALLY THIS IS USED FOR
/ "CONNECT". THEN THE 11 IS CHANGED TO A 12 AND THE EVENT VARIABLE
/ ADDRESS IS SET TO ZERO IN PREPARATION FOR A "DISCONNECT".
/
PRCNCT	11			/11=CONNECT; 12=DISCONNECT.
	PR.EV			/EVENT VARIABLE ADDRESS (0 IF DISCONNECT).
	10			/API CHANNEL 10.
	PR.INT			/ENTRY POINT TO THE INTERRUPT
				/SERVICE ROUTINE.
/
PRTYPE	2700			/OUTPUT (WRITE) CODE.
	PR.EV			/EVENT VARIABLE ADDRESS.
	LUN
	2			/IOPS ASCII.
	PRMESG			/MESSAGE ADDRESS.
/
PRMESG	10002
	0
	.ASCII	"*** LOAD PAPER READER (OFF LINE)"<15>
/
PRMKTM	13			/MARK TIME CODE.
	PR.EV			/EVENT VARIABLE ADDRESS.
	12			/12 UNITS.
	1			/UNITS=TICKS.
/
	.END	PRINIT
