Google
 

Trailing-Edge - PDP-10 Archives - BB-F494Z-DD_1986 - 10,7/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 - V435
SUBTTL	/RCC/DAL	10 SEP 85
	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,1984,1986
;BY DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
;ALL RIGHTS RESERVED.
;
;
; DATE		LOAD	EDIT #
; ----		----	------
;
;
;
XP VPTPSR,435
		;PUT VERSION NUMBER IN GLOB LISTING AND LOADER STORAGE MAP


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

;PTP 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	PTPINI		;INITILIZE
	JRST	PTPREL		;HUNG DEVICE TIME-OUT ERROR.
PTPDSP::JRST	PTPREL		;RELEASE
	JRST	PTPCLS		;CLOSE
	JRST	PTPOUT		;OUTPUT
	JRST	ILLINP##	;INPUT
PTPINI:
PTPREL:	XCT	PTPCN0##(F)
	HLLZS	PTPCON##(F)	;CLEAR CONSO FLAG BITS
	POPJ	P,		;RETURN




PTPCLS:	PUSHJ	P,OUT##		;OUTPUT REMAINING BUFFERS
	PUSHJ	P,WAIT1##	;WAIT FOR IOACT=0.
	MOVE	S,DEVIOS(F)	;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##(F)	;PTPCNT:=200
	MOVEI	T1,PTPDON	;SET CONSO FLAG
	HRRM	T1,PTPCON##(F)
	MOVE	T1,PTPCH##(F)	;T1:=PTPCHN, PI CHANNEL ASSIGNMENT
	XCT	PTPSDN##(F)	;DONE FLAG:=1, ASSIGN PI CHANNEL
	JRST	WAIT1##		;WAIT FOR IOACT=0, ALL BUFFERS FINISHED

PTPOUT:	XCT	PTPOOT##(F)	;OUT OF TAPE?
	JRST	PTPIN0		;NO -ENTER SERVICE
	XCT	PTPXST##(F)

	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	U,PTPDON	;CONSO FLAG
	HRR	U,PTPCH##(F)	;CONO FLAGS
	TRO	U,PTPDON
	CONO	PI,PI.OFF
	XCT	PTPCNO##(F)
	HLRM	U,PTPCON##(F)
	CONO	PI,PI.ON
	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##(F)
	PUSHJ	P,SETBYT##	;SETBYT
	HLLM	T1,PTPPTR##(F)	;PTPPTR0-5:=PTPPTR12-13:=0,PTPPTR6-11:=BYTE
				;SIZE;
	JRST	PTPIN1
;PUNCH INTERRUPT SERVICE


PTPINT::
	XCT	PTPXST##(F)	;STORE CONI STATUS

	XCT	PTPOOT##(F)	;ARE WE OUT OF TAPE?
	CAIA			;NO
	JRST	NOTAPE		;YES - GO HANDLE IT
	MOVEM	S,PTPSIO##(F)	;PTPSIO:=C(S)  SAVE S
	MOVE	S,DEVIOS(F)	;S:=C(PTPIOS)
	TLNE	S,PTPFED	;FEED REQUEST? (PTPFED=1?)
	JRST	PTPS2		;YES
	MOVE	S,PTPSIO##(F)	;RESTORE S
	JSR	PTPSVE##(F)	;SAVE ACS AND ESTABLISH P
	PUSHJ	P,IOSET##	;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##(F)	;BINARY OUTPUT BYTE SIZE=36
	ROT	T1,6
	MOVEM	T1,PTPCHA##(F)
	ANDI	T1,77		;T1:=XX, SIXBIT SUB-BYTE
	ADDI	T1,200
	XCT	PTPDTO##(F)	;PUNCH 2XX
	SOSL	PTPCNT##(F)	;C(PTPCNT):=C(PTPCNT)-1.  WORD DONE?
	JRST	STOIOS##		;NO
	SOSL	PTPCTR##(F)	;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##(F)	;PTPCNT:=10
	JRST	STOIOS##

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

PTP3:	XCT	PTPDOC##(F)	;PUNCH CHARACTER
	TRNE	S,14		;IS MODE AN ALPHA MODE
	JRST	PTP1		;NO
	MOVE	U,PTPCHA##(F)
	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##(F)	;PTPCNT:=20
	JRST	STOIOS##
PTP1:	SOSGE	PTPCTR##(F)	;C(PTPCTR):=C(PTPCTR)-1.  IS C(PTPCTR) .LT. 0?
	JRST	PTP5		;YES
	ILDB	T3,PTPPTR##(F)	;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##(F)	;PTPCHA:=OUTPUT J
	JRST	STOIOS##

PTPS2:	SETZM	PTPCHA##(F)	;PUNCH FEED
	XCT	PTPDOC##(F)
	SOSG	PTPCNT##(F)		;COUNT FEED LINES
	TLZ	S,PTPFED	;PTPFED:=0
	MOVEM	S,DEVIOS(F)	;PTPIOS:=C(S)
	MOVE	S,PTPSIO##(F)	;RESTORE S
	JRST	PTPEX1##(F)	;DISMISS


PTP5:	TLO	S,IODISC	;IODISC:=1
	JRST	STOIOS##

PTPBN:	MOVEI	T2,@DEVOAD(F)	;T2:=BUFFER ADDRESS
	PUSHJ	P,CKS12##	;T1:=CALCULATE CHECKSUM
	ADD	T2,DEVOAD(F)
	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
	PUSHJ	P,SETIOD##	;IN A WAIT?  IOW:=0
PTP9:	TLZ	S,IOFST		;IOFST:=0
	MOVE	T1,DEVOAD(F)
	AOS	T1
	HRRM	T1,PTPPTR##(F)	;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##(F)	;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##(F)	;YES
	SOS	PTPCTR##(F)
	JRST	PTPB1

PTP91:	POINT	6,PTPPTR##(F),11

PTPP1:	MOVEI	U,RUBOUT	;PTPCHA:=RUBOUT
	MOVEM	U,PTPCHA##(F)
	TLO	S,PTPEOL	;PTPEOL:=1
	JRST	STOIOS##

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
	JRST	STOIOS##	;STORE S, RESET HUNG TIMEOUT COUNT AND
				;DISMISS INTERRUPT
;WHEN END OF TAPE ENCOUNTERED, COME HERE TO FORCE A HUNG DEVICE
NOTAPE:	XCT	PTPCN0##(F)	;TURN OFF PTP-RESTART NOT ALLOWED
	JRST	PTPEX1##(F)	;DISMISS INTERRUPT-BUT NO MORE
				;TO BE RECEIVED SINCE PTP NOW OFF

END