	.SYSID <	.TITLE PPB. >,< 101>
/
/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
/PPB.
/IOPS PAPER TAPE PUNCH HANDLER
/ALL MODES EXCEPT IOPS ASCII
 
/EDIT # 001	DATE OF LAST EDIT	8.13.71
/ 101	14-JUN-75 (RCHM)	MAKE XVM CHANGES.
 
/CALLING SEQUENCE:
	/CAL+.DAT SLOT (9-17)
	/FUNCTION (12-17)
	/N ARGUMENTS WHERE N IS A FUNCTION OF FUNCTION
	/(NORMAL RETURN)
.MED=3
PSF=700201
PCF=700202
PSA=700204
PLS=700206
PSB=700244
	.GLOBL PPB.
PPB.	DAC PPCAL
	DAC PPBUSY
	ISZ PPCAL
	LAC* PPCAL	/GET FUNCTION
	ISZ PPCAL
	TAD PPTABJ
	DAC PPTAB		/SETUP DISPATCH
PPTAB	XX		/JMP THROUGH TABLES
	JMP PPINIT		/1=.INIT
	SKP		/2=.DELET, .RENAM, .FSTAT
	JMP PPER06		/3=.SEEK
	ISZ PPCAL		/4=.ENTER
	JMP PPOUT		/5=.CLEAR
	JMP PPCLOS		/6=.CLOSE
	JMP PPOUT		/7=.MTAPE
	JMP PPER06		/10=.READ
	JMP PPWRT		/11=.WRITE
	JMP PPWATR		/12=.WAIT OR .WAITR
