Google
 

Trailing-Edge - PDP-10 Archives - AP-D543V_SB - 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 BOTH PDP-6 AND PDP-10 - V036
SUBTTL	/GBH/TNM/RCC/DAL  11 JAN 77
	SEARCH	F,S
	$RELOC



;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1973,1974,1975,1976,1977,1978 BY DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
XP VPTRSR,036
		;PUT VERSION NUMBER IN GLOB LISTING AND LOADER STORAGE MAP
EXTERNAL  STOSQD, ILLOUT
EXTERNAL STODAT, IOSET, SETBYT, ADVBFF
EXTERNAL SETIOD, PTRSAV, PTRCHN,PIOMOD
EXTERNAL SETACT,STOIOS,CPOPJ1,PTRMSK,HNGSTP
INTERNAL PTRINT,PTRDSP

;PTR DEVICE DATA BLOCK LINKAGE





ENTRY PTRSER
PTRSER:


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

;   SPECIAL IO STATUS WORD ASSIGNMENTS
	IODISC==400000
	PTRPOW==100000
;   SPECIAL ASCII CHARACTERS
	RUBOUT==177


INTERNAL FTCHECK,FTMONP
IFN FTCHECK+FTMONP,<
EXTERNAL PTRDDB,PTRIOS,PTRADR,PTRPTR,PTRCTR,PTRSVC,PTRSV1,PTRCON
>
IFE FTCHECK+FTMONP,<
;PTR DEVICE DATA BLOCK
	INTERN	PTRDDB

	$LOW
PTRDDB:
PTRDAT:	SIXBIT	/PTR/
	XWD	5*HUNGST,41	;CODE 5 - HUNG TIME IS 31 SECONDS
PTRIOS:	0
	EXP	PTRDSP
	XWD	DVPTR+DVIN,14403
	0
	0
PTRADR:	XWD	R,0
PTRPTR:	0
PTRSTS:	0
PTRSTA:	XWD	.TYPTR!DEPLEN,0	;NON-SPOOLED, VAR BUFFER SIZE
PTRXTR:	0
PTREVM:	0
PTRPSI:	0
PTRESE:	0
PTRHCW:	0
PTRJOB:	0
PTRCTR:	0
PTRSV1:	0
PTRCON:	0
	$HIGH
>

;PTR SERVICE DISPATCH TABLE
EXTERN REGSIZ
	POPJ	P,0		;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
				;TAC14-17:=R
	MOVEM	T1,PTRPTR	;PTRPTR:=C(T1)
	CONSO	PTR,POW		;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	T2,PTRBSY
	TLZN	S,IOBEG		;VIRGIN?
	MOVEI	T2,PTRDON	;NO

	TLNN	S,PTRPOW
	ANDI	T2,PTRMSK	;PTRMSK IS DEFINED IN BUILD AS -1 PDP-6 AND 0 PDP-10
	MOVEI	T1,PTRCHN(T2)
	LDB	T2,PIOMOD
	CAIE	T2,IB		;IMAGE BINARY?
	CAIN	T2,B		;OR BINARY?
	IORI	T1,PTRBIN
	HRLI	T1,PTRDON
	CONO	PI,PIOFF##	;BETTER NOT INTERRUPT (IODISC=1)
	TRO	S,IOACT		;TELL PI-LEVEL THE PTR IS GOING
	MOVEM	S,DEVIOS(F)
	CONO	PTR,(T1)		;START IT
	HLRM	T1,PTRCON
	CONO	PI,PION##	;TURN ON PI'S
	PJRST	SETHNG##	;SET HUNG TIME AND RETURN
PTRINT:	CONSO	PTR,@PTRCON
	JRST	PTRINT
IFN FT5UUO,<
	CONI	PTR,PTRSTS	;STORE CONI STATUS
>
	SKIPL	PTRIOS		;DISCONNECT REQUEST? (IODISC=1?)
	DATAI	PTR,PTRSV1	;PTRSV1:=DATA ITEM.
	JSR	PTRSAV		;SAVE ACCUMULATORS AND ESTABLISH P
	MOVEI	F,PTRDDB	;SET UP F
	PUSHJ	P,IOSET		;R:=C(JBTADR18-35),J:=C(DEVCTR)
				;S:=C(PTRIOS)
	MOVE	U,PTRSV1	;U:=DATA ITEM
	CONSO	PTR,POW		;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
IFN FTKI10!FTKL10,<
	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
	DATAI	PTR,U		;YES, KEEP ON GOING
	JRST	PTRIN0
PTREX0:				;JOB IN AN IO WAIT FOR PTR?
	PUSHJ	P,SETIOD	;YES, WAKE UP JOB
	PUSHJ	P,PTRREL	;CLEAR PTR AND CONSO FLAG
	TRZ	S,IOACT		;IOACT:=0

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


PTRINI:
PTRREL:	CONO	PTR,0		;CLEAR PTR CONTROL
	HLLZS	PTRCON		;CLEAR CONSO FLAG
	POPJ	P,

	END