Google
 

Trailing-Edge - PDP-10 Archives - cust_sup_cusp_bb-x130c-sb - 10,7/unsmon/ptrser.mac
There are 6 other files named ptrser.mac in the archive. Click here to see a list.
TITLE PTRSER - PAPER TAPE READER SERVICE ROUTINE FOR PDP-10 - V055
SUBTTL	/GBH/TNM/RCC/DAL  21-JUNE-88

	SEARCH	F,S,DEVPRM
	$RELOC


;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED
;  OR COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION
; 1973,1974,1975,1976,1977,1978,1979,1980,1982,1984,1986,1988.
;ALL RIGHTS RESERVED.

.CPYRT<1973,1988>


XP VPTRSR,055	;DEFINE GLOBAL VERSION NUMBER FOR LOADER MAP

PTRSER::ENTRY PTRSER
;PARAMETER ASSIGNMENTS

;PTR CONTROL REGISTER
	PTRDON==10		;DONE FLAG
	PTRBSY==20		;BUSY FLAG
	PTRBIN==40		;BINARY READ MODE
	POW==400		;POWER ON

;SPECIAL IO STATUS WORD ASSIGNMENTS
	IODISC==400000
	PTRPOW==100000

;SPECIAL ASCII CHARACTERS
	RUBOUT==177
SUBTTL	AUTOCONFIGURE


;DRIVER CHARARCTERISTICS
;	PTR	= PTRCNF
;	PTR	= PAPER TAPE PUNCH
;	7	= MAXIMUM DEVICES IN SYSTEM
;	0	= KONTROLLER TYPE
;	0	= MAXIMUM DRIVES PER KONTROLLER
;	0	= HIGHEST DRIVE NUMBER
;	MDSEC0	= SECTION FOR KDB/UDB
;	MDSEC0	= SECTION FOR DDB
DRVCHR	(PTR,PTR,7,0,0,0,MDSEC0,MDSEC0,<DR.GCC!DR.NET>)

	 .ORG	DEVLEN

PTRCSO:! BLOCK	1		;ADDRESS OF INTERRUPT CODE
PTRIOB:!			;START OF I/O INSTRUCTIONS
PTRXST:! BLOCK	1		;CONI TO SAVE STATUS
PTRPWR:! BLOCK	1		;CONSO TO TEST POWER ON/OFF
PTRCNO:! BLOCK	1		;CONO
PTRDTI:! BLOCK	1		;DATAI
PTRIOE:!			;END OF I/O INSTRUCTIONS
PTRLEN:!			;LENGTH OF PTR DDB

	 .ORG


	$LOW
