Google
 

Trailing-Edge - PDP-10 Archives - scratch - 10,7/unsmon/prsser.mac
There are 3 other files named prsser.mac in the archive. Click here to see a list.
	Title	PRSSER - Paper Tape Reader Service Routine for KS10s - V004
	Subttl	Timothe Litt	17-FEB-87
	;From PTRSER V 043

	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.
;
.CPYRT<1973,1986>
;COPYRIGHT (C) 1973,1974,1975,1976,1977,1978,1979,1980,1982,1986 BY
;DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
;ALL RIGHTS RESERVED.


XP VPTRSR,004
		;PUT VERSION NUMBER IN GLOB LISTING AND LOADER STORAGE MAP


	ENTRY PTRSER
PTRSER::


;	CSR and DDB bit definitions
	PRS==PTRDTI##+0		;Word in DDB with IO address of CSR
	ERR==100000		;Error (No tape, offline, no power)
	BSY==004000		;Busy (Set by GO, cleared by DONE)
	DONE==00200		;Done (Set when char is avail, clr by ref to DB)
	INTENB==100		;Enable interrupt on error or done
	GO==000001		;Read a frame

	PRB==PTRDTI##+1		;Word in DDB with IO address of data buffer

	PTRIVA==PTRDTI##+2	;Word in DDB with interrupt vector

	PTRIVI==PTRDTI##+3	;Word in DDB with interrupt instruction

	PTRCNT==PTRBLK##+0	;Word in DDB which counts frames of a binary wd

	PTRWRD==PTRBLK##+1	;Word in DDB which holds binary word during assy


;   SPECIAL IO STATUS WORD ASSIGNMENTS
	PTRBIM==200000		;PTR is in BINARY mode

;   SPECIAL ASCII CHARACTERS
	RUBOUT==177
	Subttl	UUOCON Interface -- Dispatch table


;PTR SERVICE DISPATCH TABLE
	JRST	PTRONL		;See if on-line
	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
	JRST	PTRIN		;INPUT
	Subttl	UUOCON Interface -- Initialize, RELEASe

PTRINI:	MOVE	T1,PRS(F)	;Get CSR address
	PUSHJ	P,UBGOOD##	;See if alive
	  JRST	CPOPJ1##	;No, hopeless case
	HLRZ	T1,PRS(F)	;Get UNIBUS adapter number
	HRRZ	T2,PTRIVA(F)	;Get interrupt vector address
	PUSHJ	P,AUTVIA##	;Compute address of interrupt instruction
	MOVE	T2,PTRIVI(F)	;Get vector instruction
	MOVEM	T2,(T1)		;Save for interrupts
	PUSHJ	P,PTRREL	;Do the RELEAS code
	JRST	CPOPJ1##	;And return to SYSINI

PTRREL:	MOVE	T1,PRS(F)	;Get CSR address
	PUSHJ	P,UBGOOD##	;Make sure this device is alive
	 POPJ	P,		;It's not, don't die
	MOVEI	T1,INTENB	;Get interrupt enable bit
	BCIO	T1,@PRS(F)	;Clear it to stop the device
	POPJ	P,		;Done
	Subttl	UUOCON Interface -- IN

PTRIN:	TLNN	S,IOBEG		;INPUT. VIRGIN DEVICE?
	 JRST	PTRIN1		;NO
	TLO	S,IOFST		;NEXT ITEM WILL BE FIRST ITEM OF A BUFFER
	PUSHJ	P,SETBYT##	;T1 0-5:=T1 12-13:=0,T1 6-11:=BYTE SIZE
	MOVEM	T1,DEVPTR(F)	;DEVPTR:=C(T1)
	MOVE	T1,PRS(F)	;Get CSR address
	PUSHJ	P,UBGOOD##	;Be sure device exists
	 JRST	PTRINA		;It does not, bitch
	MOVEI	T1,ERR		;Get the error (out of tape) bit
	TION	T1,@PRS(F)	;Error?
	 JRST	PTRIN1		;No, ok to begin
PTRINA:	PUSHJ  P,HNGSTP##	;Error - INFORM USER
	JRST	PTRIN		;Try again when/if restarted

