Google
 

Trailing-Edge - PDP-10 Archives - scratch - 10,7/unsmon/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 - V440
SUBTTL	/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 VPTPSR,440		;DEFINE GLOBAL VERSION NUMBER FOR LOADER MAP

PTPSER::ENTRY	PTPSER
;PARAMETER ASSIGNMENTS


;PTP CONTROL REGISTER
	PTPDON==10		;DONE
	PTPNTP==100		;OUT OF TAPE
	PTPFDN==200		;FORMAT CONTROL


;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)
	HORTAB==11
	FORMFD==14
	VERTAB==213
	RUBOUT==377
SUBTTL	AUTOCONFIGURE


;DRIVER CHARARCTERISTICS
;	PTP	= PTPCNF
;	PTP	= PAPER TAPE PUNCH
;	0	= KONTROLLER TYPE
;	0	= MAXIMUM UNITS PER KONTROLLER
;	MDSEC0	= SECTION FOR KDB/UDB
;	MDSEC0	= SECTION FOR DDB
DRVCHR	(PTP,PTP,0,0,MDSEC0,MDSEC0,)

	 .ORG	DEVLSD

PTPCHF:! BLOCK	1		;PI CHANNEL FLAGS
PTPCSO:! BLOCK	1		;ADDRESS OF INTERRUPT CODE
PTPPTR:! BLOCK	1		;BYTE POINTER TO CURRENT OUTPUT BUFFER
PTPCTR:! BLOCK	1		;BYTE POINTER FOR ILDB FROM USER BUFFER
PTPCNT:! BLOCK	1		;BYTE COUNT
PTPCHA:! BLOCK	1		;TEMPORARY LOCATION TO STORE CHARACTER
PTPIOB:!			;START OF I/O INSTRUCTIONS
PTPXST:! BLOCK	1		;CONI TO SAVE STATUS
PTPCNO:! BLOCK	1		;CONO
PTPCN0:! BLOCK	1		;CONO TO TURN PUNCH OFF
PTPSDN:! BLOCK	1		;CONO TO SET DONE
PTPOOT:! BLOCK	1		;CONSO TO TEST OUT OF TAPE
PTPDTO:! BLOCK	1		;DATAO
PTPDOC:! BLOCK	1		;DATAO TO PUNCH CHARACTER
PTPIOE:!			;END OF I/O INSTRUCTIONS
PTPLEN:!			;LENGTH OF PTP DDB

	 .ORG


	$LOW
PTPDDB:	DDBBEG	(PTP,PTPLEN)
	SETWRD	(DEVCHR,<4*HUNGST,,PTPSIZ##>)	;DEVCHR
	SETWRD	(DEVSER,<MCSEC0+PTPDSP>)	;DEVSER
	SETWRD	(DEVMOD,<DVOUT!DVPTP,,14403>)	;DEVMOD
	SETWRD	(DEVTYP,<<.TYPTP*.TYEST>!.SPPTP!DEPLEN,,0>) ;DEVTYP
	SETWRD	(DEVCPU,<PTPCHN##>)		;DEVCPU
	SETWRD	(PTPCHF,<PTPCHN##>)		;PI CHANNEL FLAGS
	SETWRD	(PTPXST,<CONI  000,DEVSTS(F)>)	;SAVE STATUS
	SETWRD	(PTPCNO,<CONO  000,(U)>)	;CONO
	SETWRD	(PTPCN0,<CONO  000,0>)		;TURN PUNCH OFF
	SETWRD	(PTPSDN,<CONO  000,PTPDON>)	;SET DONE
	SETWRD	(PTPOOT,<CONSO 000,PTPNTP>)	;TEST FOR OUT OF TAPE
	SETWRD	(PTPDTO,<DATAO 000,T1>)		;DATAO
	SETWRD	(PTPDOC,<DATAO 000,PTPCHA(F)>)	;PUNCH CHARACTER
	DDBEND
	$HIGH


;CONSO SKIP CHAIN CODE (AUTCON WILL FILL IN THE BLANKS)
PTPICD:	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
PTPICL==.-PTPICD			;LENGTH OF CONSO SKIP CHAIN CODE

EQUATE	(LOCAL,0,<PTPCKT,PTPKDB,PTPKLN,PTPUDB,PTPULN>)
EQUATE	(LOCAL,0,<PTPULB,PTPULP,PTPATK,PTPDTK>)

PPXDSP:	DRVDSP	(PTP,PTPCHN##,PTPDDB,PTPLEN,CPOPJ##)

;DEFAULT MONGEN'ED DEVICE TABLE
DEFMDT:	MDKL10	(7,100,0,0,<MD.KON>)	;DEVICE CODE 100
	EXP	0
PTPCFG:	XMOVEI	T1,PTPMDT##	;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,'PTP'	;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,-<PTPIOE-PTPIOB> ;-LENGTH
	XMOVEI	T2,PTPIOB(F)	;STARTING ADDRESS
	HRRZ	T3,.CPDVC##	;DEVICE CODE
	PUSHJ	P,AUTDVC##	;FILL IN DEVICE CODES
	MOVE	T1,F		;DATA BLOCK ADDRESS
	XMOVEI	T2,PTPINT	;INTERRUPT SERVICE
	PUSHJ	P,AUTICD##	;GENERATE INTERRUPT ROUTINES
	  POPJ	P,		;*** RETURN CORE ***
	MOVEM	T1,PTPCSO(F)	;SAVE ADDRESS
	MOVEI	T2,PTPCHN##	;PI CHANNEL
	PUSHJ	P,AUTCSO##	;LINK INTO CONSO SKIP CHAIN
	POPJ	P,		;ALL DONE
;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	@PTPCSO(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,@PTPCSO(F)
	MOVE	T1,PTPCHF(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,PTPCHF(F)	;CONO FLAGS
	TRO	U,PTPDON
	CONO	PI,PI.OFF
	XCT	PTPCNO(F)
	HLRM	U,@PTPCSO(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
	MOVE	S,DEVIOS(F)	;S:=C(PTPIOS)
	TLNE	S,PTPFED	;FEED REQUEST? (PTPFED=1?)
	JRST	PTPS2		;YES
	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)
	POPJ	P,		;RETURN


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
	POPJ	P,		;DISMISS INTERRUPT-BUT NO MORE
				;TO BE RECEIVED SINCE PTP NOW OFF

	END