Google
 

Trailing-Edge - PDP-10 Archives - bb-bt99h-bb - dnptr.p11
There are 4 other files named dnptr.p11 in the archive. Click here to see a list.
.SBTTL	DNPTR - PAPER TAPE READER ROUTINES  28 MAR 79

;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1976,1977,1978,1979,1980,1981,1984 BY DIGITAL EQUIPMENT CORP., MAYNARD, MASS.

VRPTR=006			;FILE EDIT NUMBER
.IF NE PTRN

DRESET=0
	DDBGEN	PTR,PR,PTRN,0,<0>		;MAKE A DEVICE BLOCK FOR THE PTR

;DB.STS
;	DS.XCH	;SET WHEN HAVE READ NOTHING FROM TAPE YET
;
;DB.DCS - DEVICE CONTROL STATUS BITS
;	000001	;MASTER ERROR
;	000002	;NO POWER
;	000400	;END OF TAPE



PTRSER:	MOV	#PTRMML,DB.MML(J)	;largest message size we can hack
	MOVB	#1,DB.DVV(J)		;CONTROLLER TYPE 1
	JSR	PC,DVCCFM		;SEND CONNECT CONFIRM
;Here after device connected
	BIT	#DS.ACT,@J		;IS READER ACTIVE ?
	BNE	90$			;IF SO WE ARE DONE
	BIT	#DS.DIE!DS.DSC,@J	;DO WE WANT TO CLOSE SHOP ?
	BEQ	20$
	JMP	DVCCFM			;IF SO DO IT
20$:					;HERE TO START PROCESSING READER
	TST	DB.OBF(J)		;ANY STATUS MESSAGES?
	BEQ	25$			;NO, TRY TO READ TAPE
22$:					;HERE TO GET ANOTHER BYTE
	JSR	PC,DVGBYT		;GET BYTE
	TRAP				;SHOULD NEVER GET DATA
	BR	23$			;GOT STATUS TYPE
	BR	25$			;NO MORE, CONTINUE
23$:					;HERE ON STATUS MESSAGE
	ASSERT	R0 EQ #3
	JSR	PC,DVRSTS
	BR	22$
25$:					;HERE TO CONTINUE
	CLR	@DB.HDW(J)		;KICK THE READER TO CLEAR IT
	MOV	DB.IBF(J),R0		;GET OLD MESSAGE TO SEND TO 10
	BEQ	40$			;IF NONE TRY TO READ TAPE
	TST	@DB.HDW(J)		;HIT AN ERROR (=END OF TAPE)
	BPL	24$
	BIS	#400,DB.DCS(J)		;FLAG END OF TAPE
	BIS	#DS.XDS!DS.XCH,@J	;WANT TO SEND STATUS
	JSR	PC,DVPDCS		;PUT DEVICE STATUS INTO MESSAGE
24$:	JSR	PC,DVPSBM		;FINISH OFF MESSAGE
	JSR	PC,NCLIN1		;GIVE MESSAGE TO NCL
	CLR	DB.IBF(J)		;FORGET OLD POINTER TO MESSAGE
	DECB	DB.IDR(J)		;ADJUST DATA REQ COUNT
	CHK	PL
40$:	TSTB	DB.IDR(J)		;WERE WE ASKED FOR DATA ?
	BEQ	90$			;IF NOT WE ARE DONE
	TST	@DB.HDW(J)		;IS ERROR BIT UP ?
	BPL	50$
	BIT	#1,DB.DCS(J)		;HAVE HAD TROUBLE ?
	BNE	54$
	INC	DB.DCS(J)		;SET MASTER ERROR BIT
	BR	52$			;SEND DEVICE STATUS
50$:	BIT	#1,DB.DCS(J)		;DID WE COMPLAIN BEFORE ?
	BEQ	54$
	BIC	#1,DB.DCS(J)		;CLEAR ERROR BIT
52$:	BIS	#DS.XDS,@J		;WANT TO SEND STATUS TO 10
54$:	JSR	PC,DVXDCS
	TST	DB.DCS(J)
	BNE	90$

	MOV	#2,R0			;CODE FOR DATA WITH EOR
	JSR	PC,DVPBSM		;BEGIN SUBMESSAGE FOR DATA
	  BCS	90$			;TRY AGAIN LATER
	CLRB	DB.COL(J)
	MOVB	#-4,DB.TIM(J)		;START TIMER (4 SECONDS) ON PTR
	BIS	#DS.ACT,@J		;FLAG READER IS NOW ACTIVE
	MOV	#PR.INE!PR..RE,@DB.HDW(J)	;SET INT ENAB & START PTR
90$:	RTS	PC

PTRTIM:	BIS	#400,DB.DCS(J)		;SET END OF TAPE BIT
	BIS	#DS.XDS!DS.XCH,@J	;WANT TO SEND STATUS

;HERE TO STOP THE PAPER TAPE READER
PTRSTP:	CLR	@DB.HDW(J)		;RESET THE HDW
	BIC	#DS.ACT,@J		;FLAG NO LONGER ACTIVE
	CLR	DB.TIM(J)		;NO LONGER TIMEING IT
	JMP	QUEDEV			;WAKE SERVICE ROUTINE

DEVINT	PTR,PR

PTRINT:	SAVE	<R0,R1,R3>

	.IF NE FT.CHK
	BIT	#DS.ACT,@J		;IS THIS SUPPOSED TO HAPPEN ?
	CHK	NE
	.ENDC;.IF NE FT.CHK

	MOV	DB.HDW(J),R0		;GET ADR OF READER
	TST	@R0			;DID WE GET AN ERROR ?
	BMI	80$			;IF SO STOP READING
	TSTB	@R0			;IS DATA READY ?
	BPL	88$			;IGNORE INTERRUPT
	MOVB	2(R0),R0		;GET DATA FROM READER
	BIC	#DS.XCH,@J		;HAVE READ A CHARACTER NOW
	JSR	PC,DVPDAT		;PUT DATA INTO BUFFER
	INCB	DB.COL(J)		;COUNT IT INTO THE BUFFER
	CMPB	DB.COL(J),DB.MML(J)	;AS LARGE AS IT SHOULD BE ?
	BNE	90$
80$:	JSR	PC,PTRSTP		;STOP THE READER
	BR	96$
88$:	TWIDDLE	PR0STS
	BR	96$
90$:	MOV	#PR.INE!PR..RE,@DB.HDW(J)	;START READER AGAIN
96$:	RESTORE	<R3,R1,R0,J>
	RTI

.ENDC;.IF NE PTRN