PPER06	LAW 6		/ILLEGAL FUNCTION /13=.TRAN
	JMP* (.MED+1
PPTABJ	JMP PPTAB
/INIT, WAIT, AND CLOSE PTP ROUTINE
PPINIT	LAC PPCOUJ
	DAC PPIOUT	/INTERRUPT EXIT
	DAC PPIOB	/TURN ON I/O
	ISZ PPCAL
	LAC (64
	DAC* PPCAL		/STANDARD BUFFER SIZE
	ISZ PPCAL	/TO BYPASS ARGS
	CAL		/NO API
PPWPC	16		/.SETUP-WORD PAIR COUNT
PPLBP	PSF		/FIRST DATA WORD
TPTEMP	PTPINT		/TEMP STORAGE
TPWC	LAC PPEOFJ		/-WC
TPLBH	DAC .-5		/LBH
PP5CH	JMP PPEOF		/CHAR COUNT
PPCOUT	DZM PPCLSW		/CLEAR CLOSE SWITCH
	LAC PPEMJ
	DAC TPEOF
PPOUT	ION
	DBR
	XCT .+1
	JMP* PPCAL
PPWATR	LAW 1000
	AND* PPBUSY
	SNA
	JMP PPWAIT	/.WAIT
	LAC PPBUSY	/.WAITR
	AND (700000	/L,XM,MP
	DAC PPBUSY
	LAC* PPCAL	/BUSY ADDRESS
	AND (77777
	XOR PPBUSY
	DAC PPBUSY
	ISZ PPCAL	/TO NON-BUSY
PPWAIT	LAC PPIOB
	SNA
PPOUTJ	JMP PPOUT
PPBXIT	ION
	DBR
	XCT .+1
	JMP* PPBUSY
PPCLOS	LAC PPIOB
	SZA
PPBUSJ	JMP PPBXIT		/BUSY EXIT
	LAC PPCLSW
	SZA!CLA!CMA
PPCOUJ	JMP PPCOUT		/DONE EXIT
	DAC PPIOB		/TURN ON I/O
	DAC PPCLSW		/CLOSE EXECUTED
	DAC PP5CH
	DAC PPWPC
	DAC TPWC
	LAC PPBUSJ
	DAC PPIOUT		/GENERATE WAIT
	LAC PPDMOD		/LAST DATA MODE
	SZA
PPEOFJ	JMP PPEOF		/TRAILER ONLY
	LAC PPEOFL		/EOF BUFFER
	DAC TPLBH
	LAC PPNOPL		/PUNCH TRAILER
	DAC TPEOF
	JMP TPSIOB+3
TPDMS	JMP TPSIOB		/IOPS BINARY
	JMP TPSIMB		/IMAGE BINARY
	JMP PPER07		/ILLEGAL DATA MODE
	JMP TPSIMA		/IMAGE ASCII
	JMP TPSDMP		/DUMP
PPNOPL	NOP		/ILLEGAL DATA MODE
	NOP		/ILLEGAL DATA MODE
PPER07	LAW 7
	JMP* (.MED+1
PPER67	LAW 67			/(RCHM-101) FETCH ERROR NUMBER.
	JMP* (.MED+1)		/(RCHM-101) PRINT ERROR
PPEOFL	PPEOFB
PPTPDJ	JMP TPDMS
PPGETJ	JMP PPGETD
/WRITE PTP ROUTINE
PPWRT	LAC PPIOB
	SZA!CLA!CMA
	JMP PPBXIT
	DAC PPIOB	/TURN ON I/O
	DAC PP5CH
	LAC PPOUTJ
	DAC PPIOUT
	LAW 7000
	AND* PPBUSY	/WRITE ROUTINE
	RCR
	RTR
	RTR
	RTR
	RTR
	DAC PPDMOD	/DATA MODE
	TAD PPTPDJ		/SET UP ROUTINE FOR DM
	DAC TPDMSJ
	LAC PPDMOD
	TAD PPGETJ
	DAC PPGET
/GET ARGUMENTS AND SET UP FOR PUNCHING
	LAC* PPCAL
	AND (700000)		/(RCHM-101) EXTRTACT HIGH MEMORY BITS.
	SZA			/(RCHM-101) ANY ON?
	JMP PPER67		/(RCHM-101) YES.
	LAC* PPCAL		/(RCHM-101) FETCH BUFFER ADDRESS.
	ISZ PPCAL
	DAC TPLBH
	TAD (2
	DAC PPLBP	/FIRST DATA WORD
	LAC* TPLBH
	RTR
	RTR
	RTR
	RTR
	AND (776	/GET WC
	TAD TPSIOZ	/MINUS HEADER WDS
	CMA
	DAC PPWPC	/WORD COUNT -(1'S COMP)
	DAC TPWC
	LAC* PPCAL
	ISZ PPCAL
TPDMSJ	XX	/JMP TO PROPER SETUP
PPCHK	TAD* PPLBP
	ISZ PPLBP
	JMP PPBCK
TPSIOB	777000
	AND* TPLBH		/ZERO DATA MODE
	DAC* TPLBH
TPSIOZ	LAW -2		/IOPS BINARY
	TAD PPWPC
	DAC PPWPC
PP7S	LAW -1
PPBCK	ISZ TPWC
	JMP PPCHK
	TAD* TPLBH		/HEADER
	CMA
	ISZ TPLBH
	DAC* TPLBH		/TEMP SAVE
	LAC TPLBH	/OUTPUT HEADER
	TAD PP7S
	DAC PPLBP	/FIRST DATA WORD
PPIOBG	JMS PPNTP	/TEST FOR TAPE
	LAW -7
	DAC PPBITC		/INIT BIT COUNTER
	JMS PPBIN	/BINARY
	DAC PPSAVA	/SAVE C(AC)
	DZM PPONEB
PPARCN	RAR		/NEXT BIT
	SZL
	ISZ PPONEB		/NO. OF ONE BITS
	ISZ PPBITC
	JMP PPARCN
	LAC PPONEB
	RAR		/PUT IN LINK
	LAC PPSAVA		/ORIGINAL CHAR
	SZL
	XOR (100	/PARITY BIT 7
	XOR (200	/BIT 8
	JMP PPSA	/PUNCH ALPHA
TPSDMP	TAD PP7S	/CHANGE TO 1'S COMP. -DUMP MODE
	DAC PPWPC	/-WC OF DUMP AREA
	CMA!IAC			/(RCHM-101) CONVERT TO POSITIVE NUMBER.
	TAD TPLBH		/(RCHM-101) ADD IN BUFFER START.
	AND (700000)		/(RCHM-101)
	SZA			/(RCHM-101)
	JMP PPER67		/(RCHM-101)
	LAC TPLBH
	DAC PPLBP	/DUMP BEGIN LOCATION
TPSIMB	JMS PPNTP	/IMAGE BINARY
	JMS PPBIN
PPSB	IOF
	PSB
	LAC PPGET
	DAC PPNULL	/INTERRUPT RETURN
PPIOUT	XX		/JMP PTPDIS, JMP PPOUT, JMP PPBXIT
PPGET	JMP* PPGETD		/DISPATCH JMP
TPSIMA	JMS PPNTP	/IMAGE ASCII
	JMS PPCNT	/WD COUNT + FETCH
PPSA	IOF
	PSA
	JMP PPSB+2
PPNULL	0		/PUNCH NULL
	IOF
	PSA+10
	JMP PPIOUT
PPNTP	0	/NO TAPE TEST
	IORS
	AND (400	/GET BIT
	SNA
	JMP* PPNTP
	LAC (PPNTP+1	/RETURN TO HANDLER
	DAC* (.MED
	LAC (4		/NO TAPE IN PUNCH
	JMP* (.MED+1
PPGETD	JMP PPIOBG
	JMP TPSIMB
PPIOB	0		/I/O UNDERWAY INDICATOR
	JMP TPSIMA
	JMP TPSIMB
/BINARY CHARACTER UNPACKING ROUTINE
PPBIN	0	/BINARY UNPACKING
	LAC PPBHLD	/REST OF LAST WORD
	ISZ PP5CH
	JMP PPBINA	/WORD BEGUN
	LAW -3	/CHAR COUNT
	DAC PP5CH
	JMS PPCNT	/WORD COUNT+FETCH
PPBINA	RTL
	RTL
	RTL
	DAC PPBHLD	/SAVE REST OF WORD
	RAL
	AND (77	/MASK OUT CHAR
	JMP* PPBIN
PPCNT	0	/WORD COUNT+FETCH
	LAC* PPLBP	/GET WORD
	ISZ PPLBP		/NEXT WORD
	ISZ PPWPC
	JMP* PPCNT
TPBLK	LAC PPDMOD		/GET DATA MODE
	SNA
	JMS PPNULL
TPEOF	JMP PPEMPT
PPEOF	LAW -334
	DAC PPCOUN		/SAVE COUNT
	JMS PPNULL
	ISZ PPCOUN
	JMP .-2
PPEMJ	JMP PPEMPT
/INTERRUPT HANDLER
PTPINT	DAC PTPAC
	LAC* (0	/PIC RETURN
	DAC PTPOUT
	PCF	/CLEAR FLAG
	ION
	LAC PPTPJP
	DAC PPIOUT
PTPFLY	JMP* PPNULL	/JMP TO LAST PUNCH
PPEMPT	DZM PPIOB	/TURN OFF I/O
PTPDIS	LAC PTPAC
	ION
	DBR
	XCT .+1
	JMP* PTPOUT
PPTPJP	JMP PTPDIS
/DEVICE HANDLER REGISTERS
PPBHLD	0	/HOLD BINARY WORD
PPSAVA=TPWC	/SAVE CONTENTS OF AC
PPBITC=TPLBH	/BIT COUNTER
PPONEB=TPTEMP	/ONE BIT STORAGE
PTPAC	0	/INTERRUPT AC
PTPOUT	0	/INTERRUPT EXIT
PPCOUN=TPLBH	/NO OF TIMES PUNCHED
PPDMOD	0	/DATA MODE
PPCAL	0	/ARG POINTER
PPBUSY	0	/BUSY RETURN - CAL ADDRESS
PPEOFB	001005		/EOF HEADER
PPCLSW	0		/CLOSE EXECUTED SWITCH
	.END