PTRDDB:	DDBBEG	(PTR,PTRLEN)
	SETWRD	(DEVCHR,<5*HUNGST,,PTRSIZ##>)	;DEVCHR
	SETWRD	(DEVSER,<MCSEC0+PTRDSP>)	;DEVSER
	SETWRD	(DEVMOD,<DVIN!DVPTR,,14403>)	;DEVMOD
	SETWRD	(DEVTYP,<<.TYPTR*.TYEST>!DEPLEN,,0>) ;DEVTYP
	SETWRD	(DEVCPU,<PTRCHN##>)		;DEVCPU
	SETWRD	(PTRXST,<CONI  000,DEVSTS(F)>)	;SAVE STATUS
	SETWRD	(PTRPWR,<CONSO 000,POW>)	;TEST FOR POWER ON/OFF
	SETWRD	(PTRCNO,<CONO  000,(U)>)	;CONO
	SETWRD	(PTRDTI,<DATAI 000,U>)		;DATAI
	DDBEND
	$HIGH


;CONSO SKIP CHAIN CODE (AUTCON WILL FILL IN THE BLANKS)
PTRICD:	PHASE	0
	CONSO	000,0			;(00) SKIP IF INTERRUPT FOR THIS LPT
	JRST	.-1			;(01) GO TO NEXT SKIP CHAIN ELEMENT
	JSR	PIERR##			;(02) SAVE ACS AND SETUP PDL
	SKIPA	F,.+1			;(03) SET UP DDB ADDRESS
	EXP	0			;(04) DDB ADDRESS
	XJRST	.+1			;(05) CALL INTERRUPT HANDLER
	EXP	0			;(06) INTERRUPT HANDLER ADDRESS
	DEPHASE
PTRICL==.-PTRICD			;LENGTH OF CONSO SKIP CHAIN CODE

EQUATE	(LOCAL,0,<PTRCKT,PTRKDB,PTRKLN,PTRUDB,PTRULN>)
EQUATE	(LOCAL,0,<PTRULB,PTRULP>)

PRXDSP:	DRVDSP	(PTR,PTRCHN##,PTRDDB,PTRLEN,URDDIA##)

;DEFAULT MONGEN'ED DEVICE TABLE
DEFMDT:	MDKL10	(7,104,0,0,<MD.KON>)	;DEVICE CODE 104
	EXP	0
PTRCFG:	XMOVEI	T1,PTRMDT##	;MONGEN'ED DEVICE TABLE
	XMOVEI	T2,DEFMDT	;DEFAULT TABLE
	MOVNI	T3,1		;NO MASSBUS UNIT OR DRIVE INFORMATION
	MOVEI	T4,MD.KON	;MATCH ON KONTROLLER DEFINITION
	PUSHJ	P,AUTMDT##	;SCAN THE TABLES
	  JRST	CPOPJ1##	;NO MATCHES
	PUSH	P,T1		;SAVE MDT DATA
	MOVEI	T1,PTRIOB	;WORD CONTAINING AN I/O INSTRUCTION
	PUSHJ	P,AUTFND##	;SEE IF THERE'S ALREADY A DDB
	  JRST	PTRCF1		;JUST MAKE SURE THE NUMBERS ARE OK
	PUSHJ	P,AUTADN##	;ALLOCATE A DEVICE NUMBER
	HRLI	T1,'PTR'	;INCLUDE GENERIC DEVICE NAME
	SETZ	T2,		;LOCAL DEVICE
	PUSHJ	P,AUTDDB##	;CREATE A DDB
	  JRST	[POP	P,T1	;NO CORE
		 PJRST	AUTDDN##] ;DEALLOCATE DEVICE NUMBER
PTRCF1:	MOVSI	T1,-<PTRIOE-PTRIOB> ;-LENGTH
	XMOVEI	T2,PTRIOB(F)	;STARTING ADDRESS
	HRRZ	T3,.CPDVC##	;DEVICE CODE
	PUSHJ	P,AUTDVC##	;FILL IN DEVICE CODES
	SKIPE	PTRCSO(F)	;BEEN HERE BEFORE?
	JRST	PTRCF3		;THEN DON'T MESS WITH THE SKIP CHAIN
	MOVE	T1,F		;DATA BLOCK ADDRESS
	XMOVEI	T2,PTRINT	;INTERRUPT SERVICE
	PUSHJ	P,AUTICD##	;GENERATE INTERRUPT ROUTINES
	  SKIPA	T2,F		;NO CORE
	JRST	PTRCF2		;ONWARD
	MOVEI	T1,PTRLEN	;GET DDB LENGTH
	PUSHJ	P,AUTKIL##	;DELETE THE DDB
	PUSHJ	P,AUTDDN##	;DEALLOCATE DEVICE NUMBER
	JRST	TPOPJ##		;PHASE STACK AND RETURN
PTRCF2:	MOVEM	T1,PTRCSO(F)	;SAVE ADDRESS
	MOVEI	T2,PTRCHN##	;PI CHANNEL
	PUSHJ	P,AUTCSO##	;LINK INTO CONSO SKIP CHAIN
PTRCF3:	POP	P,T1		;GET MDT DATA BACK
	POPJ	P,		;ALL DONE
;PTR SERVICE DISPATCH TABLE
	JRST	CPOPJ1##	;IF YOU'RE ASKING, IT'S ONLINE
	JRST	ECOD2##		;SPECIAL ERROR STATUS
	JRST	REGSIZ##	;BUFFER LEN CAN BE GOTTEN FROM DDB
	JRST	PTRINI		;INITILIZE
	JRST	PTRREL		;HUNG DEVICE TIME-OUT ERROR.
PTRDSP:	JRST	PTRREL		;RELEASE
	JRST	ILLOUT##	;CLOSE CALLED ONLY ON ILLEGAL OUTPUT
	JRST	ILLOUT##	;OUTPUT
PTRIN:	TLNN	S,IOBEG		;INPUT. VIRGIN DEVICE?
	JRST	PTRIN1		;NO
	TLO	S,IOFST		;IOFST:=1. NEXT ITEM WILL BE FIRST ITEM OF A BUFFER
	TLZ	S,PTRPOW+IODISC
	PUSHJ	P,SETBYT##	;TAC0-5:=TAC12-13:=0,TAC6-11:=BYTE SIZE
	MOVEM	T1,DEVPTR(F)	;DEVPTR:=C(T1)
	XCT	PTRPWR(F)	;IS POWER ON?
	JRST	[PUSHJ  P,HNGSTP## ;NO - INFORM USER
		 JRST	PTRIN]
				;ALWAYS GO ON EVEN IF POW NOT ON IN CASE
				;NULL FILE IS TO BE READ (A FEATURE)
				;NOTE: POW=1 SIGNALS PTR READY FOR INPUT
				;WHEREAS LATER POW=0 SIGNALS END-OF-TAPE & EOF.
	TLO	S,PTRPOW	;YES.  PTRPOW:=1
PTRIN1:	MOVEI	U,PTRBSY
	TLZN	S,IOBEG		;VIRGIN?
	MOVEI	U,PTRDON	;NO
	TLNN	S,PTRPOW
	MOVEI	U,0
	ADDI	U,PTRCHN##	;INCLUDE PI CHANNEL
	LDB	T2,PIOMOD##
	CAIE	T2,IB		;IMAGE BINARY?
	CAIN	T2,B		;OR BINARY?
	IORI	U,PTRBIN
	HRLI	U,PTRDON
	CONO	PI,PI.OFF	;BETTER NOT INTERRUPT (IODISC=1)
	TRO	S,IOACT		;TELL PI-LEVEL THE PTR IS GOING
	MOVEM	S,DEVIOS(F)
	XCT	PTRCNO(F)	;START IT
	HLRM	U,@PTRCSO(F)
	CONO	PI,PI.ON	;TURN ON PI'S
	PJRST	SETHNG##	;SET HUNG TIME AND RETURN
PTRINT:	XCT	PTRXST(F)	;STORE CONI STATUS
	SKIPL	DEVIOS(F)	;DISCONNECT REQUEST? (IODISC=1?)
	PUSHJ	P,IOSET##	;J=C(DEVCTR)
				;S:=C(PTRIOS)
	XCT	PTRDTI(F)	;READ DATA ITEM INTO AC U
	XCT	PTRPWR(F)	;PTR POWER ON?
	JRST	PTREND		;NO
	TLON	S,PTRPOW	;PTRPOW=1?  PTRPOW:=1
	JRST	PTREX1		;NO
	TLZE	S,IODISC	;DISCONNECT REQUEST?
	JRST	PTREXT		;YES
PTRIN0:	TRNE	S,B		;MODE=BINARY?
	JRST	PTRI0		;YES
	ANDI	U,177		;MASK OUT PARITY BIT
	CAIN	U,RUBOUT	;LAST CHAR A RUBOUT?
	JRST	DPOPJ##		;YES, STORE STATUS(IOS) AND DISMISS INIT
				;DO NOT RESET HUNG TIME OUT
	JUMPE	U,DPOPJ##	;NULL CHAR - DO NOT RESET HUNG TIME OUT

PTRI0:	PUSHJ	P,STODAT##	;NO STORE DATA WORD.
	  JFCL			;CHECKSUM ERROR
	  JRST	PTRI1		;BLOCK FULL OR BLOCK COMPLETE
	JRST	PTREX1		;DATA STORED CORRECTLY.

PTRI1:	PUSHJ	P,ADVBFF##	;ADVANCE BUFFER
	  TRZA	S,IOACT
PTRI2:	TLOA	S,IOFST		;IOFST:=1.  NEXT ITEM IS FIRST ITEM OF A BUFFER.
	TLO	S,IODISC+IOFST	;NEXT BUFFER IS FULL.  IODISC:=1
	PUSHJ	P,SETIOD##	;IOWS:=1
	JRST	PTREX1
;COME HERE WHEN THE READER IS SHUT OFF


PTREND:	TLZ	S,PTRPOW	;PTRPOW:=0
	TRZN	S,IOACT		;SHUTTING DOWN PTR?
	JRST	PTREI1		;YES, JUST GO AWAY
	LDB	T1,PIOMOD##
	TLO	S,IOEND+IOBEG
	CAIE	T1,B		;CHECKSUM BINARY BLOCK MODE?
	JRST	PTREI		;NO.
	TLNN	S,IOFST		;IOFST=1?
	TRO	S,IOIMPM	;NO. BINARY BLOCK INCOMPLETE.
	JRST	PTREI1
PTREI:	PUSHJ	P,STOSQD##	;FINISH THIS BUFFER, STORE WORD COUNT
	  JFCL
	PUSHJ	P,ADVBFF##	;ADVANCE BUFFER
	  JFCL
PTREI1:	PUSHJ	P,PTRREL	;CLEAR PTR AND CONSO FLAG
	PUSHJ	P,RTEVMI##	;RETURN ANY EVM WE MAY OWN
	JRST	PTRI2
;DISCONNECT PTR

PTREXT:	TRNN	S,IOACT		;DEVICE GOING (NEW INPUT DONE)?
	JRST	PTREX0		;NO, SHUT DOWN
	XCT	PTRDTI(F)	;YES, KEEP ON GOING
	JRST	PTRIN0
PTREX0:	PUSHJ	P,SETIOD##	;JOB IN AN IO WAIT FOR PTR?
				;YES, WAKE UP JOB
	PUSHJ	P,PTRREL	;CLEAR PTR AND CONSO FLAG
	TRZ	S,IOACT		;IOACT:=0

PTREX1:	MOVEM	J,DEVCTR(F)	;DEVCTR:=C(J)
	JRST	STOIOS##	;STORE S,RESET HUNG DEVICE
				;TIMEOUT COUNT AND DISMISS.

PTRINI:	MOVEI	T1,PTRDDB	;ADDRESS OF PROTOTYPE
	CAIN	T1,(F)		;IF FIRST CALL,
	JRST	CPOPJ1##	;HOLD OUT FOR A REAL DEVICE
	AOS	(P)		;DO THE CONO EACH TIME
PTRREL:	MOVEI	U,0		;CLEAR PTR CONTROL
	XCT	PTRCNO(F)
	HLLZS	@PTRCSO(F)	;CLEAR CONSO FLAG
	POPJ	P,

	END