/1 HI SPEED READER/PUNCH HANDLER
/
/
/
/
/
/
/
/
/
/COPYRIGHT  (C)  1974,1975 BY DIGITAL EQUIPMENT CORPORATION
/
/
/
/
/
/
/
/
/
/
/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 RESPONSIBILITY
/FOR ANY ERRORS THAT MAY APPEAR IN THIS DOCUMENT.
/
/THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FURNISHED 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 PROVIDED IN WRITING BY DIGITAL.
/
/DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY FOR THE USE
/OR RELIABILITY OF ITS SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY
/DIGITAL.
/
/
/
/
/
/
/
/
/
/
/1 HI SPEED READER/PUNCH HANDLER
	*0
	-2
DEVICE PT8E;DEVICE PTP;1020;0;ZBLOCK 2
DEVICE PT8E;DEVICE PTR;2010;112;ZBLOCK 2

	PTVERSION="A&77

	*200
	/THIS IS THE REAL HIGH SPEED HANDLER.
	/HIGH SPEED PAPER TAPE HANDLER FOR BLEEP MONITOR
	/PACKS 3 CHARACTERS IN 2 WORDS ON INPUT, UNPACKS ON OUTPUT
	/PAGE RELOCATABLE
PTP,	PTVERSION
	CLA CLL CML	/SET LINK ON TO INDICATE PUNCH
	JMS PSETUP	/DO COMMON CRAP
PTPLP,	TAD I PTPCA
	JMS PTPPCH	/FIRST CHAR IN LOW ORDER 8 BITS OF WORD 1
	DCA PTR
	ISZ PTPCA
PT7700,	7700
	TAD I PTPCA
	JMS PTPPCH	/SECOND CHAR IN LOW ORDER 8 BITS OF WORD 2
	CLL RTR
	RTR
	TAD PTR
	RTR
	RTR	/THIRD CHARACTER NOW IN AC
	JMS PTPPCH
PTPEND,	ISZ PTPCA
PT70,	70	/JUST IN CASE WERE PUNCHING PG 7600 KEEP THIS LITERAL HERE
	KSF
	JMP PTPISZ	/KEYBOARD FLAG OFF - DON'T WORRY ABOUT ^C
PTPKRS,	KRS
	AND PTP177
	TAD PTPM3
	SZA CLA	/IS THERE A ^C IN THE TTY BUFFER?
	JMP PTPISZ	/NO
PTPCIF,	CDF CIF 0
	JMP I .+1
	7600
PSETUP,	0
	RDF	/GET FIELD OF CALLING PROGRAM
	TAD PTPCIF
	DCA PTPXIT	/SET UP RETURN SEQUENCE
	TAD I PTP
	AND PT70
	TAD PCDF
	DCA PTPCDF
	RAR		/GET LINK(1=PTP,0=PTR)
	TAD I PTP	/GET FUNCTION WORD
	ISZ PTP
	SPA		/CHECK CORRECT MODE
	JMP PTPERR	/SIGNAL "UNRECOVERABLE DEVICE ERROR"
	AND PT7700
	CMA		/SET UP -(WORD COUNT)/2-1
	DCA PTPWC
	TAD I PTP	/SET UP STARTING ADDRESS
	ISZ PTP
	DCA PTPCA
	TAD I PTP
PTPCDF,	0		/SET DATA FIELD TO ACCESS BUFFER
	PTPEOF=PTPCDF
	SNA CLA
	SZL
	JMP PTPKRS
	TAD PTP336	/INPUT INITIALIZATION - TYPE "^" AND WAIT
	TLS
	KSF
	JMP .-1
	JMS PTRGCH	/INITIALIZE THE PTR BUFFER CHAR
	6032		/CLEAR AC AND KEYBOARD FLAG
	JMP PTPKRS	/CHECK FOR ^C
PTPISZ,	ISZ PTPWC
	JMP I PSETUP	/LOOP FOR BUFFER SIZE (128 WORDS)
PTPRTN,	TAD PTPEOF
	SZA CLA		/DID WE RUN OUT OF TAPE?
	ISZ PTP
	ISZ PTP
PTPXIT,	HLT	/EXIT CDF GOES HERE
	JMP I PTP
PTPPCH,	0
	PLS	/NOTICE THE GLORIOUS LACK OF OVERLAP
	PSF
	JMP .-1
	AND PT7400
	JMP I PTPPCH
PTPCA,	0
PTR,	PTVERSION	/*** CORRECT ENTRY IN MAIN ASSEMBLY IF THIS IS MOVED!
	CLA CLL
	TAD PTR
	DCA PTP
	JMS PSETUP	/SET UP ADDRESS, COUNT, FIELDS
PTRLP,	JMS PTRGCH	/READ FIRST CHARACTER OF 3
	DCA I PTPCA
	JMS PTRGCH
	DCA PTPPCH
	JMS PTRGCH
	RTL
	RTL
	AND PT7400
	TAD I PTPCA
	DCA I PTPCA	/HIGH ORDER 4 BITS INTO WORD 1
	TAD PTR		/GET THE CHAR FROM THE PTR BUFFER
	RTR
	RTR
	RAR		/PUT THE LOW ORDER BITS INTO AC 0-3
	AND PT7400
	TAD PTPPCH
	ISZ PTPCA
PT7400,	7400
	DCA I PTPCA	/LOW ORDER 4 BITS INTO WORD 2
	JMP PTPEND
PTRGCH,	0
	TAD PTPEOF
	SNA CLA
	JMP PT0BFR	/MAKE SURE BUFFER IS ZEROED
	RFC
	DCA PTPEOF
PTTIME,	ISZ PTPEOF	/THIS LOOP OVERFLOWS IN APPROX. 100 MS ON A PDP-8,
	JMP PGCHLP	/72 MS ON A PDP-8/E
	TAD PTP232	/SEND ^Z TO BUFFER
PT0BFR,	DCA PTR
	JMP PTRXX	/AND 0 GARBAGE CHARACTER
PGCHLP,	TAD PTPTMP
	DCA PTR
PTP232,	232
PTP336,	336		/FALL THROUGH CONSTANTS TO STALL FOR TIME
PTP177,	177
	RSF
	JMP PTTIME	/READER NOT READY - CHECK TIMING
	RRB		/READER READY - READ CHAR
PTRXX,	DCA PTPTMP	/BUFFER READER BY ONE CHARACTER TO ELIMINATE
	TAD PTR		/GARBAGE CHARACTER AT END OF TAPE
	JMP I PTRGCH	/AND RETURN
PTPERR,	CLA CLL CML RAR	/SIGNAL A "PERMANENT I/O ERROR" ON THE DEVICE
	JMP PTPXIT-2
PCDF,	CDF 0
PTPTMP,	0
PTPWC,	0
PTPM3,	-3
$$$$$$$$

