Google
 

Trailing-Edge - PDP-10 Archives - BB-JR93N-BB_1990 - 10,7/galaxy/nebula/nebdcn.mac
There are 6 other files named nebdcn.mac in the archive. Click here to see a list.
TITLE	NEBDCN - DECnet-10 I/O driver for the Network Queue Controller
SUBTTL	D. P. Mastrovito & Joseph A. Dziedzic /DPM/JAD


;
;
;	      COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION
;                               1986,1987.
;			ALL RIGHTS RESERVED.
;
;
;     THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY  BE  USED
;     AND COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE
;     AND WITH THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.   THIS
;     SOFTWARE  OR ANY OTHER COPIES THEREOF MAY NOT BE PROVIDED OR
;     OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON.  NO  TITLE  TO
;     AND OWNERSHIP OF THE SOFTWARE IS HEREBY TRANSFERRED.
;
;     THE INFORMATION  IN  THIS  SOFTWARE  IS  SUBJECT  TO  CHANGE
;     WITHOUT  NOTICE  AND SHOULD NOT BE CONSTRUED AS A COMMITMENT
;     BY DIGITAL EQUIPMENT CORPORATION.
;
;     DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY
;     OF  ITS  SOFTWARE  ON  EQUIPMENT  WHICH  IS  NOT SUPPLIED BY
;     DIGITAL.

	SEARCH	NEBPRM
	MODULE	(NEBDCN)

	IOVEC	(DCN,<DECnet>)
SUBTTL	DECnet-10 I/O driver -- Definitions and parameters


	DCNLVL==0		;INTERRUPT PRIORITY LEVEL
SUBTTL	DECnet-10 specific DQS parameters


;Object type of DQS server

	.OBDQS==^D66		;OFFICIAL DQS OBJECT NUMBER
IFN OLDDQS,<
	.OBOLD==OLDDQS		;UNOFFICIAL DQS USED A CUSTOMER TYPE
>
SUBTTL	DECnet-10 I/O driver -- DCNINI - Initialization


DCNINI:	PUSHJ	P,PSIAVG##	;ASSIGN GLOBAL VECTOR
	  POPJ	P,		;FAILED
	MOVEM	S1,DCNVEC	;SAVE VECTOR ADDRESS
	MOVEI	T1,DCNINT	;DECNET EVENT INTERRUPT ROUTINE
	MOVEM	T1,.PSVNP(S1)	;SET ADDRESS
	HRREI	T1,.PCNSP	;CONDITION CODE
	MOVE	T2,S2		;OFFSET,,0
	MOVSI	T3,DCNLVL	;INTERRUPT PRIORITY LEVEL
	MOVE	S1,[PS.FAC+T1]	;ADD CONDITION BIT + ADDRESS
	PISYS.	S1,		;...
	  POPJ	P,		;FAILED
	JRST	.POPJ1		;RETURN
SUBTTL	DECnet-10 I/O driver -- DCNINF - Return information about a node


;RETURN INFORMATION ABOUT NODE
; CALL:	MOVE	S1, NODE NAME
;	PUSHJ	P,DCNINF

DCNINF:	TDNN	S1,[-1,,777600]	;NODE NAME?
	POPJ	P,		;NO
	MOVE	T2,S1		;ARGUMENT
	MOVEI	S1,T1		;SET UP UUO AC
	MOVE	T1,[.DNNDI,,2]	;FUNCTION,,LENGTH
	TXO	T1,DN.FLE!DN.FLR ;EXECUTOR AND REACHABLE FLAGS
	DNET.	S1,		;CHECK STATUS
	  JSP	S2,.+2		;FAILED
	JRST	.POPJ1		;RETURN GOODNESS
	CAIN	S1,DNNSN%	;NO SUCH NODE?
	POPJ	P,		;THAT'S OK
	PJRST	UUOERR##	;REPORT UUO ERROR AND RETURN
SUBTTL	DECnet-10 I/O driver -- DCNOPN - Open connection


