	.SYSID <	.TITLE PRB. >,< 100>
/
/COPYRIGHT (C) 1975
/DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
/
/THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY
/ON A SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH
/THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS
/SOFTWARE, OR ANY OTHER COPIES THEREOF, MAY NOT BE PRO-
/VIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON
/EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO
/THESE LICENSE TERMS.  TITLE TO AND OWNERSHIP OF THE
/SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.
/
/THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE
/WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COM-
/MITMENT BY DIGITAL EQUIPMENT CORPORATION.
/
/DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY
/OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.
	.EJECT
/ 100	14-JUN-75 (RCHM)	MAKE XVM CHANGES.
	.EJECT
/PRB.
/PRB.=IOPS PAPER TAPE READER HANDLER -- IOPS ASCII ONLY.
/M. SIFNAS/J. MURPHY
/7-30-68
/CALLING SEQUENCE:
/.INIT
/CAL+.DAT SLOT(9-17)
/1
/0
/0
/.READ
/CAL+D.M.(6-8)+.DAT SLOT (9-17)
/10
/LINE BUF. ADDR.
/-WC OF L.B. (2'S COMP)
/.WAIT
/CAL+.DAT SLOT (9-17)
/12
.MED=3
RSF=700101
RCF=700102
RRB=700112
RSA=700104
RSB=700144
	.GLOBL PRB.
PRB.	DAC PRCALP		/CAL POINTER
	DAC PRARGP	/ARG POINTER
	ISZ PRARGP	/INDEX TO FUNCTION ADDR.
	LAC* PRARGP	/FUNCTION
	ISZ PRARGP	/INDEX TO NEXT ARGUMENT.
	TAD (JMP PRTABL
	DAC PRTABL
	IORS		/SET ION-IOF SWITCH
	SMA!CLA	/AS FUNCTION OF ITS STATE
	LAW 17740	/ON ENTRY INTO CAL LEVEL
	TAD PRION
	DAC PRDBK
PRTABL	XX
	JMP PRIN		/1=.INIT
	NOP		/2=.DELET, .RENAM, .FSTAT - IGNORED
	JMP PRSEEK	/3=.SEEK - IGNORED.
	JMP PRER6		/4=.ENTER
	JMP PRER6		/5=.CLEAR
	JMP PRWAIT		/6=.CLOSE
	JMP PRDBK		/7=.MTAPE - IGNORED.
	JMP PRRED		/10=.READ
	JMP PRER6		/11=.WRITE
	JMP PRWATR		/12=.WAIT OR .WAITR
PRER6	LAW 6		/ILL. FUNCTION-CAL ADDR IN .MED
	JMP* (.MED+1
PRER67	LAW 67			/(RCHM-100)
	JMP* (.MED+1)		/(RCHM-100)
/INIT PTR ROUTINE
PRIN	ISZ PRARGP	/INDEX TO BUFFER SIZE RETURN REGISTER.
	LAC (64
	DAC* PRARGP		/STANDARD BUFFER SIZE=52(10)
	ISZ PRARGP		/INDEX TO RETURN ADDRESS.
	CAL 50		/API ADDR. - ONCE ONLY CODE, THEN: JMP PRSTOP
PRLBHP	16		/.SETUP - L.B.H. POINTER.
PRDBP	RSF		/       - DATA WORD POINTER
PARER	PTRINT		/PARITY ERROR SWITCH
PRUND	LAC .+2		/ - I/O UNDERWAY
PTRWC	DAC .-5		/ - 2'S COMP WORD COUNT
PRCHAR	JMP PRSTOP		/ - CHAR PROCESSED
/STOP PTR ROUTINE, CLEARING I/O SWITCH
PRSTOP	DZM PRUND	/CLEAR I/O UNDERWAY INDICATOR
/PTR WAIT
PRWAIT	LAC PRUND	/STILL READING
	SNA
	JMP PRDBK
PRBUSY	LAC PRCALP	/BUSY. RETURN
	DAC PRARGP	/TO USER CAL.
PRDBK	XX		/ION OF IOF
	DBR		/DEBREAK FROM CAL LEVEL AND RESTORE L,EX-MDE,MEM. PROT
	XCT .+1
	JMP* PRARGP	/EXIT
PRNOR=PRDBK
PRSEEK	ISZ PRARGP
PRDBKI	JMP PRDBK
PRWATR	LAW 1000
	AND* PRCALP
	SNA
	JMP PRWAIT	/.WAIT
	LAC PRCALP	/.WAITR
	AND (700000	/L,XM,MP
	DAC PRCALP
	LAC* PRARGP	/BUSY ADDRESS
	AND (77777
	XOR PRCALP
	DAC PRCALP
	ISZ PRARGP	/TO NON-BUSY
	JMP PRWAIT
/PTR READ ROUTINE
PRRED	LAC PRUND	/I/O UNDERWAY?
	SZA!CMA	/NO START IT UP
	JMP PRBUSY	/YES-WAIT IN BUSY LOOP BACK TO CAL
/START UP PTR
PRSTRT	DAC PRUND	/SET I/O UNDERWAY SWITCH (777777)
	LAC PRDBKI	/EXIT TO USER-MAINSTREAM
	DAC PTROUT
PRNEXR	LAC* PRARGP	/L.B.H POINTER IN CALL
	DAC PRDBP
	DAC PRLBHP	/L.B.H. POINTER
	AND (700000)		/(RCHM-100)
	SZA			/(RCHM-100)
	JMP PRER67		/(RCHM-100)
	ISZ PRARGP
	LAC* PRARGP
	DAC PTRWC	/-L.B.W.C. (2'S COMP)
	ISZ PRARGP	/INDEX TO POINT TO EXIT
	LAW 7000
	AND* PRCALP		/CHECK FOR IOPS ASCII MODE.
	SAD (2000
	JMP .+3
	LAW 7		/ILLEGAL DATA MODE
	JMP* (.MED+1
	LAC (1002		/IOPS ASCII DATA MODE AND
	DAC PRDTCT	/WD.  PAIR CT. OF
			/1 FOR HEADER.
	JMS PRNXWD		/INDEX PAST L.B. HEADER 
	JMS PRNXWD		/FOR IOPS ASCII
PR1CR	LAW 17773		/5/7 CHAR
	DAC PTR57		/COUNTER
	DZM PRCCT	/CLEAR CHAR CT.
	DZM PR8CT	/CLEAR ASCII 8TH BIT SET COUNTER
	DZM PARER	/CLEAR PARITY ERR. SWITCH
PROUT2	IORS
	AND (1000
	SZA
	JMP PREOM
	IOF
	RSA
PTROUT	XX	/JMP PRDBK OR JMP PRDISM
/PTR INTERRUPT SERVICE
PTRINT	JMP PTRPIC	/PIC ENTRY
	DAC PTRAC	/API ENTRY, SAVE AC
	LAC PTRINT	/PIC OR API, L, EM, MP
	DAC PROUT
	IORS
	SMA!CLA
	LAW 17740		/PIC OFF
	TAD PRION		/PIC ON
	JMP PRSION
PTRPIC	DAC PTRAC	/SAVE AC
	LAC* (0	/PIC-PC, L, EM, MP
	DAC PROUT	/SAVE FOR EXIT
	LAC PRION
PRSION	DAC PRSW
	RRB	/READ PTR BUFFER
	DAC PRCHAR
PRION	ION
	LAC PRDSMI
	DAC PTROUT
	LAC PRUND		/CHECK FOR STOP SINCE LAST SELECT
	SNA		/O.K.
PRDSMI	JMP PRDISM		/IGNORE LAST READ, STOP I/O
	IORS
	AND (1000	/PTR NOT READY? (IORS8=1)
	SNA
	JMP PRIOA
/END OF PAPER TAPE ROUTINE
PREOM	LAC (15		/CLEAR I/O UNDERWAY
	DAC PRCHAR	/FAKE OUT END OF LINE TEST
	LAC (4		/CHANGE MODE
	TAD PRDTCT	/TO EOM
	DAC PRDTCT
	JMP PRPAD
PRDISM	LAC PTRAC
	XCT PRSW
	DBR		/DEBREAK FROM HANDLER LEVEL.
	XCT .+1
	JMP* PROUT
/END LINE
PRIOBB	DZM PRUND	/CLEAR INPUT UNDERWAY INDICATOR
	XCT PTROUT	/EXIT
/PROCESS IOPS ASCII
PRIOA	LAC PTRWC		/SEE IF EXCESS DATA
	SMA
	JMP PRASE3		/YES---CONTINUE UNTIL C.R.
/COMPUTE PARITY AND EXIT IF NULL
	LAW 17770	/PARITY COUNTER (-8)
	DAC PRCNT
	DZM PRCNT1
	LAC PRCHAR
	AND (177
	SAD (12
	JMP PROUT2	/IGNORE LF
	SAD (13
	JMP PROUT2	/IGNORE VT
	SAD (14
	JMP PROUT2	/IGNORE FF
	LAC PRCHAR
	SNA
	JMP PROUT2		/NULL
	RAR
	SZL
	ISZ PRCNT1		/1 BIT COUNTER
	ISZ PRCNT
	JMP .-4
	SZL
	ISZ PR8CT	/8TH BIT=1, ADD TO COUNT
	ISZ PRCCT
PRIOA1	LAC PRCNT1	/PARITY COUNT-SHOULD BE EVEN
	RAR
	SZL
	ISZ PARER	/NOT EVEN PARITY
	JMS PRENDT	/CONVERT ALTMODES
	AND (177	/DROP ALL BUT 7 BITS
	SAD (177	/DELETE CODE (RUBOUT)-IGNORE
	JMP PROUT2
	JMS PRPK57	/PACK INTO L.B. IN 5/7
	JMS PRENDT
	SMA
	JMP PROUT2		/NEXT ASCII CHAR
	LAC PRCCT
	SAD (1
	JMP PR1CR	/IGNORE SINGLE CR LINE
PRPAD	LAC PTR57		/WORD COUNT ALL SET.
	SAD PR5CNT
	JMP PRASE
	CLA		/PAD LAST
	JMS PRPK57	/WORD PAIR
	JMP PRPAD
/END OF IOPS ASCII LINE
PRASE	LAC PRDTCT	/WD. PAIR COUNT (INCL. HDR.)
	DAC* PRLBHP	/WD.0 L.B.H.
	LAC PR8CT	/DID ALL CHAR'S HAVE BIT 8
	SAD PRCCT	/NO - IOPS ASCII CHECK PARITY
	JMP PRASE3	/YES- ASSUME NON IOPS ASCII
PRASE2	LAC PARER	/PARITY ERROR
	SZA	/NO
	LAC (20	/YES
PRASE4	XOR* PRLBHP	/PARITY
	DAC* PRLBHP	/ERROR INDICATOR.
PRASE3	JMS PRENDT	/SKIP TO END LINE
	SPA!CLA!CMA
	JMP PRIOBB	/C.R. FOUND - EXIT.
	TAD PRDBP
	DAC PRDBP	/POINTS TO LAST CHAR
	LAW 17400
	AND* PRDBP
	XOR (33		/PUT CR IN LAST WORD PAIR
	DAC* PRDBP
	ISZ PRDBP		/INCASE MORE BEFORE CR
	LAC* PRLBHP
	AND (60
	SZA
	JMP PROUT2		/VALIDITY BITS ALREADY SET.
	LAC (60		/LINE BUFFER OVERFLOW.
	JMP PRASE4
PRNXWD	0
	ISZ PRDBP	/INDEX TO NEXT DATA WORD
	ISZ PTRWC	/INDEX WORD COUNT
	JMP* PRNXWD	/EXIT FOR NEXT CHAR
	JMP PRASE	/EXIT TO END OF IOPS ASCII LINE ROUTINE
/END LINE TEST - CONVERTS ALTMODE TO STANDARD 175
PRENDT	0
	LAC PRCHAR
	AND (177
	SAD (15		/RETURN
	LAW 15
	SAD (175		/ALTMODE
	LAW 175
	SAD (176		/ALTMODE
	LAW 175
	SAD (33		/ESCAPE
	LAW 175
	JMP* PRENDT
/VARIABLES-NOT SAVED-APPLY TO CURRENT ACTIVE REQUEST
PRCALP	0	/CAL POINTER
PRARGP	0	/ARG. LIST AND EXIT POINTER
PTRAC	0	/SAVED AC(INTERRUPT)
PROUT	0	/PC,L,EM,MP
PTR57	0	/CHAR. POSITION COUNTER IN 5/7 PAIR
PR8CT	0	/ASCII-WITH-8TH-BIT-SET-CHAR COUNTER
PRCCT	0	/CHAR CT.
PRDTCT	0	/DATA WORD PAIR IN LINE COUNTER
PRCNT	0	/PARITY CHECK COUNTER
PRCNT1	0	/1 BIT COUNTER FOR PARITY CHECK
PRSW	0		/ION OR IOF
/5/7 IOPS ASCII PACKING ROUTINE.
/	PTR57 IS INITIALIZED TO 777773
/	PRIOR TO THE 1ST CALL.
/
PRPK57	0		/CHAR. IN AC BITS 11-17.
	RTR		/MOVE TO AC BITS 0-6
	RTR
	RTR
	RTR
	DAC PRTMP
	LAW 17771		/-7
	DAC PRLPCT
PRPKBK	LAC PRTMP		/ROTATE CHAR LEFT
	RAL		/7 BITS THROUGH
	DAC PRTMP		/THE DOUBLE WORD
PRBCK2	LAC PRRTHF	/ACCUMULATOR
	RAL		/PRLFHF/PRRTHF.
	DAC PRRTHF
	LAC PRLFHF
	RAL
	DAC PRLFHF
	LAC PRLPCT
	SNA!CLL
	JMP PRPDNE	/2 WORDS ALL SET.
	ISZ PRLPCT	/IS 7 TIMES COUNT EXHAUSTED?
	JMP PRPKBK	/NO.
	ISZ PTR57		/DO WE HAVE 5 CHARS.
	JMP* PRPK57	/NO. EXIT
	JMP PRBCK2	/SHIFT LEFT ONCE MORE.
PRPDNE	LAC PRLFHF	/PLACE ACCUMULATED
	DAC* PRDBP	/2 WORDS INTO
	JMS PRNXWD	/USERS LINE BUFFER,
	LAC PRRTHF	/UPDATING POINTERS.
	DAC* PRDBP
	LAC PRDTCT	/INCREMENT
	TAD (1000		/DATA WD. PAIR
	DAC PRDTCT	/COUNT
	JMS PRNXWD
PR5CNT	LAW 17773		/RESET 5 CHAR COUNTER.
	DAC PTR57
	JMP* PRPK57
PRTMP=PRCNT		/TEMP. STORAGE FOR 5/7 CHAR.
PRLPCT=PRCNT1		/ROTATE 7 BITS COUNTER.
PRLFHF	0		/2 WORD ACCUMULATOR FOR
PRRTHF	0		/5/7 WORD PAIR.
	.END
