Google
 

Trailing-Edge - PDP-10 Archives - BB-F493Z-DD_1986 - 10,7/d76int.mac
There are 8 other files named d76int.mac in the archive. Click here to see a list.
TITLE D76INT - INTERUPT SERVICE FOR DC76 FRONT END V065
SUBTTL DONALD LEWINE  10 SEP 85
	SEARCH	F,S
	$RELOC
	$HIGH



;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,1984,1986
;BY DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
;ALL RIGHTS RESERVED.


;
;
XP VDC76I,065		;VERSION NUMBER FOR MAP AND GLOB


D76INT::ENTRY	D76INT
;D76INT SERVICES INTERUPTS FROM THE DC76. IT MAINTAINS 2 QUEUES
; ONE OF MESSAGES FROM THE -11 THE OTHER MESSAGES TO THE -11. ALL
; DATA GOES VIA THESE QUEUES.
	DLMAP		;DEFINE OFFSETS IN DL10 MAP

;FRONT END CONTROL FUNCTIONS
XP	FECXMT,2	;TRANSMIT DATA
XP	FECCOB,4	;CLEAR OUTPUT BUFFER
XP	FECMDM,6	;MODEM CONTROL
XP	FECEXM,10	;EXAMINE
XP	FECDEP,12	;DEPOSIT
XP	FECFNI,14	;FUNCTION NOT IMPLEMENTED IN THE -10
XP	FECLPC,16	;LINE PARAMETER CONTROL


;MODEM CONTROL FUNCTIONS
XP	MDMOFF,2	;TURN MODEM OFF
XP	MDMON,4		;TURN MODEM ON
XP	MDMRNG,6	;DATASET IS RINGING
XP	MDMINI,10	;COMPUTER RESTARTED

;AC USAGE IN D76INT

;P	PUSH DOWN POINTER

;J	(PRESERVED) BASE ADDRESS FOR THIS PDP-11'S COMMON MEMORY
;	AREA.

;U	LDB ADDRESS OR DSCTAB INDEX

;T1	TEMP

;T2	TEMP

;T3	CHARACTER

;T4	TEMP

;P1-P4	PRESERVED AC'S. NEVER CONTAIN GLOBAL INFORMATION