DCNOPN:	MOVE	S1,.JBNOD(R)	;GET NODE NAME
	CAMN	S1,[SIXBIT/*/]	;PASSIVE CONNECT?
	JRST	DCNOPP		;YES

;Open active connection

	MOVEI	S1,[ITEXT (^N/.JBNOD(R)/)] ;ITEXT POINTER TO STRING
	MOVEI	S2,NODBLK	;STRING BLOCK ADDRESS
	PUSHJ	P,FILSTB	;FILL IN THE STRING BLOCK
	MOVEI	S1,.NSCDD+1	;LENGTH OF CONNECT BLOCK
	MOVEM	S1,CONBLK+.NSCNL
	MOVEI	S1,NODBLK	;NODE NAME STRING BLOCK ADDRESS
	MOVEM	S1,CONBLK+.NSCND
	MOVEI	S1,SRCBLK	;SOURCE TASK DESCRIPTOR BLOCK ADDRESS
	MOVEM	S1,CONBLK+.NSCSD
	MOVEI	S1,DSTBLK	;DESTINATION TASK DESCRIPTOR BLOCK ADDRESS
	MOVEM	S1,CONBLK+.NSCDD
	MOVEI	S1,.NSDPN+1	;LENGTH OF SOURCE/DESTINATION TASK BLOCKS
	MOVEM	S1,SRCBLK+.NSDFL
	MOVEM	S1,DSTBLK+.NSDFL
	MOVEI	S1,1		;FORMAT TYPE (NO SYMBOL)
	MOVEM	S1,SRCBLK+.NSDFM
	SETZM	SRCBLK+.NSDOB	;NO OBJECT TYPE
	SETZM	SRCBLK+.NSDPP	;NO PPN
	MOVEI	S1,STSBLK	;SOURCE TASK DESCRIPTOR STRING BLOCK ADDRESS
	MOVEM	S1,SRCBLK+.NSDPN
	SETZM	DSTBLK+.NSDFM	;FORMAT TYPE (NO SYMBOL)
	MOVX	S1,.OBDQS	;OBJECT TYPE
	MOVEM	S1,DSTBLK+.NSDOB
	SETZM	DSTBLK+.NSDPP	;NO PPN
	SETZM	DSTBLK+.NSDPN	;NO PROCESS NAME
	MOVEI	S1,[ITEXT (NEBULA-^D/.JQOBJ+OBJ.UN(R)/)] ;ITEXT POINTER TO STRING
	MOVEI	S2,STSBLK	;STRING BLOCK ADDRESS
	PUSHJ	P,FILSTB	;FILL IN THE STRING BLOCK
IFN OLDDQS,<
	PUSHJ	P,DCNOP0	;TRY TO MAKE THE CONNECTION
	  TRNA			;ERROR: SPECIAL HANDLING
	JRST	.POPJ1		;NO ERRORS: SKIP RETURN
	CAXE	S2,.NSSRJ	;REJECTED? (NO DJM)
	POPJ	P,		;NO, REPORT THE ERROR
	MOVX	S1,JB.OLD	;SET FLAG FOR OLD DQS OBJECT
	IORM	S1,.JBFLG(R)	;
	MOVX	S1,.OBOLD	;TRY AGAIN WITH THE OLD OBJECT NUMBER
	MOVEM	S1,DSTBLK+.NSDOB
DCNOP0:
>
	MOVE	S1,[.NSFEA,,3]	;FUNCTION,,LENGTH
	MOVEM	S1,.JNARG+.NSAFN(R)
	SETZM	.JNARG+.NSACH(R) ;ZERO STATUS AND CHANNEL NUMBER
	MOVEI	S1,CONBLK	;POINT TO CONNECT BLOCK
	MOVEM	S1,.JNARG+.NSAA1(R)
	MOVEI	S1,.JNARG(R)	;POINT TO ARGUMENT BLOCK
	NSP.	S1,		;ATTEMPT A CONNECTION
	  JSP	S2,NSPERR	;ERROR
	LOAD	S1,.JNARG+.NSACH(R),NS.ACH ;GET CHANNEL NUMBER
	MOVEM	S1,.JNIOC(R)	;SAVE
	SCDSET	(.WSWCC,0)	;SET SCHEDULER PARAMETERS
	PUSHJ	P,SETPSR	;SET PSI REASON MASK FOR THIS CHANNEL
	PUSHJ	P,WSCHED##	;WAIT FOR CONNECT CONFIRM

	LOAD	S2,.JNIOS(R),NS.STA ;GET CONNECTION STATE
	CAXN	S2,.NSSRN	;RUNNING?
	JRST	.POPJ1		;YES, SKIP RETURN
	MOVE	S1,[XWD .NSFRL,2] ;FUNCTION,,LENGTH
	MOVE	S1,.JNIOC(R)	;CHANNEL NUMBER
	MOVEI	S1,.JNARG(R)	;POINT AT ARGUMENTS
	NSP.	S1,		;RELEASE THE CHANNEL
	  JFCL			;IGNORE ERROR
	SETZM	.JNIOC(R)	;CHANNEL NUMBER NO LONGER IN USE
	MOVEI	S1,[ITEXT ()]	;NULL ITEXT
	CAXN	S2,.NSSRJ	;REJECTED? (NO DJM)
	MOVEI	S1,[ITEXT (< (Distributed Job Manager not running)>)]
	POPJ	P,		;RETURN
;Open passive connection

DCNOPP:	MOVE	S1,[.NSFEP,,3]	;FUNCTION,,LENGTH
	MOVEM	S1,.JNARG+.NSAFN(R)
	SETZM	.JNARG+.NSACH(R) ;ZERO STATUS AND CHANNEL NUMBER
	MOVEI	S1,CONBLK	;POINT TO CONNECT BLOCK
	MOVEM	S1,.JNARG+.NSAA1(R)
	MOVEI	S1,.NSCDD+1	;LENGTH OF CONNECT BLOCK
	MOVEM	S1,CONBLK+.NSCNL
	SETZM	CONBLK+.NSCND	;NO NODE NAME BLOCK
	SETZM	CONBLK+.NSCSD	;NO SOURCE TASK DESCRIPTOR BLOCK
	MOVEI	S1,DSTBLK	;DESTINATION TASK DESCRIPTOR BLOCK ADDRESS
	MOVEM	S1,CONBLK+.NSCDD
	MOVEI	S1,.NSDPN+1	;LENGTH OF DESTINATION TASK BLOCK
	MOVEM	S1,DSTBLK+.NSDFL
	SETZM	DSTBLK+.NSDFM	;FORMAT TYPE (NO SYMBOL)
	MOVX	S1,.OBDQS	;OBJECT TYPE
	MOVEM	S1,DSTBLK+.NSDOB
	SETZM	DSTBLK+.NSDPP	;NO PPN
	SETZM	DSTBLK+.NSDPN	;NO PROCESS NAME
	MOVEI	S1,.JNARG(R)	;POINT TO ARGUMENT BLOCK
	NSP.	S1,		;LISTEN FOR A CONNECTION
	  JSP	S2,NSPERR	;ERROR
	LOAD	S1,.JNARG+.NSACH(R),NS.ACH ;GET CHANNEL NUMBER
	MOVEM	S1,.JNIOC(R)	;SAVE
	SCDSET	(.WSWRC,0)	;SET SCHEDULER PARAMETERS
	PUSHJ	P,SETPSR	;SET PSI REASON MASK FOR THIS CHANNEL
	PUSHJ	P,WSCHED##	;WAIT FOR REMOTE CONNECT
	JRST	.POPJ1		;RETURN
SUBTTL	DECnet-10 I/O driver -- DCNCLS - Close connection


DCNCLS:	MOVE	S1,[XWD .NSFSD,2] ;FUNCTION,,LENGTH
	MOVEM	S1,.JNARG+.NSAFN(R)
	SKIPN	S1,.JNIOC(R)	;CHANNEL NUMBER
	JRST	.POPJ1		;ALREADY CLOSED, THIS IS A NO-OP
	MOVEM	S1,.JNARG+.NSACH(R)
	MOVEI	S1,.JNARG(R)	;POINT AT ARGUMENTS
	SCDSET	(.WSWDC,0)	;SET SCHEDULER PARAMETERS
	NSP.	S1,		;CLOSE (RELEASE) CONNECTION
	  JSP	S2,NSPERR	;ERROR
	PUSHJ	P,WSCHED##	;WAIT FOR DISCONNECT CONFIRM
	MOVE	S1,[XWD .NSFRL,2] ;FUNCTION,,LENGTH
	MOVEM	S1,.JNARG+.NSAFN(R)
	MOVE	S1,.JNIOC(R)	;CHANNEL NUMBER
	MOVEM	S1,.JNARG+.NSACH(R)
	MOVEI	S1,.JNARG(R)	;POINT AT ARGUMENTS
	NSP.	S1,		;RELEASE THE CHANNEL
	  JFCL			;IGNORE ERROR (PROBABLY DISCONNECT CONFIRM)
	SETZM	.JNIOC(R)	;CHANNEL NUMBER NO LONGER IN USE
	JRST	.POPJ1		;SUCCESS
SUBTTL	DECnet-10 I/O driver -- DCNINP - Input a buffer


DCNINP:	MOVE	S1,[.NSFDR,,4]	;FUNCTION,,LENGTH
	MOVEM	S1,.JNARG+.NSAFN(R)
	MOVE	S1,.JNIOC(R)	;CHANNEL NUMBER
	MOVEM	S1,.JNARG+.NSACH(R)
	MOVX	S1,BFSBYT	;BUFFER SIZE (BYTES)
	MOVEM	S1,.JNARG+.NSAA1(R)
	MOVEI	S1,.JIIBF(R)	;INPUT BUFFER ADDRESS
	HRLI	S1,(POINT 8)	;8-BIT BYTE POINTER
	MOVEM	S1,.JNARG+.NSAA2(R)
	MOVEM	S1,.JIIBP(R)	;STORE VIRGIN POINTER
	MOVEI	S1,.JNARG(R)	;POINT AT ARGUMENTS
	SCDSET	(.WSINP,0)	;SET SCHEDULER PARAMETERS
	NSP.	S1,		;RECEIVE SOME DATA
	  JSP	S2,NSPERR	;ERROR
	MOVX	S1,BFSBYT	;BUFFER SIZE (BYTES)
	SUB	S1,.JNARG+.NSAA1(R) ;SUBTRACT AMOUNT LEFT
	JUMPE	S1,DCNIN1	;WAIT IF NOTHING WAS RECEIVED
	SCDSET	(.WSRUN,0)	;UNDO THE DAMAGE
	MOVEM	S1,.JIIBC(R)	;GIVES AMOUNT WE RECEIVED
	JRST	.POPJ1		;SKIP RETURN

DCNIN1:	PUSHJ	P,WSCHED##	;WAIT FOR INPUT AVAILABLE
	JRST	DCNINP		;CHECK AGAIN
SUBTTL	DECnet-10 I/O driver -- DCNOUT - Output a buffer


DCNOUT:	SCDSET	(.WSOUT,0)	;SET SCHEDULER PARAMETERS
	PUSHJ	P,REDSTS	;READ LINK STATUS
	TXNN	S1,NS.IDR!NS.NDR ;CAN WE SEND MORE DATA?
	JRST	DCNOU1		;NO
	MOVE	S1,[NS.EOM!<.NSFDS,,4>] ;FUNCTION,,LENGTH
	MOVEM	S1,.JNARG+.NSAFN(R)
	MOVE	S1,.JNIOC(R)	;CHANNEL NUMBER
	MOVEM	S1,.JNARG+.NSACH(R)
	MOVX	S1,BFSBYT	;BUFFER SIZE (BYTES)
	SUB	S1,.JIOBC(R)	;SUBTRACT AMOUNT LEFT
	MOVEM	S1,.JNARG+.NSAA1(R) ;GIVES AMOUNT TO SEND
	MOVEI	S1,.JIOBF(R)	;OUTPUT BUFFER ADDRESS
	HRLI	S1,(POINT 8)	;8-BIT BYTE POINTER
	MOVEM	S1,.JNARG+.NSAA2(R)
	MOVEI	S1,.JNARG(R)	;POINT AT ARGUMENTS
	NSP.	S1,		;SEND SOME DATA
	  JSP	S2,NSPERR	;ERROR
	SCDSET	(.WSRUN,0)	;UNDO THE DAMAGE
	AOS	(P)		;SET FOR SKIP RETURN
	PJRST	INIOBF##	;RE-INITIALIZE OUTPUT BUFFER

DCNOU1:	PUSHJ	P,WSCHED##	;WAIT FOR OUTPUT TO COMPLETE
	JRST	DCNOUT		;TRY FOR OUTPUT AGAIN
SUBTTL	DECnet-10 I/O driver -- DCNABO - Abort a link


DCNABO:	MOVE	S1,[XWD .NSFAB,2] ;FUNCTION,,LENGTH
	MOVEM	S1,.JNARG+.NSAFN(R)
	SETZ	S1,		;TO ZERO OUT CHANNEL NUMBER
	EXCH	S1,.JNIOC(R)	;SWAP CHANNEL NUMBER
	JUMPE	S1,.POPJ	;RETURN IF ALREADY CLOSED
	MOVEM	S1,.JNARG+.NSACH(R)
	MOVEI	S1,.JNARG(R)	;POINT AT ARGUMENTS
	MOVEI	S2,DCNAB1	;INCASE OF ERROR
	NSP.	S1,		;ABORT LINK
	  JSP	S2,[PUSHJ P,DCNAB1 ;MAKE SURE THE JOB IS KILLED
		    JRST  NSPERR] ; AND HANDLE THE ERROR
DCNAB1:	MOVX	S1,JB.KIL	;KILL
	IORM	S1,.JBFLG(R)	; JOB
	POPJ	P,		;RETURN
SUBTTL	DECnet-10 I/O driver -- DCNSIA - skip if input data available


DCNSIA:	PUSHJ	P,REDSTS	;GET LINK STATUS
	TXNE	S1,NS.IDA!NS.NDA ;SOME TYPE OF DATA AVAILABLE?
	AOS	(P)		;YES, SET FOR SKIP RETURN
	POPJ	P,		;RETURN
SUBTTL	DECnet-10 I/O driver -- DCNUUE - UUO error translation table


DCNUUE:	UUO	(<DNET.>,DNETL,DNETT)
	UUO	(<NSP.>,NSPL,NSPT)
	EXP	0		;TERMINATE TABLE


DNETT:	DNADE%,,[ASCIZ /Address error/]
	DNWNA%,,[ASCIZ /Wrong number of arguments/]
	DNIDN%,,[ASCIZ /Illegal job number/]
	DNFNE%,,[ASCIZ /Illegal function number/]
	DNILF%,,[ASCIZ /Illegal flag set/]
	DNNSN%,,[ASCIZ /No such node name/]
	DNNSC%,,[ASCIZ /No such channel/]
	DNNDA%,,[ASCIZ /Node is in different area/]
DNETL==.-DNETT


NSPT:	NSABE%,,[ASCIZ /Argument block format error/]
	NSALF%,,[ASCIZ /Allocation failure/]
	NSBCN%,,[ASCIZ /Bad channel number/]
	NSBFT%,,[ASCIZ /Bad format type in process block/]
	NSCFE%,,[ASCIZ /Connect block format error/]
	NSIDL%,,[ASCIZ /Interrupt data too long/]
	NSIFM%,,[ASCIZ /Illegal flow control mode/]
	NSILF%,,[ASCIZ /Illegal function/]
	NSJQX%,,[ASCIZ /Job quota exhausted/]
	NSLQX%,,[ASCIZ /Link quota exhausted/]
	NSNCD%,,[ASCIZ /No connect data to read/]
	NSPIO%,,[ASCIZ /Percentage input out of bounds/]
	NSPRV%,,[ASCIZ /No privileges to perform function/]
	NSSTB%,,[ASCIZ /Segment size too big/]
	NSUKN%,,[ASCIZ /Unknown node name/]
	NSUXS%,,[ASCIZ /Unexpected state: unspecified/]
	NSWNA%,,[ASCIZ /Wrong number of arguments/]
	NSWRS%,,[ASCIZ /Function called in wrong state/]
	NSCBL%,,[ASCIZ /Connect block length error/]
	NSPBL%,,[ASCIZ /Process block length error/]
	NSSBL%,,[ASCIZ /String block length error/]
	NSUDS%,,[ASCIZ /Unexpected state: disconnect sent/]
	NSUDC%,,[ASCIZ /Unexpected state: disconnect confirmed/]
	NSUCF%,,[ASCIZ /Unexpected state: no confidence/]
	NSULK%,,[ASCIZ /Unexpected state: no link/]
	NSUCM%,,[ASCIZ /Unexpected state: no communication/]
	NSUNR%,,[ASCIZ /Unexpected state: no resources/]
	NSRBO%,,[ASCIZ /Rejected by object/]
	NSDBO%,,[ASCIZ /Disconnected by object (when running)/]
	NSRES%,,[ASCIZ /No resources/]
	NSUNN%,,[ASCIZ /Unrecognized node name/]
	NSRNS%,,[ASCIZ /Remote node shut down/]
	NSURO%,,[ASCIZ /Unrecognized object/]
	NSIOF%,,[ASCIZ /Invalid object name format/]
	NSOTB%,,[ASCIZ /Object too busy/]
	NSABM%,,[ASCIZ /Abort by management/]
	NSABO%,,[ASCIZ /Abort by object/]
	NSINF%,,[ASCIZ /Invalid node name format/]
	NSLNS%,,[ASCIZ /Local node shut down/]
	NSACR%,,[ASCIZ /Access control rejection/]
	NSNRO%,,[ASCIZ /No response from object/]
	NSNUR%,,[ASCIZ /Node unreachable/]
	NSNLK%,,[ASCIZ /No link/]
	NSDSC%,,[ASCIZ /Disconnect complete/]
	NSIMG%,,[ASCIZ /Image field too long/]
	NSREJ%,,[ASCIZ /Unspecified reject reason/]
	NSBCF%,,[ASCIZ /Bad combo of NS.EOM & NS.WAI flags/]
	NSADE%,,[ASCIZ /Address error/]
NSPL==.-NSPT
SUBTTL	Subroutines -- Fill in string block


;Routine to fill in a DECnet string block.
;Call:
;	S1/ Address of ITEXT string to fill in string block
;	S2/ Address of destination string block

FILSTB:	MOVEM	S2,STGADR	;SAVE STRING BLOCK ADDRESS
	ADDI	S2,.NSAST	;OFFSET TO STRING AREA
	HRLI	S2,(POINT 8)	;DECNET USES 8-BIT BYTES
	MOVEM	S2,STGPTR	;SAVE THE POINTER
	SETZM	STGCNT		;ZERO THE COUNT
	$TEXT	STGDPB,<^I/0(S1)/^A> ;WRITE OUT THE DATA
	MOVE	S1,STGCNT	;GET BYTE COUNT
	STORE	S1,@STGADR,NS.ASC ;STUFF LENGTH IN BYTES (OF STRING)
	ADDI	S1,3		;ROUND UP TO A NUMBER OF WORDS
	IDIVI	S1,4		;...
	ADDI	S1,.NSAST	;INCLUDE OVERHEAD WORDS
	STORE	S1,@STGADR,NS.ASL ;STUFF LENGTH IN WORDS (OF ENTIRE BLOCK)
	POPJ	P,		;RETURN

STGDPB:	IDPB	S1,STGPTR	;STORE THE BYTE
	AOS	STGCNT		;BUMP THE COUNT
	$RETT			;RETURN
SUBTTL	Subroutines -- Set PSI reason mask


SETPSR:	MOVE	S1,[XWD .NSFPI,3] ;FUNCTION,,LENGTH
	MOVEM	S1,.JNARG+.NSAFN(R)
	MOVE	S1,.JNIOC(R)	;CHANNEL NUMBER
	MOVEM	S1,.JNARG+.NSACH(R)
	HRROI	S1,-1		;ENABLE FOR ANYTHING
	MOVEM	S1,.JNARG+.NSAA1(R)
	MOVEI	S1,.JNARG(R)	;POINT TO ARGUMENT BLOCK
	NSP.	S1,		;SET PSI REASON MASK
	  JSP	S2,NSPERR	;ERROR
	POPJ	P,		;RETURN
SUBTTL	Subroutines -- REDSTS - Read link status


REDSTS:	MOVE	S1,[XWD .NSFRS,2] ;FUNCTION,,LENGTH
	MOVEM	S1,.JNARG+.NSAFN(R)
	MOVE	S1,.JNIOC(R)	;CHANNEL NUMBER
	MOVEM	S1,.JNARG+.NSACH(R)
	MOVEI	S1,.JNARG(R)	;POINT AT ARGUMENTS
	NSP.	S1,		;READ LINK STATE
	  JSP	S2,NSPERR	;ERROR
	MOVE	S1,.JNARG+.NSACH(R) ;GET CHANNEL/STATUS WORD
	POPJ	P,		;RETURN
SUBTTL	Subroutines -- NSPERR - Process NSP. UUO errors


NSPERR:	PUSHJ	P,UUOERR##	;GENERATE ERROR TEXT
	MOVE	S2,.JNARG+.NSAFN(R) ;GET FUNCTION WORD
	$WTO	(<^T/G$NAM/ error>,<^T/.JBIDN(R)/^T/(S1)/^I/NSPETX/>,.JQOBJ(R))
	POPJ	P,		;RETURN

NSPETX:	ITEXT	(<UUO function word: ^O6R0/S2,LHMASK/,,^O6R0/S2,RHMASK/>)
SUBTTL	Subroutines -- DECnet-10 software interrupt


DCNINT:	$BGINT	(1)
	MOVSI	P1,-JOBN	;AOBJN POINTER
	MOVE	S1,DCN+.IOABV	;OUR ABBREVIATION
	MOVE	P2,DCNVEC	;GET VECTOR ADDRESS
	SKIPN	S2,.PSVIS(P2)	;CHANNEL NUMBER
	JRST	DCNIT3		;BOGUS INTERRUPT
	HRRZS	S2		;KEEP ONLY THE CHANNEL NUMBER

DCNIT1:	SKIPE	R,G$ADR##(P1)	;GET STREAM RELOCATION
	CAME	S1,.JNIOV+.IOABV(R) ;MATCH?
	JRST	DCNIT2		;TRY ANOTHER
	CAME	S2,.JNIOC(R)	;I/O CHANNEL MATCH?
	JRST	DCNIT2		;NO
	MOVE	S1,.PSVIS(P2)	;GET INTERRUPT STATUS WORD
	MOVEM	S1,.JNIOS(R)	;SAVE FOR POSTERITY
	MOVE	S2,.JBWSC(R)	;GET STREAM WAIT STATE CODE
	PUSHJ	P,@WSCHK(S2)	;DO SOMETHING
	MOVEM	S2,.JBWSC(R)	;UPDATE WAIT STATE
	JRST	DCNIT3		;DONE

DCNIT2:	AOBJN	P1,DCNIT1	;SEARCH FOR TARGET STREAM

DCNIT3:	$DEBRK			;DISMISS INTERRUPT


DEFINE	X	(NAM,TXT),<IFIW	NAM'CHK>
WSCHK:	WSTATE
;WAITING FOR CONNECT CONFIRM
WCCCHK:	LDB	S1,[POINTR (S1,NS.STA)] ;GET CONNECTION STATE
	CAIE	S1,.NSSCS	;CONNECT SENT?
	PJRST	RUNJOB		;MAKE RUNNABLE
	POPJ	P,		;IGNORE THIS INTERRUPT
				;(WAIT FOR TRANSITION INTO RUN OR FAILURE)

;WAITING FOR REMOTE CONNECT
WRCCHK:	PUSHJ	P,RUNCHK	;CHECK FOR LINK GOING DOWN
	CAIN	S1,.NSSCS	;CONNECT SENT?
	PJRST	RUNJOB		;MAKE RUNNABLE
	POPJ	P,		;RETURN

;WAITING FOR DISCONNECT CONFIRM
WDCCHK:	PUSHJ	P,RUNCHK	;CHECK FOR LINK GOING DOWN
	CAIE	S1,.NSSDR	;DISCONNECT RECEIVED?
	CAIN	S1,.NSSDC	;DISCONNECT CONFIRMED?
	PJRST	RUNJOB		;MAKE RUNNABLE
	CAIE	S1,.NSSCF	;NO CONFIDENCE?
	CAIN	S1,.NSSLK	;NO LINK?
	JRST	RUNJOB		;MAKE RUNNABLE
	CAIE	S1,.NSSCM	;NO COMMUNICATION
	CAIN	S1,.NSSNR	;NO RESOURCES
	JRST	RUNJOB		;MAKE RUNNABLE
	POPJ	P,		;RETURN

;WAITING FOR OUTPUT DONE
OUTCHK:	TXNN	S1,NS.IDR!NS.NDR ;READY FOR MORE DATA?

;WAITING FOR INPUT DONE
INPCHK:	TXNE	S1,NS.IDA!NS.NDA ;DATA AVAILABLE?
	MOVEI	S2,.WSRUN	;MAKE RUNNABLE

;STREAM RUNNING
RUNCHK:	LOAD	S1,S1,NS.STA	;GET CONNECTION STATE
	CAIE	S1,.NSSCF	;NO CONFIDENCE?
	CAIN	S1,.NSSLK	;NO LINK?
	JRST	RUNABO		;DOWN
	CAIE	S1,.NSSCM	;NO COMMUNICATION
	CAIN	S1,.NSSNR	;NO RESOURCES
	JRST	RUNABO		;DOWN
	POPJ	P,		;NO PROBLEMS

;STREAM IDLE
IDLCHK:				;FALL INTO RUNABO

;STREAM PAUSED
PAUCHK:				;FALL INTO RUNABO

RUNABO:	PUSHJ	P,ABORTJ##	;QUEUE UP ABORT
RUNJOB:	MOVEI	S2,.WSRUN	;MAKE RUNNABLE
	POPJ	P,		;RETURN
SUBTTL	Impure storage


DCNVEC:	BLOCK	1		;ADDRESS OF DECNET INTERUPT VECTOR

;Blocks for NSP. UUO functions (shared among all streams)

CONBLK:	BLOCK	.NSCMX		;CONNECT BLOCK

NODBLK:	BLOCK	3		;NODE NAME STRING BLOCK

SRCBLK:	BLOCK	.NSDMX		;SOURCE TASK DESCRIPTOR BLOCK

DSTBLK:	BLOCK	.NSDMX		;DESTINATION TASK DESCRIPTOR BLOCK

STSBLK:	BLOCK	4		;SOURCE TASK NAME STRING BLOCK

DTSBLK:	BLOCK	4		;DESTINATION TASK NAME STRING BLOCK

STGADR:	BLOCK	1		;ADDRESS OF STRING BLOCK FOR FILSTB
STGPTR:	BLOCK	1		;BYTE POINTER TO DEPOSIT BYTES IN STRING BLOCK
STGCNT:	BLOCK	1		;NUMBER OF BYTES DEPOSITED

	END