Google
 

Trailing-Edge - PDP-10 Archives - dec-10-omona-u-mc9 - ptpser.mac
There are 6 other files named ptpser.mac in the archive. Click here to see a list.
TITLE	PTPSER - PAPER TAPE PUNCH SERVICE ROUTINE - V425
SUBTTL	/RCC/DAL	11 JAN 77
	SEARCH	F,S
	$RELOC
;***COPYRIGHT 1973,1974,1975,1976,1977 DIGITAL EQUIPMENT CORP., MAYNARD, MASS.***
XP VPTPSR,425
		;PUT VERSION NUMBER IN GLOB LISTING AND LOADER STORAGE MAP

EXTERNAL PTPCHN, PTPSAV, ADVBFE, ITMCT1, SETIOD, SETBYT, IOSET, CKS12
EXTERNAL ILLINP,  OUT, WAIT1,PTPCHL,PIOMOD
EXTERNAL SETACT,STOIOS
INTERNAL PTPINT,PTPDSP

;PTP DEVICE DATA BLOCK LINKAGE

ENTRY PTPSER
PTPSER:
; PARAMETER ASSIGNMENTS


;   PTP CONTROL REGISTER
	PTPDON==10

;   FORMAT CONTROL
	PTPFDN==200
;OUT OF TAPE FLAG
	PTPNTP==100


;   SPECIAL IO STATUS WORD ASSIGNMENTS
	IODISC==400000
	PTPFED==200000
	PTPEOL==20000
	PTPBIN==4000	;CHECKSUM BINARY
	PTPIB==2000	;IMAGE BINARY

;   SPECIAL ASCII CHARACTERS
;   DEFINED WITH THE CORRECT PARITY
	RUBOUT==377
	HORTAB==11
	VERTAB==213
	FORMFD==14


IFN FTCHECK+FTMONP,<
EXTERNAL PTPDDB,PTPIOS,PTPPTR,PTPADR,PTPCTR,PTPCNT,PTPCHA,PTPSIO,PTPCON
>
IFE FTCHECK+FTMONP,<
;PTP DEVICE DATA BLOCK

	INTERN	PTPDDB
	$LOW
PTPDDB:
	SIXBIT	/PTP/
	XWD	4*HUNGST,41	;CODE 4 - HUNG TIME IS 15 SECONDS
PTPIOS:	0
	EXP	PTPDSP
	XWD	DVPTP+DVOUT,14403
	0
	0
PTPPTR:	0
PTPADR:	XWD	R,0
PTPSTS:	0
PTPSTA:	XWD	.TYPTP!.SPPTP!DEPLEN,0	;VAR BUFFERS, SPOOLED
PTPXTR:	0
PTPEVM:	0
PTPPSI:	0
PTPESE:	0
PTPHCW:	0
PTPJOB:	0
PTPCTR:	0
PTPCNT:	0
PTPCHA:	0
PTPSIO:	0
PTPCON:	0
	$HIGH
>

;PTP SERVICE DISPATCH TABLE
EXTERN REGSIZ
	POPJ	P,0		;SPECIAL ERROR STATUS
	JRST	REGSIZ		;BUFFER LEN CAN BE GOTTEN FROM DDB
	JRST	PTPINI		;INITILIZE
	JRST	PTPREL		;HUNG DEVICE TIME-OUT ERROR.
PTPDSP:	JRST	PTPREL		;RELEASE
	JRST	PTPCLS		;CLOSE
	JRST	PTPOUT		;OUTPUT
	JRST	ILLINP		;INPUT
PTPINI:
PTPREL:	CONO	PTP,0
	HLLZS	PTPCON		;CLEAR CONSO FLAG BITS
	POPJ	P,		;RETURN




PTPCLS:	PUSHJ	P,OUT		;OUTPUT REMAINING BUFFERS
	PUSHJ	P,WAIT1		;WAIT FOR IOACT=0.
	MOVE	S,PTPIOS	;C(S):=C(PTPIOS)
	TLO	S,IODISC+PTPFED+IOW	;IODISC:=IOW:=PTPFED:=1
	PUSHJ	P,SETACT	;SET ACTIVE FLAG,STORE S,AND
				;RESET HUNG DEVICE TIMEOUT COUNT
	MOVEI	T1,200
	MOVEM	T1,PTPCNT	;PTPCNT:=200
	MOVEI	T1,PTPDON	;SET CONSO FLAG
	HRRM	T1,PTPCON
	MOVEI	T1,PTPCHN	;T1:=PTPCHN,PI CHANNEL ASSIGNMENT
	CONO	PTP,PTPDON(T1)	;DONE FLAG:=1, ASSIGN PI CHANNEL
	JRST	WAIT1		;WAIT FOR IOACT=0, ALL BUFFERS FINISHED
	EXTERN	HNGSTP,JOB


