Google
 

Trailing-Edge - PDP-10 Archives - scratch - 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 - V050
SUBTTL	/GBH/TNM/RCC/DAL  16-JUN-87

	SEARCH	F,S,DEVPRM
	$RELOC


;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
.CPYRT<1973,1986>
;COPYRIGHT (C) 1973,1974,1975,1976,1977,1978,1979,1980,1982,1984,1986
;BY DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
;ALL RIGHTS RESERVED.
;

XP VPTRSR,050	;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
;	0	= KONTROLLER TYPE
;	0	= MAXIMUM UNITS PER KONTROLLER
;	MDSEC0	= SECTION FOR KDB/UDB
;	MDSEC0	= SECTION FOR DDB
DRVCHR	(PTR,PTR,0,0,MDSEC0,MDSEC0,)

	 .ORG	DEVLSD

PTRCHF:! BLOCK	1		;PI CHANNEL FLAGS
PTRCSO:! BLOCK	1		;ADDRESS OF INTERRUPT CODE
PTRPTR:! BLOCK	1		;BYTE POINTER TO CURRENT INPUT BUFFER
PTRCTR:! BLOCK	1		;BYTE COUNTER FOR IDPB INTO USER BUFFER
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	(PTRCHF,<PTRCHN##>)		;PI CHANNEL FLAGS
	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,PTRATK,PTRDTK>)

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

;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
	PUSHJ	P,AUTADN##	;ALLOCATE A DEVICE NUMBER
	MOVEI	T2,(T1)		;COPY TO PROPER PLACE
	HRLOI	T1,'PTR'	;GET GENERIC NAME AND ANF-10 STATION FLAG
IFN FTNET,<HRL	T2,JBTLOC##>	;STATION NUMBER
	PUSHJ	P,AUTDDB##	;CREATE A DDB
	  JFCL			;*** RETURN CORE ***
	MOVSI	T1,-<PTRIOE-PTRIOB> ;-LENGTH
	XMOVEI	T2,PTRIOB(F)	;STARTING ADDRESS
	HRRZ	T3,.CPDVC##	;DEVICE CODE
	PUSHJ	P,AUTDVC##	;FILL IN DEVICE CODES
	MOVE	T1,F		;DATA BLOCK ADDRESS
	XMOVEI	T2,PTRINT	;INTERRUPT SERVICE
	PUSHJ	P,AUTICD##	;GENERATE INTERRUPT ROUTINES
	  POPJ	P,		;*** RETURN CORE ***
	MOVEM	T1,PTRCSO(F)	;SAVE ADDRESS
	MOVEI	T2,PTRCHN##	;PI CHANNEL
	PUSHJ	P,AUTCSO##	;LINK INTO CONSO SKIP CHAIN
	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,PTRPTR(F)	;PTRPTR:=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
	ADD	U,PTRCHF(F)
	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,PTRCTR(F)	;PTRCTR:=C(J)
	JRST	STOIOS##	;STORE S,RESET HUNG DEVICE
				;TIMEOUT COUNT AND DISMISS.

PTRINI:
PTRREL:	MOVEI	U,0		;CLEAR PTR CONTROL
	XCT	PTRCNO(F)
	HLLZS	@PTRCSO(F)	;CLEAR CONSO FLAG
	POPJ	P,

	END