	.SYSID <	.TITLE PPA. >,< 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
/PPA.
/IOPS PAPER TAPE PUNCH HANDLER
 
 
/EDIT # 001	DATE OF LAST EDIT	8.13.71
/ 101	14-JUN-75 (RCHM)	MAKE XVM CHANGES.
/ 102	07-NOV-75 (RCHM)	CORRECT ONE MISTAKE.
 
 
/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 PPA.
PPA.	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
			/13=.TRAN
PPER06	LAW 6		/ILLEGAL FUNCTION
	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-WROD PAIR COUNT
PPLBP	PSF		/FIRST DATA WORD
TPTEMP	PTPINT		/TEMP STORAGE
TPWC	LAC PPEOFJ		/-WC
TPLBH	DAC .-5		/LBH POINTER
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
LAW0	LAW		/PUNCH TRAILER
	DAC TPEOF
	JMP TPSIOB+3
TPDMS	JMP TPSIOB		/IOPS BINARY
	JMP TPSIMB		/IMAGE BINARY
	JMP TPSIOA		/IOPS ASCII
	JMP TPSIMA		/IMAGE ASCII
	JMP TPSDMP		/DUMP
LAW177	LAW 177		/ILLEGAL DATA MODE
LAW13	LAW 13		/ILLEGAL DATA MODE
PPER07	LAW 7		/ILLEGAL DATA MODE
	JMP* (.MED+1
PPER67	LAW 67			/(RCHM-101) FETCH ERROR NUMBER.
	JMP* (.MED+1)		/(RCHM-101) GO 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		/SETUP FOR MODE DISMISS
	DAC TPDMSJ
	LAC PPDMOD
	TAD PPGETJ
	DAC PPGET
/GET ARGUMENTS AND SET UP FOR PUNCHING
	LAC* PPCAL
	ISZ PPCAL
	DAC TPLBH
	TAD (2
	DAC PPLBP	/FIRST DATA WORD
	LAC TPLBH		/(RCHM-101) FETCH BUFFER START.
	AND (700000)		/(RCHM-101) EXTRACT EXTENDED MEMORY BITS.
	SZA			/(RCHM-101) ARE ANY ON?
	JMP PPER67		/(RCHM-101) YES, GIVE ERROR.
	LAC* TPLBH
	RTR
	RTR
	RTR
	RTR
	AND (776
	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	/COMPUTE CHECKSUM
	ISZ PPLBP
	JMP PPBCK
TPSIOB	777000		/ZERO DATA MODE
	AND* TPLBH
	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		/CHECKSUM INTO HEADER
	LAC TPLBH	/OUTPUT HEADER
	TAD PP7S
	DAC PPLBP	/FIRST DATA WORD
PPIOBG	JMS PPNTP	/TEST FOR TAPE
	JMS PPBIN	/BINARY
	JMS PPARCT	/ODD PARITY
	SZL
	XOR (100	/PARITY BIT 7
	XOR (200	/BIT 8
	JMP PPSA	/PUNCH ALPHA
TPSDMP	TAD PP7S		/DUMP
	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) EXTRACT EXTENDED MEMORY BITS.
	SZA			/(RCHM-101) ARE ANY ON?
	JMP PPER67		/(RCHM-101) YES, GIVE ERROR.
	LAC TPLBH
	DAC PPLBP	/DUMP BEGIN LOCATION
TPSIMB	JMS PPNTP	/IMAGE BINARY
	JMS PPBIN
PPSB	IOF
	PSB
	LAC PPGET
	DAC PTPFLY	/INTERRUPT EXIT
PPIOUT	XX		/JMP PTPDIS, JMP PPOUT, JMP PPBXIT
TPSIMA	JMS PPNTP	/IMAGE ASCII
	JMS PPCNT	/WD COUNT + FETCH
PPSA	IOF
	PSA
	JMP PPSB+2
PPNTP	0	/NO TAPE TEST
	LAW -7
	DAC PPBITC		/INIT BIT COUNTER
	IORS
	AND (400	/GET BIT
	SNA
	JMP* PPNTP
	LAC (PPNTP+3		/RETURN TO HANDLER
	DAC* (.MED
	LAC (4		/NO TAPE IN PUNCH
	JMP* (.MED+1
PPGETD	PPIOBG
	TPSIMB
	PPIOAG
	TPSIMA
	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
	JMP TPBLK
TPBLKA	SAD (15			/CR OR ESC
	LAW 215
	JMS PPUNCH
TPBLK	LAC PPDMOD		/GET DATA MODE
	CLA!CMA!SNA
	JMS PPNULL		/IOPS BIN
TPEOF	JMP PPEMPT
PPEOF	LAW -334
	JMS PPNULL
PPEMJ	JMP PPEMPT
/INTERRUPT HANDLER
PTPINT	DAC PTPAC
	LAC* (0	/PIC RETURN
	DAC PTPOUT
	PCF		/CLEAR PUNCH FLAG
	ION
	LAC PPTPJP
	DAC PPIOUT
PTPFLY	XX	/JMP TO LAST PUNCH
PPEMPT	DZM PPIOB	/TURN OFF I/O
PTPDIS	LAC PTPAC
	ION
	DBR
	XCT .+1
	JMP* PTPOUT
PPTPJP	JMP PTPDIS
/COUNT PARITY BITS (ODD OR EVEN IN LINK ON RETURN)
PPARCT	0
	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
	JMP* PPARCT
/PROCESS IOPS ASCII
TPSIOA	DZM PPFST		/FIRST CHAR SWITCH
PPIOAG	JMS PPNTP
	ISZ PP5CH	/5/7 ASCII UNPACK
	JMP PPGET5	/THIS PAIR BEGUN
	JMS PPCNT	/WORD COUNT+FETCH
	DAC PP57T	/FIRST PART
	JMS PPCNT
	DAC PP57B	/LAST PART
	LAW -5	/RESET CHAR CCOUNT
	DAC PP5CH
PPGET5	LAW -10
	DAC PP57C	/SHIFT LOOP 7+1/2 TIMES
PPGET6	LAC PP57B
	RAL
	ISZ PP57C
	JMP PPGET7
	AND (177	/GOT CHAR
	SAD (15	/CARRIAGE RETURN
	JMP TPBLKA
	SAD (175			/ALTMODE(ESC)
	JMP TPBLKA
	JMP PPGET8
PPGET7	DAC PP57B
	LAC PP57T
	RAL
	DAC PP57T
	JMP PPGET6
PPGET8	XOR LAW0
/IOPS ASCII SPECIAL SCAN
	DAC PPCHAR	/SAVE CHARACTER
	SAD LAW0
	JMP PPGET	/NULL
	SAD LAW177
	JMP PPGET	/DELETE
	SAD LAW11
	JMP PPHT	/HORIZONTAL TAB
	SAD LAW12
	JMP PPLF	/LINE FEED
	SAD LAW13
	JMP PPVT	/VERTICAL TAB
	SAD LAW14
	JMP PPFF	/FORM FEED
	LAC PPFST
	SNA	/FIRST CHAR SWITCH
	JMS PPLINE	/FIRST
	LAC PPCHAR	/RESTORE CHARACTER
	JMS PPARCT	/EVEN PARITY
	SZL
	XOR (200	/SET BIT 8
	JMP PPSA
PPTSTF	0
	LAC PPFST	/FIRST CHAR SWITCH
	SNA
	JMP* PPTSTF
	JMP PPGET
PPHT	LAC PPFST
	SNA
	JMS PPLINE	/NEW LINE
LAW11	LAW 11		/HORIZONTAL TAB
	JMS PPUNCH
	LAW 377		/DELETE
	JMS PPUNCH
	JMP PPNFST
PPLF	JMS PPTSTF
	JMS PPLINE	/LINE FEED
	JMP PPNFST
PPVT	JMS PPTSTF
	LAW 213		/VERTICAL TAB
	JMS PPUNCH
	LAW -4
	DAC PPCOUN
	LAW 377		/DELETES
	JMS PPUNCH
	ISZ PPCOUN
	JMP .-3
PPNFST	DAC PPFST
PPGET	JMP* PPGETD		/MODIFIED JMP* PPGETD
PPFF	JMS PPTSTF
LAW14	LAW 14	/FORM FEED
	JMS PPUNCH
	LAW -40
	JMS PPNULL
	JMP PPNFST
/PUNCH NULL CHARACTERS
PPNULL	0
	DAC PPCOUN	/SAVE COUNT
	CLA		/NULL
	JMS PPUNCH
	ISZ PPCOUN
	JMP .-3
	JMP* PPNULL
/PUNCH LINE FEED (LEGAL OR DEFAULT)
PPLINE	0
LAW12	LAW 12		/LINE FEED
	DAC PPFST	/NOT FIRST
	JMS PPUNCH
	JMP* PPLINE
/HANDLER INITIATED PUNCH ROUTINE
PPUNCH	0
	IOF
	PSA	/PUNCH CHARACTER
	LAC (JMP* PPUNCH	/EXIT
	JMP PPIOUT-1
/DEVICE HANDLER REGISTERS
PPIOB	0	/I/O BEGUN INDICATOR
PPBHLD	0	/HOLD BINARY WORD
PPSAVA=TPWC	/SAVE CONTENTS OF AC
PPBITC=TPLBH	/BIT COUNTER
PPONEB=TPTEMP	/ONE BIT STORAGE
PP57C=TPWC	/5/7 COUNT
PP57T=PPBHLD	/5/7 FIRST PART
PP57B	0	/5/7 LAST PART
PTPAC	0	/INTERRUPT AC
PTPOUT	0	/INTERRUPT EXIT
PPCOUN	0	/NO OF TIMES PUNCHED
PPFST	0	/FIRST CHARACTER SWITCH
PPDMOD	0	/DATA MODE
PPCHAR	0	/CHARACTER STORAGE FOR SCAN
PPCAL	0	/ARG POINTER
PPBUSY	0	/BUSY RETURN - CAL ADDRESS
PPEOFB	001005		/EOF HEADER
PPCLSW	0		/CLOSE EXECUTED SWITCH
	.END
