	.SYSID <	.TITLE PRA. >,< 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
/PRA.
/PRA.=IOPS PAPER TAPE READER HANDLER
/M. SIFNAS
/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 PRA.
PRA.	DAC PRCALP		/CAL POINTER
	DAC PRARGP	/ARG POINTER
	ISZ PRARGP	/INDEX TO FUNCTION ADDR.
	LAC* PRARGP	/FUNCTION
	ISZ PRARGP	/INDEX TO LIB. ADDR.
	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
PR760	777760		/2=.DELET, .RENAM, .FSTAT
	JMP PRSEEK	/3=.SEEK
	JMP PRER6		/4=.ENTER
	JMP PRER6		/5=.CLEAR
	JMP PRWAIT		/6=.CLOSE
PRDBKJ	JMP PRDBK		/7=.MTAPE
	JMP PRRED		/10=.READ
	JMP PRER6		/11=.WRITE
	JMP PRWATR	/12=.WAIT OR .WAITR
PRER6	LAW 6		/ILL. FUNCTION-CAL ADDR IN .MED /13 .TRAN
	SKP
PRER7	LAW 7		/ILLEGAL DATA MODE
	JMP* (.MED+1
PRER67	LAW 67			/(RCHM-100)
	JMP* (.MED+1)		/(RCHM-100)
/INIT PTR ROUTINE
PRIN	ISZ PRARGP	/INDEX TO NORMAL EXIT
	LAC (64
	DAC* PRARGP	/STANDARD BUFFER SIZE=52(10)
	ISZ PRARGP
	CAL 50		/API ADDR - ONCE ONLY CODE
PRLBHP	16		/.SETUP - LATER LBH POINTER
PRDBP	RSF			/LATER DATA WORD POINTER
PRCKSM	PTRINT		/CHECKSUM (IOPS ASCII)
PRUND	LAC .+2		/CURRENT I/O INDICATOR
PTRWC	DAC .-5		/-WC
PRCHAR	JMP PRSTOP		/CHAR PROCEESSED
/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
	DAC PRARGP	/RETURN.
PRDBK	XX		/ION OR IOF
	DBR
	XCT .+1
	JMP* PRARGP
PRNOR=PRDBK
PRSEEK	ISZ PRARGP
	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)
	DAC PRIOHC	/IOPS BIN WD. 1 COUNT.
	LAC PRDBKJ	/EXIT TO USER-MAINSTREAM
	DAC PTROUT
PRNEXR	LAC* PRARGP	/L.B.H POINTER IN CALL
	DAC PRDBP	/D.B. OR DUMP AREA POINTER
	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	/SAVE DATA MODE IN PTRDM 6-8 TO (15-17)
	RCR
	RTR
	RTR
	RTR
	RTR
	DAC PTRDM
	SAD (4)			/(RCHM-100)
	SKP			/(RCHM-100)
	JMP PR2CR		/(RCHM-100)
	LAC PTRWC		/(RCHM-100)
	CMA!IAC			/(RCHM-100)
	TAD PRLBHP		/(RCHM-100)
	AND (700000)		/(RCHM-100)
	SZA			/(RCHM-100)
	JMP PRER67		/(RCHM-100)
PR2CR	DZM PRDTCT		/(RCHM-100) CLEAR DATA AOUNT.
	RTR
	SNL!SMA		/NON-0 LINK OR NEGATIVE AC.
	JMP PRNXR1	/IOPS BIN- DO NOT INDEX DATA AREA POINTER-DUMP MODE
	JMS PRNXWD	/INDEX PAST L. B. HEADER
	JMS PRNXWD	/FOR IOPS ASCII OR IMAGE
PR1CR=.
PRNXR1	LAW 17773		/5/7 CHAR.
	DAC PTR57		/COUNTER.
	DZM PRCCT	/CLEAR CHAR CT.
	DZM PRCKSM	/CLEAR CHECKSUM
	DZM PR8CT	/CLEAR ASCII 8TH BIT SET COUNTER
	DZM PARER	/CLEAR PARITY ERR. SWITCH
	LAC PRIOB4		/LAC* PRDBP
	DAC PRIOB7
	LAC PTRDM	/DATA MODE
	TAD (XCT PTRIOT	/IOT TABLE
	DAC PTROUT-1
PRIOB6	DZM* PRDBP	/CLEAR NEXT DATA WORD.
	LAW 17775	/IOPS 3 BYTE
	DAC PRIOBN	/BIN COUNT.
PROUT2	IORS
	AND (1000
	SZA
	JMP PREOM
	IOF
	XX	/RSA OR RSB AS F (D.M.)
PTROUT	XX		/JMP PRDBK OR JMP PRDISM
PTRIOT	RSA	/IOPS BIN
	RSB	/IMAGE BIN
	RSA	/IOPS ASCII
	RSA	/IMAGE ALPHA
	RSB	/DUMP
	JMP PRER7	/ILLEGAL MODE
	JMP PRER7	/ILLEGAL MODE
	JMP PRER7	/ILLEGAL MODE
/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 PRDISJ
	DAC PTROUT
	LAC PRUND		/CHECK FOR STOP SINCE LAST SELECT
	SNA		/O.K.
PRDISJ	JMP PRDISM		/IGNORE LAST READ, STOP I/O
	IORS
	AND (1000	/PTR NOT READY? (IORS8=1)
	SZA
	JMP PREOM	/SET EOM IN D.B., STOP READING*
	LAC PTRDM
	TAD (JMP PRDIS1
	DAC .+2
	LAC PRCHAR
	XX	/SERVICE ACCORDING TO D.M.
PRDIS1	JMP PRIOB	/IOPS BIN
	JMP PRIMB	/IMAGE BIN
	JMP PRIOA	/IOPS ASCII
	NOP	/IMAGE ASCII
/PROCESS IMAGE BINARY OR IMAGE ASCII OR DUMP
PRIMB	DAC* PRDBP	/STORE CHAR OR BIN WD D. B.
	JMS PRNXWD	/WORD COMPLETE SUBR
	JMP PROUT2		/NEXT CHAR
PRDISM	LAC PTRAC
	XCT PRSW
	DBR
	XCT .+1
	JMP* PROUT
/PROCESS IOPS BIN
PRIOB	JMS PRPAR	/COMPUTE PARITY AND EXIT IF NULL
	SNL!RAL!CLL	/BIT 8=1 (BIN FRAME?)
	JMP PROUT2		/NON-BIN FRAME (IGNORE)
	DAC PRCHAR	/CHAR IN 0-5
/NEXT 6-BIT BYTE ROUTINE
PRIOB7	LAC* PRDBP	/SHIFT  EARLIER CHAR'S LEFT
	RAR!CLL
	XOR PRCHAR	/ADD THIS CHAR TO OTHER 1 OR 2
	RTL
	RTL
	RTL
	RAL
	DAC* PRDBP
	LAC PRCNT1	/CHECK CHAR. PARITY
	RAR	/ODD IF BIT 17=1
	SNL	/O.K.
	ISZ PARER	/PARITY ERROR-SAVE BUT PASS CHAR
	ISZ PR8CT		/TO FORCE PARITY CHK.
	ISZ PRIOBN	/INDEX 3 BYTE BIN COUNT
	JMP PROUT2		/STILL WORKING ON CURRENT DATA WORD
	ISZ PRIOHC	/INDEX HEADER WD0 COUNT
	JMP PRIOB4	/CURR. DATA WORD COMPLETE
	LAC* PRDBP	/CHECK WPC < WC IN PTRWC
	RTR
	RTR
	RTR
	RTR
	AND (776
	DAC PRIOHC	/T. STORE WPC
	TAD PTRWC
	SPA!SNA		/WPC > WC, SHORT LINE
	JMP PRIOB9	/WPC INTO PTRWC, NO SHORT LINE
	LAC (60		/WC STAYS IN PTRWC
	JMS PRDVS		/SET D.V. BITS=SHORT LINE
	LAW -2
	TAD PRIOHC		/SET UP PRIOHC TO SKIP EXCESS DATA
	CMA
	DAC PRIOHC
PRIOB4	LAC* PRDBP	/DATA WORD-THIS INSTR. USED AS LIT.
	TAD PRCKSM	/ADD TO CHECKSUM
	DAC PRCKSM
	ISZ PRDBP	/INDEX DATA WORD POINTER
	ISZ PRDTCT	/INDEX DATA WORD COUNT*
	ISZ PTRWC	/INDEX WORD COUNT
	JMP PRIOB6	/NEXT DATA WORD
	LAC PRIOHC		/EXCESS DATA
	SMA
	JMP PRIOBE
	LAC (JMP PRIOBS
	DAC PRIOB7
	JMP PRIOB6+1	/RESET 3 BYTE CT
PR7S=.
PRIOB9	LAW -1
	TAD PRIOHC	/WPC INTO PTRWC
	CMA
	DAC PTRWC
	JMP PRIOB4
PRIOBS	ISZ PRIOBN		/INDEX 3 BYTE COUNT
	JMP PROUT2
	ISZ PRIOHC		/INDEX EXCESS DATA WORD CT.
	JMP PRIOB6+1
	JMP PRIOBE		/END OF BIN. BLOCK
PRDVS2=PRCKSM
/SET DATA VALIDITY (D.V.) BITS SUBR. MASK IN AC
PRDVS	0
	DAC PRDVS2	/SAVE MASK
	LAW 17717		/MASK ALL BITS IN L.B. HEADER, WD 0, EXCEPT
	AND* PRLBHP	/IGNORE CKSUM (0) AND D.V. BITS (12,13)
	XOR PRDVS2	/PARITY, CHECKSUM, OR SHORT LINE
	DAC* PRLBHP
	JMP* PRDVS
PRIOBK	LAC (20		/CHECKSUM ERROR (D. V. BITS, 12,13=10)
PRIOBP	TAD (20		/PARITY ERROR (12,13=01)
	JMS PRDVS	/SET D.V. BITS
	JMP PRIOBB
/END OF PAPER TAPE ROUTINE.
PREOM	LAC PTRDM		/CHECK DATA MODE
	SAD (4
	JMP PRIOBB	/DUMP MODE - NO EOM HEADER
	SAD (2
	JMS PRPAD		/IOPS ASCII-PAD LIST WD. PR.
PREOM2	JMS PRHEAD	/SET UP WD0 OF HDR
	AND PR760		/MASK ALL BUT MODE BITS
	XOR (6		/EOM
	DAC* PRLBHP
PRIOBE	LAC PR8CT		/IOPS BIN WILL
	SAD PRCCT		/ALWAYS CHECK
	JMP PRIOB5	/PARITY.
	LAC PARER
	SZA!CLA
	JMP PRIOBP	/PARITY ERROR(S)
PRIOB5	LAC* PRLBHP	/L.B. HDR, WD. 0
	AND (60
	SZA
PRIOBJ	JMP PRIOBB	/VALIDITY BITS ALREADY SET
	LAC PRCKSM
	SZA
	JMP PRIOBK	/CHECKSUM ERROR
/END LINE
PRIOBB	DZM PRUND		/CLEAR I/O UNDERWAY IND
	XCT PTROUT	/EXIT
/ROUTINE TO PAD LAST WORD PAIR
/IN IOPS ASCII DATA MODE
PRPAD	0
	LAC PTR57		/IS LAST WORD
	SAD PR5CNT	/PAIR FULL?
	JMP* PRPAD	/YES. EXIT
	CLA		/INSERT ANOTHER
	JMS PRPK57	/NULL CHAR
	JMP PRPAD+1
/COMPUTE PARITY AND EXIT IF NULL
PRPAR	0
	LAW 17770		/PARITY COUNTER (-8)
	DAC PRCNT
	DZM PRCNT1
	LAC PRCHAR
	SNA
	JMP PROUT2		/NULL
	RAR
	SZL
	ISZ PRCNT1		/1 BIT COUNTER
	ISZ PRCNT
	JMP .-4
	JMP* PRPAR
/PROCESS IOPS ASCII
PRIOA	LAC PTRWC		/SEE IF EXCESS DATA
	SMA
	JMP PRASE3		/YES
	LAC PRCHAR
	AND (177
	SAD (12
	JMP PROUT2	/IGNORE LF
	SAD (13
	JMP PROUT2	/IGNORE VT
	SAD (14
	JMP PROUT2	/IGNORE FF
	JMS PRPAR	/COMPUTE PARITY AND EXIT IF NULL
	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
	JMS PRPAD		/PAD CAST DATA WD. PR.
/END OF IOPS ASCII IMAGE ASCII, IMAGE BIN, DUMP LINE
PRASE	LAC PTRDM
	SAD (4
	JMP PRIOBB		/DUMP MODE.
	JMS PRHEAD	/SET UP L.B.H 0, W.P.C.+D.M.
	LAC PR8CT	/DID ALL CHAR'S HAVE BIT 8
	SAD PRCCT	/NO - IOPS ASCII CHECK PARITY
	JMP PRASE4	/YES - ASSUME NON IOPS ASCII
PRASE2	LAC PARER	/PARITY ERROR
	SZA	/NO
	LAC (20		/YES
	JMS PRDVS	/PARITY ERROR SET VALIDITY BITS
PRASE4	LAC PTRDM
	XOR (2		/IOPS ASCII
	SZA
	JMP PRIOBB	/END LINE
PRASE3	JMS PRENDT	/SKIP TO END LINE
	SPA!CLA!CMA
	JMP PRIOBB
	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
	XOR (60
	SAD (60
	JMS PRDVS		/SHORT LINE
	JMP PROUT2
/SET UP L.B.H. WD 0 (WPC AND D.M.)
PRHEAD	0
	LAC PRDTCT	/WORD COUNT (INCLUDES L.B.H.)
	CLL
	RTL
	RTL
	RTL
	RTL	/1-8 WPC
	XOR PTRDM	/DATA MODE
	DAC* PRLBHP
	JMP* PRHEAD
/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
/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
	JMS PRNXWD
PR5CNT	LAW 17773		/RESET 5 CHAR. COUNTER.
	DAC PTR57
	JMP* PRPK57
PRNXWD	0
	ISZ PRDBP	/INDEX TO NEXT DATA WORD
	ISZ PRDTCT	/ADD TO DATA WORD COUNT
	ISZ PTRWC	/INDEX WORD COUNT
	JMP* PRNXWD	/EXIT FOR NEXT CHAR
	JMP PRASE	/EXIT TO END OF IOPS ASCII LINE ROUTINE
/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
PTRDM	0	/DATA MODE (15-17)
PTR57	0	/CHAR. POSITION COUNTER IN 5/7 PAIR
PR8CT	0	/ASCII-WITH-8TH-BIT-SET-CHAR COUNTER
PRCCT	0	/CHAR CT.
PARER	0	/PARITY ERR. SWITCH (COUNTER)(0=O.K.)
PRDTCT	0	/DATA WORD IN LINE COUNTER
PRIOHC	0	/IOPS BIN. WD1 COUNT
PRIOBN	0	/IOPS BIN 3 BYTE COUNT
PRCNT	0	/PARITY CHECK COUNTER
PRCNT1	0	/1 BIT COUNTER FOR PARITY CHECK
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.
PRSW	0		/ION OR IOF
	.END