PTPOUT:	CONSO	PTP,PTPNTP	;OUT OF TAPE?
	JRST	PTPIN0		;NO -ENTER SERVICE
	CONI	PTP,PTPSTS
	PUSHJ	P,HNGSTP	;ISSUE "DEVICE PTP OK?"
	JRST	PTPOUT		;TRY AGAIN WHEN "CONT" TYPED
PTPIN0:	TLZE	S,IOBEG		;VIRGIN DEVICE? (IOBEG:=0)
	JRST	PTPIN2		;YES

PTPIN1:
	TLZ	S,IODISC	;CLEAR DISCONNECT BIT
	PUSHJ	P,SETACT	;SET ACTIVE FLAG,STORE S, AND
				;RESET HUNG DEVICE TIMEOUT COUNT
	HRLI	T1,PTPDON	;CONSO FLAG
	HRRI	T1,PTPCHN	;CONO FLAGS
	TRO	T1,PTPDON
	STARTDV	PTP
	POPJ	P,		;RETURN

PTPIN2:	LDB	T1,PIOMOD
	TLO	S, IOFST+PTPFED+IO	;IOFST:=PTPFED:=IO:=1
	TLZ	S,PTPBIN+PTPIB	;CLEAR BINARY AND IMAGE BINARY BITS
	CAIN	T1,IB		;IMAGE BINARY?
	TLO	S,PTPIB		;YES
	CAIN	T1,B		;MODE=BINARY?
	TLO	S,PTPBIN	;YES, PTPBIN:=1
	MOVEI	T1,PTPFDN	;PTPCNT:=PTPFDN
	MOVEM	T1,PTPCNT
	PUSHJ	P,SETBYT	;SETBYT
	HLLM	T1,PTPPTR	;PTPPTR0-5:=PTPPTR12-13:=0,PTPPTR6-11:=BYTE
				;SIZE; PTPPTR14-17:=R
	JRST	PTPIN1
;PUNCH INTERRUPT SERVICE


PTPINT:	CONSO	PTP,@PTPCON
	JRST	PTPINT
IFN FT5UUO,<
	CONI	PTP,PTPSTS	;STORE CONI STATUS
>
	CONSZ	PTP,PTPNTP	;ARE WE OUT OF TAPE?
	JRST	NOTAPE		;YES - GO HANDLE IT
	MOVEM	S,PTPSIO	;PTPSIO:=C(S)  SAVE S
	MOVE	S,PTPIOS	;S:=C(PTPIOS)
	TLNE	S,PTPFED	;FEED REQUEST? (PTPFED=1?)
	JRST	PTPS2		;YES
	MOVE	S,PTPSIO	;RESTORE S
	JSR	PTPSAV		;SAVE ACS AND ESTABLISH P
	MOVEI	F,PTPDDB
	PUSHJ	P,IOSET		;R:=(JBTADR 18-35),J:=C(DEVCTR)
				;S:=C(PTRIOS)
	TLZE	S,IODISC	;DISCONNECT?  (IODISC=1?)
	JRST	PTPADV		;YES
	TLZE	S,IOFST		;IOFST=1? IOFST:=0
	JRST	PTP9		;YES
	TLNN	S,PTPBIN+PTPIB	;BINARY PUNCH MODE?
	JRST	PTP3		;NO

	MOVE	T1,PTPCHA	;BINARY OUTPUT BYTE SIZE=36
	ROT	T1,6
	MOVEM	T1,PTPCHA
	ANDI	T1,77		;T1:=XX, SIXBIT SUB-BYTE
	ADDI	T1,200
	DATAO	PTP,T1		;PUNCH 2XX
	SOSL	PTPCNT		;C(PTPCNT):=C(PTPCNT)-1.  WORD DONE?
	JRST	PTPXIT		;NO
	SOSL	PTPCTR		;C(PTPCTR):=C(PTPCTR)-1.  J COUNT .LT.  0?
	JRST	PTPB1		;NO
	TLNE	S,PTPIB		;IMAGE BINARY?
	TLOA	S,IODISC	;YES, SUPPRESS TAPE FEED.
	TLO	S,IODISC+PTPFED	;IODISC:=PTPFED:=1
	MOVEI	T1,10
	MOVEM	T1,PTPCNT	;PTPCNT:=10
	JRST	PTPXIT

PTPB1:	MOVEI	T1,5		;PTPCNT:=5
	MOVEM	T1,PTPCNT
	MOVE	U,@PTPPTR	;PTPCHA:=OUTPUT DATA WORD
	AOS	PTPPTR		;PTPPTR:=C(PTPPTR)+1.  ADVANCE J POINTER.
	MOVEM	U,PTPCHA
	JRST	PTPXIT