;AC'S NOT LISTED ABOVE ARE NOT READ OR WRITTEN BY D76INT
;ROUTINE TO START OUTPUT FOR QUEUED PROTOCOL
;CALLED FROM COMDEV WITH T1 SETUP TO THE QUEUE HEADER ADDRESS
D76STO::PUSH	P,T1		;SAVE QUEUE HEADER ADDRESS
	PUSHJ	P,TOTAKE##	;GET AN ACTIVE LINE
	  JRST	TPOPJ##		;IF NONE
	MOVEI	T1,L1RCHP##
	TDNE	T1,LDBBYT##(U)	;ANY CHANGES?
	PUSHJ	P,[ANDCAM T1,LDBBYT##(U)
		   MOVEI T1,ISRCHP##
		   PJRST @LDBISR##(U)]
	SKIPGE	LDBDCH##(U)	;LINE BUSY
	PUSHJ	P,XMTCHR##	;NO, START OUTPUT NOW
	  JRST	D76ST1		;DON'T TYPE ON IDLE LINE
	MOVEI	T1,ISRTYP##	;FUNCTION TO TYPE CHAR
	PUSHJ	P,@LDBISR##(U)	;TYPE IT
	PUSHJ	P,CLRIRM##	;CLEAR IRMA CATCHER BITS
D76ST1:	POP	P,T1		;RESTORE QUEUE HEADER ADDRESS
	JRST	D76STO		;LOOP OVER WHOLE QUEUE
;SUBROUTINE TO EXERCISE CONTROL OVER A DATASET
;CALL WITH:
;	MOVEI	J,DL10 BASE ADDRESS
;	MOVEI	U,DSCTAB-INDEX
;	MOVEI	T3,TRANSACTION-CODE
;	PUSHJ	P,D76DSC
;	RETURN HERE
D76DSC::SETZM	T2		;FLAG FOR INVALID FUNCTION
	CAIN	T3,DSTON##	;WANT TO TURN DATASET ON?
	MOVEI	T2,<MDMON>B27	;YES--LOAD CODE
	CAIN	T3,DSTOFF##	;WANT TO TURN IT OFF?
	MOVEI	T2,<MDMOFF>B27	;YES--LOAD THAT CODE
	CAIN	T3,DSTREQ##	;WANT TO KNOW STATUS?
	JRST	[MOVEI T3,DSTNAC## ;TELL SYSINI NOT TO TAKE ACTION
		 POPJ  P,]	; DC76 WILL REPORT STATUS (MAY HAVE DONE SO ALREADY)
	JUMPE	T2,CPOPJ##	;INVALID FUNCTION
	SKIPG	DWN(J)		;DO WE THING HE'S UP?
	POPJ	P,		;NO. DON'T QUEUE ANYTHING
	MOVE	T3,T2		;MOVE SUB FUNCTION
	HRRZ	T2,DSCTAB##(U)	;PICK UP LINE NUMBER
	SUB	T2,LTO(J)	;REMOVE LINE TABLE OFFEST
	TRO	T2,<FECMDM>B27	;JAM IN FUNCTION CODE
	MOVE	T1,[-2,,T2]	;POINTER TO ARGS
	PJRST	PUTMSG		;SEND TO THE DC76
;SUBROUTINE TO SETUP EVERYTHING ACCORDING TO LDB
;CALL WITH:
;	MOVEI	U,LDB-ADDRESS
;	PUSHJ	P,D76CHP
;	RETURN HERE
D76CHP::LDB	T3,LDPSPD##	;GET LINE SPEED
	JUMPE	T3,CPOPJ##
	TRO	T3,<LPCSPD>B27	;SUBFUNCTION
	PJRST	D76LPC		;GO SET/CLEAR THAT BIT
;SUBROUTINE TO CHANGE HARDWARE PARAMETERS BASED ON TRMOP. AND SET TTY
;CALL WITH:
;	MOVE	T3,[<SUBFUNCTION>B27+DATA]
;	MOVEI	U,ADDRESS-OF-LDB
;	PUSHJ	P,D76LPC
;	RETURN HERE
D76LPC::LDB	T2,LDPLNO##	;SET UP LINE NUMBER
	SUB	T2,LTO(J)	;MAKE CORRECT LINE RELATIVE TO DC76
	JUMPL	T2,CPOPJ##	;NEGATIVE IS NOT IN RANGE
	CAML	T2,NTT(J)	;IS IT IN RANGE?
	POPJ	P,0		;NO--JUST IGNORE IT
	TRO	T2,<FECLPC>B27	;PUT IN FUNCTION
	MOVE	T1,[-2,,T2]	;POINT TO ARGUMENT
	SKIPLE	DWN(J)		;IS 76 UP?
	PJRST	PUTMSG		;GO STORE IN QUEUE
	POPJ	P,0		;76 IS DOWN

;SUBROUTINE TO SEE IF FRONT END IS ON LINE
;CALL WITH:
;	PUSHJ	P,D76OFL
;	OFF-LINE
;	ON-LINE
D76OFL::SKIPLE	DWN(J)		;IS 76 UP?
	AOS	(P)		;YES
	POPJ	P,0		;NO
;SUBROUTINE TO TYPE A CHARACTER ON A DC76 LINE
;CALL WITH:
;	MOVEI	U,LDB
;	MOVEI	J,DL10 BASE (DONE VIA PUSHJ P,@LDBISR(U))
;	MOVE	T3,DATA
;	PUSHJ	P,D76TYP
;	RETURN HERE
D76TYP::MOVE	T1,[-2,,T2]	;2 WORD ENTRY IN THE AC'S
	LDB	T2,LDPLNO##	;T2 IS THE LINE NUMBER
	SUB	T2,LTO(J)	;CONVERT TO DC76 LINE NUMBER
	CAML	T2,NTT(J)	;IS LINE NUMBER TOO BIG?
	POPJ	P,0		;YES--RETURN
	TRO	T2,<FECXMT>B27	;FUNCTION = XMIT DATA
	SKIPG	DWN(J)		;IS DC76 KNOWN TO BE DOWN?
	PJRST	TSETBO##	;YES--CLEAR OUTPUT BUFFER AND RETURN
				; DOING NO OUTPUT.
	ANDI	T3,377		;REMOVE JUNK FROM CHAR
;FALL INTO PUTMSG
;SUBROUTINE TO QUEUE A MESSAGE OVER TO THE PDP-11
;CALL WITH:
;	MOVEI	J,BASE OF DL10 MAP
;	HLL	T1,-SIZE OF MESSAGE
;	HRR	T1,ADDRESS OF FIRST WORD (T2-T4 OK TO USE)
;	PUSHJ	P,PUTMSG	
;	RETURN HERE

PUTMSG::PUSHJ	P,SAVE3##	;SAVE P1 - P3
	SCNOFF
	MOVE	P1,TEP(J)	;TO -11 PUTTER
	MOVE	P2,TEA(J)	;TO -11 QUEUE
	HRLI	P2,P1		;INDEX REG. FOR @P2
PTMSGL:	AOS	P1		;BUMP POINTER
	CAMN	P1,EBS(J)	;OFF THE END?
	SETZM	P1		;YES--WRAP AROUND
	CAMN	P1,TEG(J)	;QUEUE FULL
	JRST	PTMSGX		;YES--REPORT LOSSAGE
	MOVE	P3,(T1)		;GET DATA WORD
	MOVEM	P3,@P2		;STORE IN THE QUEUE
	AOBJN	T1,PTMSGL	;LOOP FOR WHOLE MESSAGE
	MOVEM	P1,TEP(J)	;NOW! STORE THE UPDATED POINTER.
	PJRST	SONPPJ##	;RESTORE PI AND RETURN

;HERE WHEN THE QUEUE IS FULL
PTMSGX:
	SCNON
	SKIPN	HLT(J)		;DC76 HALTED?
	SKIPE	OK(J)		; OR HUNG?
	POPJ	P,		;YES, PRINT ERROR MESSAGE IN COMDEV
;AT THIS POINT THERE SHOULD BE SOME CLEVER CODE, BUT...
	STOPCD	CPOPJ##,DEBUG,DC76QF,	;++DC76 QUEUE FULL
;HERE ON A DC76 INTERRUPT WITH:
;	J = DL10 MAP
;	P = SCNPDP
D76KII:	MOVE	J,(W)
	PUSHJ	P,GETMSG	;GET A DATA BYTE FROM THE QUEUE
;COME HERE WHEN WE THINK THE DC76 IS DOWN.

	  JRST	[AOS EMPTYI	;COUNT THE EVENT
		 POPJ P,0]	;AND DISMISS
	LDB	T2,[POINT 8,T1,27]	;GET THE FUNCTION
	CAILE	T2,FUNMAX	;FUNCTION TOO BIG
	MOVEI	T2,0		;YES--KNOCK DOWN TO SIZE
	SKIPL	FUNTAB(T2)	;LINE NUMBERED FUNCTION?
	JRST	D76KI1		;NO--CONTINUE BELOW
	ANDI	T1,377		;MASK DOWN TO LINE NUMBER
	CAML	T1,NTT(J)	;VALID LINE NUMBER
	JRST	NGLINE		;NO--FLUSH
D76KI1:	SKIPN	FUNTAB(T2)	;IS FUNCTION IMPLEMENTED?
	JRST	FNIFLT		;NO--GENERATE FUNCTION NOT IMPLEMENTED
	MOVSI	T3,(FC.DSC)	;DATA SET CONTROL FUNCTION?
	TDNE	T3,FUNTAB(T2)	; ..
	SKIPA	U,DTO(J)	;YES--GET DSCTAB OFFSET
	MOVE	U,LTO(J)	;NO--GET LINTAB OFFSET
	ADD	U,T1		;GET CORRECT NUMBER
	PUSHJ	P,@FUNTAB(T2)	;DO THE RIGHT THING
	JRST	D76KII		;LOOP FOR MORE

;HERE IF WE HAVE NOT IMPLEMENTED A GIVEN FUNCTION
FNIFLT:	TRO	T2,<<FECFNI>B27>;ADD IN FUNCTION
	HRROI	T1,T2		;POINTER TO ENTRY
	AOS	XMTFNI		;NUMBER OF TIMES WE SAID THIS
	PJRST	PUTMSG		;SAY IT NOW

;HERE ON A LINE NUMBER OUT OF RANGE
NGLINE:	MOVSI	T1,(FC.2WD)	;TWO WORD FUNCTION?
	TDNE	T1,FUNTAB(T2)	; ??
	PUSHJ	P,GETMSG	;YES--FLUSH THE 2ND WORD
	  JRST	D76KII		;LOOK FOR MORE STUFF
	JRST	D76KII		;LOOK FOR MORE STUFF
;TABLE OF FUNTIONS FOR MESSAGES FROM DC76

	FC.LNO==1B0		;LINE NUMBERED FUNCTION
	FC.DSC==1B1		;DATA SET FUNCTION
	FC.2WD==1B2		;TWO WORD FUNCTION

FUNTAB:	0			;NO FUNCTION ZERO!!
	FC.LNO+XMTINT##		;(1)TRANSMIT DONE
	FC.LNO+FC.2WD+RCVDAT	;(2)RECEIVED DATA
	WRDF11			;(3)WORD FROM THE -11
	FC.LNO+FC.2WD+FC.DSC+MDMFUN	;(4)MODEM CONTROL
	REJECT			;(5)FUNCTION REJECTED
	FC.2WD+FC.LNO+LPCFUN	;(6)LINE PARAMETER CONTROL
FUNMAX==.-FUNTAB-1
;HERE ON RECEIVE DONE

RCVDAT:	PUSHJ	P,GTMSGH	;GET THE DATA BYTE
	MOVEI	T3,CK.CHR	;COPY DATA TO CORRECT AC
	AND	T3,T1		; ..
	PJRST	RECINT##	;CALL SCNSER

;HERE WITH A WORD FROM THE -11

WRDF11:	PUSHJ	P,GTMSGH	;GET THE DATA WORD
	MOVEM	T1,DATF11	;STORE DATA FROM -11
	SKIPN	T1,C11USR	;IS THE A USER OF THE CAL11. UUO?
	POPJ	P,0		;NO--STRANGE 
	PJRST	WAKJOB##	;YES--WAKE HIM UP

;HERE IF THE -11 REJECTS A COMMAND
REJECT:	AOS	CMRCNT		;COUNT THE EVENT
	POPJ	P,0		;RETURN

;HERE ON A MODEM CONTROL FUNCTION
MDMFUN:	PUSHJ	P,GTMSGH	;GET WORD OR HALT
	ROT	T1,-1		;DIVIDE BY 2
	SKIPLE	T3,T1		;ODD 
	CAILE	T1,6		;OR TOO BIG?
	POPJ	P,0		;YES--IGNORE
	PJRST	DSCREC##	;CALL SCNSER


;HERE ON A LINE PARAMETER CONTROL MESSAGE
LPCFUN:	PUSHJ	P,GTMSGH	;GET THE MESSAGE
	LDB	T2,[POINT 7,T1,26]	;GET THE FUNCTION
	CAILE	T2,LPCMAX	;SKIP IF NOT TOO BIG
	POPJ	P,0		; IGNORE THE MESSAGE
	JRST	@LPCTAB(T2)	;ELSE PROCESS FUNCTION

LPCTAB:	CPOPJ##			;(0)ILLEGAL -- JUST IGNORE
	RLPSPD			;(1)SET SPEED
LPCMAX==.-LPCTAB-1

RLPSPD:	MOVE	U,LINTAB##(U)	;SET UP 'U' FOR DPB
	SE1XCT	<DPB T1,LDPSPD##> ;STORE NEW SPEED
	POPJ	P,0		;AND RETURN
;SUBROUTINE TO GET A WORD FROM THE TO -10 QUEUE OR DIE TRYING
;CALL WITH:
;	MOVEI	J,ADDRESS-OF-MAPPED-AREA
;	PUSHJ	P,GTMSGH
;	RETURN HERE
;
GTMSGH::PUSHJ	P,GETMSG	;CALL GETMSG
	  STOPCD CPOPJ##,DEBUG,DC76MS, ;++DC76 MESSAGE IS SHORT
	POPJ	P,0		;RETURN

;SUBROUTINE TO GET A WORD FROM THE TO -10 QUEUE
;CALL WITH:
;	MOVEI J,DL10 BASE ADDRESS
;	PUSHJ	P,GETMSG
;	  RETURN HERE IF QUEUE EMPTY
;	RETURN HERE WORD IN T1

GETMSG:	PUSHJ	P,SAVE1##	;USE NO AC'S
	MOVE	P1,TTG(J)	;P1 _ TO TEN GETTER
	CAMN	P1,TTP(J)	;QUEUE EMPTY?
	POPJ	P,0		;YES--NONSKIP RETURN
	AOS	P1		;INCREMENT GETTER
	CAMN	P1,TBS(J)	;TIME TO WRAP AROUND?
	SETZM	P1		;YES--BACK TO THE START
	PUSH	P,P1
	ADD	P1,TTA(J)	;POINT TO QUEUE
	MOVE	T1,(P1)		;GET THE DATUM
	POP	P,TTG(J)	;SHOW 11 WE HAVE MOVED
	JRST	CPOPJ1##	;RETURN
;HERE WHEN WE THINK THE DC76 IS DOWN

D76DWN:
D76DSP==:CPOPJ##		;WE DON'T USE ANF-10 FEK ENTRY VECTORS
	POPJ	P,
;COME HERE WHEN A DC76 PDP11 COMES UP

D76III::PUSHJ	P,SAVE2##	;SAVE P1-P2
	MOVE	P1,DLXWIN##(W)	;POINT P1 TO WINDOW
	MOVE	T1,[PUSHJ P,D76KII]	;INTERRUPT INSTR
	MOVEM	T1,DLXINI##(W)
	MOVE	T1,[XWD MC11FN,C11FTB]
	MOVEM	T1,DLXCAL##(W)	;CAL11. DISPATCH TABLE
	MOVE	T1,[PUSHJ P,D76DWN]
	MOVEM	T1,DLXPRG##(W)	;"DOWN" INSTRUCTION
	MOVEI	P2,1		;FLAG AS UP
	MOVEM	P2,DWN(P1)	; ..
	MOVE	T1,[310000,,DPYWRD]	;SET UP FOR LIGHTS
	MOVEM	T1,ESA(P1)	; ..
	TLZ	T1,(1B2)	; ..
	MOVEM	T1,WNU(P1)	; ..
	POPJ	P,		;ALL DONE.
;CAL11. UUO FOR DC76
;CALL WITH:
;	MOVE	AC,[+LENGTH,,BLK]
;	CAL11.	AC,		;CALLI 125
;	  ERROR RETURN
;	WIN RETURN

;  ENTER WITH DL10 BASE IN W, LENGTH OF BLOCK IN T3.
;   WINDOW BASE IN P1.

PRVUSR==400000			;USER MUST HAVE JB,POK PRIVILIGE

C11FTB::XWD	PRVUSR,DEP11	;(0) DEPOSIT TO -11
	XWD	PRVUSR,EXAM11	;(1)EXAMINE THE -11
	XWD	PRVUSR,QUE11	;(2)QUEUE A MESSAGE
	XWD	0,CAL11N##	;(3)IDENTIFY ALL
	XWD	0,CAL11S##	;(4)IS PORT UP OR DOWN
	XWD	PRVUSR,CPOPJ##	;(5) SEND MESSAGE
	XWD	PRVUSR,CPOPJ##	;(6) RECEIVE MESSAGE
	XWD	0,TYP11		;(7) RETURN TYPE
MC11FN==.-C11FTB
;SUBROUTINE TO DO A DEPOSIT OR EXAMINE
;CALL WITH:
;	MOVE	T3,+LENGTH
;	MOVE	P1,BASE ADDRESS
;	PUSHJ	P,DEP11/EXAM11
DEP11:	SUBI	T3,2		;MUST HAVE ADDRESS AND DATA
	JUMPL	T3,ECOD7##	; ERROR 7 IF YOU DON NOT
	PUSHJ	P,GETWD1##	;GET ADDRESS
	MOVE	T3,T1		;SAVE ADDRESS
	PUSHJ	P,GETWD1##	;GET THAT WORD
	MOVE	T4,T1		;COPY IT
	MOVEI	T2,<<FECDEP>B27>;DEPOSIT FUNCTION
	MOVE	T1,[-3,,T2]	;POINTER
	JRST	DEPEX		;DO IT
EXAM11:	SOJL	T3,ECOD7##	;NEED ADDRESS
	PUSHJ	P,GETWD1##	;GET THE ADDRESS
	MOVE	T3,T1		;COPY TO CORRECT AC
	MOVEI	T2,<<FECEXM>B27>;FUNCTION FOR EXAMINE
	MOVE	T1,[-2,,T2]	;POINTER TO DATA
DEPEX:	CAMN	J,C11USR	;IS THIS USER THE ONE WHO IS WAITING?
	SETZM	C11USR		;YES--MUST HAVE USED ^C 
	SKIPE	C11USR		;ANY USER WAITING
	JRST	ECOD4##		;YES--FATAL ERROR 4
	MOVEM	J,C11USR	;STORE OUR JOB NUMBER
	MOVE	J,P1		;COPY 11 BASE ADDRESS
	SETOM	DATF11		;FLAG AS UNKNOWN
	PUSHJ	P,PUTMSG	;QUEUE THE MESSAGE OVER TO THE -11
	MOVE	J,.CPJOB##	;PUT JOB NUMBER IN J FOR SLEEP UUO
	MOVEI	T1,12		;SLEEP FOR 10.
	PUSHJ	P,SLEEP##	; SECONDS
	SETZM	C11USR		;FREE UP THE QUEUE
	SKIPGE	T1,DATF11	;DID WE GET AN ANSWER?
	PJRST	ECOD5##		;NO--ERROR
	PJRST	STOTC1##	;YES--WE WON!!

;HERE TO RETURN TYPE OF FRONT END
TYP11:	MOVEI	T1,1		;DC76 (.C1D76)
	PJRST	STOTC1		;RETURN
;SUBROUTINE TO QUEUE A MESSAGE TO THE -11 FOR CAL11. UUO
;CALL WITH:
;	MOVE	M,STUFF FOR GETWD1
;	MOVE	T3,+LENGTH
;	PUSHJ	P,QUE11
QUE11:	PUSHJ	P,SAVE4##	;ALWAYS SAVE THE P'S
	CAILE	T3,3		;LESS THAN 3 WORDS?
	JRST	ECOD6##		;NO--ERROR 6
	MOVE	P2,T3		;SAVE COUNT
	MOVE	P4,T3		;SAVE IT AGAIN
	MOVEI	P3,T1		;POINTER
QUE11L:	PUSHJ	P,GETWD1##	;GET ARGUMENT
	PUSH	P3,T1		;STORE
	SOJG	P2,QUE11L	;DO UP TO 3 ARGS
	MOVN	T1,P4		;COPY LENGTH FROM AC WE HAVE NOT ALTERED
	HRLZ	T1,T1		;TO LEFT HALF
	HRRI	T1,T2		;REST OF POINTER
	MOVE	J,P1		;GET DL10 MAP BASE SET UP BY CALL11 IN COMDEV
	AOS	(P)		;GOOD RETURN
	PJRST	PUTMSG		;QUEUE IT OVER
	$LOW

;MISC STORAGE

EMPTYI:	0		;NUMBER OF DC76 INTERRUPTS WITH QUEUE EMPTY

DATF11:	0		;DATA FROM -11 USED FOR DEBUGGING AND TESTING.

C11USR:	0		;JOB NUMBER OF JOB DOINT CAL11. UUO

CMRCNT:	0		;NUMBER OF COMMANDS REJECTED BY THE -11

XMTFNI:	0		;NUMBER OF TIMES WE SAID "FECFNI"

DPYWRD:	0		;WORD DISPLAYED IN DL10 MEMORY BUFFER
	$LIT
	END