PTRIN1:	TLZ	S,IOBEG		;Device is starting
	MOVEI	U,INTENB+GO	;Start tape moving - read first frame of buffer
	LDB	T2,PIOMOD##
	CAIE	T2,IB		;IMAGE BINARY?
	CAIN	T2,B		;OR BINARY?
	 TLOA	S,PTRBIM	;Yes, run in binary mode
	TLZA	S,PTRBIM	;No, run in normal mode
	 PUSHJ	P,BIMRST	;Reset binary mode pointers
	CONO	PI,PI.OFF	;BETTER NOT INTERRUPT
	TRO	S,IOACT		;TELL PI-LEVEL THE PTR IS GOING
	MOVEM	S,DEVIOS(F)
	BSIO	U,@PRS(F)	;Start the reader
	CONO	PI,PI.ON	;TURN ON PI'S
	PJRST	SETHNG##	;SET HUNG TIME AND RETURN

BIMRST:	MOVEI	T2,6		;Frames/word
	MOVEM	T2,PTRCNT(F)	;Save as frames to go
	SETZM	PTRWRD(F)	;Start with a clear word
	POPJ	P,		;All set

PTRONL:	MOVE	T1,PRS(F)	;Get CSR address
	PUSHJ	P,UBGOOD##	;Alive?
	 POPJ	P,		;No, off-line
	MOVEI	T2,ERR		;Yes, error?
	TION	T2,(T1)		;...
	 AOS	(P)		;No error, on-line
	POPJ	P,		;Error
	Subttl	Reader Interrupt Service

PTRINT::
	RDIO	T1,@PRS(F)	;Read status register
	MOVEM	T1,DEVSTS(F)	;Save for watchers
	PUSHJ	P,IOSET##	;Get S and J
	TRNE	T1,ERR		;Error (no tape)?
	 JRST	PTREND		;Yes, stop
	RDIO	U,@PRB(F)	;Get this frame
	TLNN	S,PTRBIM	;Binary mode?
	 JRST	PTRIN0		;No, all set
	TRNE	U,200		;Binary frame?
	 JRST	PRINTA		;Yes, process it
PRINTB:	MOVEI	T1,GO		;No, just read the next
	BSIO	T1,@PRS(F)	;Start the reader
	JRST	DPOPJ##		;Store S and return

PRINTA:	MOVE	T2,PTRWRD(F)	;Get word so far
	LSH	T2,6		;Shift over 6 bits
	ANDCMI	U,77		;Only 6 bits/frame
	IORB	T2,U		;Add in the new frame
	SOSG	PTRCNT(F)	;Done with word?
	 JRST	PRINTC		;Yes, Reset counter and provide word
	MOVEM	T2,PTRWRD(F)	;No, store result so far
	JRST	PRINTB		;And get next frame
PRINTC:	PUSHJ	P,BIMRST	;Word done, reset count
PTRIN0:	TRNE	S,B		;MODE=BINARY?
	 JRST	PTRI0		;YES
	ANDI	U,177		;MASK OUT PARITY BIT
	CAIN	U,RUBOUT	;LAST CHAR A RUBOUT?
	 JRST	PRINTB		;Yes, Store S, start read of next frame,
				;and dismiss
	JUMPE	U,PRINTB	;Null frame, trash it

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

PTRI1:	PUSHJ	P,ADVBFF##	;ADVANCE BUFFER
	 JRST	PTRNBF		;No new buffer, stop
PTRI2:	TLO	S,IOFST		;IOFST:=1.  NEXT ITEM IS FIRST ITEM OF A BUFFER.
	PUSHJ	P,SETIOD##	;Restart Job
	PUSHJ	P,STOIOS##	;Ensure hung count is reset
	MOVEM	J,DEVCTR(F)	;Save J
	JRST	PRINTB		;Yes, do so

PTRNBF:	TRZ	S,IOACT		;Clear IOACT
	PUSHJ	P,PTRREL	;Shut down
	JRST	STOIOS##	;Store S, and exit
;COME HERE WHEN THE READER IS SHUT OFF


PTREND:	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
	TLO	S,IOFST		;Set for new buffer
	PUSHJ	P,SETIOD##	;Restart job
	MOVEM	J,DEVCTR(F)	;
	PJRST	STOIOS##

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

	END