PTP3:	DATAO	PTP,PTPCHA	;PUNCH CHARACTER
	TRNE	S,14		;IS MODE AN ALPHA MODE
	JRST	PTP1		;NO
	MOVE	U,PTPCHA
	CAIE	U,HORTAB	;HORIZONTAL OR VERTICAL TAB?
	CAIN	U,VERTAB
	JRST	PTPP1		;YES
	CAIE	U,FORMFD	;FORM FEED?
	JRST	PTP1		;NO
	TLO	S,PTPFED+PTPEOL	;PTPFED:=PTPEOL:=1
	MOVEI	U,20
	MOVEM	U,PTPCNT	;PTPCNT:=20
	JRST	PTPXIT
	EXTERNAL PEVEN8		;IN IOCSS, FOR PARITY IN ASCII

PTP1:	SOSGE	PTPCTR		;C(PTPCTR):=C(PTPCTR)-1.  IS C(PTPCTR) .LT. 0?
	JRST	PTP5		;YES
	ILDB	T3,PTPPTR	;T3:=OUTPUT J
	LDB	T1,PIOMOD
	CAIN	T1,I		;MODE=IMAGE?
	JRST	PTP6		;YES
	IORI	T3,200		;NO, INSERT EIGHTH HOLE
	TRNN	T1,14		;AN ASCII MODE?
	PUSHJ	P,PEVEN8	;YES. TURN EIGHTH HOLE OFF IF
				; APPROPRIATE TO GET EVEN PARITY
	JUMPE	T3,PTP1		;IF AN ASCII NULL, IGNORE IT.
				; THEY ARE PUT IN BY PTPFED STUFF
				; ELSE FALL INTO PTP6

PTP6:	MOVEM	T3,PTPCHA	;PTPCHA:=OUTPUT J
	JRST	PTPXIT

PTPS2:	CLEARM	PTPCHA		;PUNCH FEED
	DATAO	PTP,PTPCHA
	SOSG	PTPCNT		;COUNT FEED LINES
	TLZ	S,PTPFED	;PTPFED:=0
	MOVEM	S,PTPIOS	;PTPIOS:=C(S)
	MOVE	S,PTPSIO	;RESTORE S
	JEN	@PTPCHL		;DISMISS


PTP5:	TLO	S,IODISC	;IODISC:=1
	JRST	PTPXIT

PTPBN:	MOVEI	T2,@PTPADR	;T2:=BUFFER ADDRESS
	PUSHJ	P,CKS12		;T1:=CALCULATE CHECKSUM
	ADD	T2, PTPADR
	HLLM	T1,@T2		;STORE CHECKSUM IN LEFT HALF OF FIRST BUFFER DATA WORD.
	JRST	PTPB1
PTPADV:	PUSHJ	P,ADVBFE	;ADVANCE BUFFER
	JRST	PTPDSC		;EXIT1.  NEXT BUFFER EMPTY
				;IN A WAIT?  IOW:=0
	PUSHJ	P,SETIOD	;YES.  IOWS:=1
PTP9:	TLZ	S,IOFST		;IOFST:=0
	MOVE	T1,PTPADR
	AOS	T1
	HRRM	T1,PTPPTR	;PTPPTR18-35:=C(PTPADR18-35)+1
	HRRZ	J,@T1		;J:=WORD COUNT
	LDB	T2,PTP91	;PICK UP BYTE SIZE
	PUSHJ	P,ITMCT1	;J:=WORD COUNT*[36/BYTE SIZE]
	MOVEM	J,PTPCTR	;PTPCTR:=C(J)
	JUMPE	J,PTPADV	;IS J COUNT=0?
	TLNE	S,PTPBIN	;BINARY PUNCH MODE?
	JRST	PTPBN		;YES
	TLNN	S,PTPIB		;IMAGE BINARY?
	JRST	PTP1
	AOS	PTPPTR		;YES
	SOS	PTPCTR
	JRST	PTPB1

PTP91:	POINT	6,PTPPTR,11

PTPP1:	MOVEI	U,RUBOUT	;PTPCHA:=RUBOUT
	MOVEM	U,PTPCHA
	TLO	S,PTPEOL	;PTPEOL:=1
	JRST	PTPXIT

PTPDSC:	PUSHJ	P,PTPREL	;CLEAR PTP CONTROL REG AND CONSO BITS
	TRZ	S,IOACT		;IOACT:=0
	TLO	S,IOFST		;IOFST:=1
				;IN A WAIT?  IOW:=0
	PUSHJ	P,SETIOD	;YES.  IOWS:=1

PTPXIT:	JRST	STOIOS		;STORE S, RESET HUNG TIMEOUT COUNT AND
				;DISMISS INTERRUPT
		;WHEN END OF TAPE ENCOUNTERED, COME HERE TO FORCE A HUNG DEVICE
NOTAPE:	CONO	PTP,0		;TURN OFF PTP-RESTART NOT ALLOWED
	JEN	@PTPCHL		;DISMISS INTERRUPT-BUT NO MORE
				;TO BE RECEIVED SINCE PTP NOW OFF

END