Google
 

Trailing-Edge - PDP-10 Archives - tops10_703a_sys_ap115_bb-ju01b-bb - d36par.x15
There are 2 other files named d36par.x15 in the archive. Click here to see a list.
	UNIVERSAL D36PAR - Parameters for DECnet-36


;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY  BE  USED
;OR COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT  (C)  DIGITAL  EQUIPMENT  CORPORATION  1976, 1985.
;ALL RIGHTS RESERVED.


	SUBTTL V. Brownell & W. Nichols/Tarl

;D36PAR is the universal parameter file for DECnet-36.

	SALL
	SUBTTL	Table of Contents


;		Table of Contents for D36PAR
;
;
;			   Section			      Page
;   1. Table of Contents. . . . . . . . . . . . . . . . . . .    2
;   2. Historical notes . . . . . . . . . . . . . . . . . . .    3
;   3. Feature Tests. . . . . . . . . . . . . . . . . . . . .    4
;   4. MISC CONSTANTS . . . . . . . . . . . . . . . . . . . .    7
;   5. Definitions
;        5.1.   Operating System Dependent. . . . . . . . . .   10
;   6. Macro Definitions
;        6.1.   Queue Management Macros . . . . . . . . . . .   12
;        6.2.   ASSUME - verify symbol values . . . . . . . .   14
;        6.3.   D36SYM - MACSYM fixups. . . . . . . . . . . .   15
;        6.4.   Network management
;             6.4.1.     Error macro. . . . . . . . . . . . .   16
;             6.4.2.     No data macro. . . . . . . . . . . .   16
;             6.4.3.     Success macro. . . . . . . . . . . .   16
;             6.4.4.     Parameters . . . . . . . . . . . . .   17
;             6.4.5.     Counters . . . . . . . . . . . . . .   18
;   7. Structure Definitions
;        7.1.   Queue Header. . . . . . . . . . . . . . . . .   19
;        7.2.   DECnet-36 Initialization Block. . . . . . . .   20
;        7.3.   DECnet-36 Message Descriptor. . . . . . . . .   21
;        7.4.   DECnet-36 Message Block . . . . . . . . . . .   22
;        7.5.   Session Control Link Block. . . . . . . . . .   26
;        7.6.   Session Control Job Block . . . . . . . . . .   27
;        7.7.   NSP Sublink Block . . . . . . . . . . . . . .   28
;        7.8.   NSP LINK Block. . . . . . . . . . . . . . . .   29
;        7.9.   Router Adjacency Block. . . . . . . . . . . .   30
;        7.10.  Router Circuit Block. . . . . . . . . . . . .   31
;        7.11.  DNADLL data link block. . . . . . . . . . . .   33
;   8. Value Definitions
;        8.1.   NSP Port States . . . . . . . . . . . . . . .   36
;        8.2.   DECnet Standard Parameters. . . . . . . . . .   37
;        8.3.   DECnet-wide states. . . . . . . . . . . . . .   38
;   9. Inter-Layer Parameters
;        9.1.   Overall Argument Conventions. . . . . . . . .   39
;        9.2.   Session Control Function Codes. . . . . . . .   40
;        9.3.   NSP Function Codes. . . . . . . . . . . . . .   41
;        9.4.   Session Control/NSP . . . . . . . . . . . . .   42
;        9.5.   NSP/Router. . . . . . . . . . . . . . . . . .   44
;        9.6.   Router/DLL. . . . . . . . . . . . . . . . . .   45
;        9.7.   Layer/NMX (Event logger). . . . . . . . . . .   46
;  10. Network Management
;       10.1.   Argument blocks . . . . . . . . . . . . . . .   47
;       10.2.   NSP and ROUTING VERSION Number Formats. . . .   49
;       10.3.   Values used by NMX. . . . . . . . . . . . . .   50
;       10.4.   NMX Function Block Definition . . . . . . . .   52
;       10.5.   Event Parameters and Argument blocks. . . . .   53
;  11. Test Bed Stuff . . . . . . . . . . . . . . . . . . . .   54
;  12. End of D36PAR. . . . . . . . . . . . . . . . . . . . .   56
	SUBTTL	Historical notes

COMMENT	|

	The DECnet modules were originally written and tested on a
	user-mode test-bed on TOPS10. The modules at that time were
	named according to current architecture names, and TOPS10
	naming conventions. After getting the DECnet code running in
	the TOPS10 monitor, the DECnet modules were integrated into
	TOPS20 (for Release 6.1). The naming conventions used earlier
	were no longer valid because the architecture group renamed
	several of the DECnet layers. To resolve these problems, the
	DECnet modules were renamed to names which avoided the names
	the architecture group didn't want us using any more. The
	result of all this is that several modules have comments and
	labels which do not correspond with the current module name,
	so we supply a mapping table between old names and new names
	to attempt to relieve the confusion:

	Old name(layer)		New name	New layer name

	D36UNV(Universal)	D36PAR		(Universal file)
	D36COM(Common subrs)	D36COM		(Common subroutines)
	NSPSER(Network service)	LLINKS		End Communication Layer
	XPTSER(Transport)	ROUTER		Routing Layer
	SCTPRM(Session Control)	SCPAR		Session control parameters
	SCTCON(Session Control)	SCLINK		Session Control Layer
	SCTUUO(Session Control)	SCMUUO		Session control uuos
	NMXCON(Network Mngmnt.)	NTMAN		Network Management Layer

	In addition, on the -20, we needed an entirely new module for
	the UUO/JSYS level code which was entirely different between
	the -10 and the -20. This module was given the name SCJSYS,
	and is morally equivalent to SCMUUO.

	| ;End of Comment
	SUBTTL	Feature Tests

;Here are the feature tests for DECnet-36.

	FTOPS10==:1		;ASSEMBLE FOR TOPS10
	FTOPS20==:0		;ASSEMBLE FOR TOPS20
	FTPH4==:0		;ASSEMBLE PHASE IV CODE
IFN FTOPS10,<
	FTTRACE==:0		;NON-ZERO TO ENABLE TRACES
	FTMINTRACE==:0		;MINI TRACE (SUBSET OF ABOVE)
	FTDEBUG==:1		;ASSEMBLE WITH DEBUGGING STUFF
	FTPARANOID==:1		;DO EXTRA CAREFUL CHECKING
	FTCORBUG==:0		;FTPARANOID FOR CORE MANGLER. [EXPENSIVE!]
	FTLSTCOR==:1		;NOTE - TO TURN ON FTLSTCOR, SET TO POSITIVE 1.
                                ; LSTCOR TRIES TO TRACE LOST CORE
	FTRTST==:0		;EXCLUDE ROUTER TEST MESSAGE DEFINITIONS
	FTFIXCOR==:0		;FREE BLOCKS ARE NOT PAGE ALIGNED
	FTHMMEM==:0		;DON'T INCLUDE MEMORY REQUEST MAPPER (D36COM)
	FTP4R==:1		;INCLUDE PHASE 4 ROUTER
	FTD36MM==:0		;DON'T INCLUDE "A" BLOCK MEMORY ALLOCATION

;We search NETPRM here to check that parallel definitions are
;properly defined

	SEARCH F,S,NETPRM

.CPYRT<1981,1984>,.

	D36SYM
>;End of IFN FTOPS10


IFN FTOPS20,<
	IFN FTOPS10,<IF2, <PRINTX ?Operating system feature tests screwed up>>

	SEARCH PROLOG,MONSYM

	FTMP==:0		;MULTI-PROCESSOR OFF IN TOPS-20
	FTXMON==:1		;KL PAGING
	FTKS10==:SMFLG		;KS FLAG
	FTKL10==:KLFLG		;KL FLAG
	FTNRT==:0		;NO NRT ON TOPS20
>;End of IFN FTOPS20

	SEARCH	MACSYM

	IFN FTP4R,FTPHA2==:0	;IF NI DLL, DON'T DO PHASE II NODES
	IFE FTP4R,FTPHA2==:1	;ELSE MIGHT AS WELL

;These are the DECnet-36 TOPS-20 AC definitions.

IFN FTOPS20,<
	DEFINE XP(SYM,VAL),<SYM==:VAL> ;DEFINE SYMBOL GLOBAL SUPRESSED TO DDT
	DEFINE XPP(SYM,VAL),<SYM=:VAL> ;DEFINE SYMBOL GLOBAL NOT SUPRESSED

	FREE0==0		;FREE FOR REDEFINITION
				; FREE0 ONLY APPLIES TO AC 0
	XPP T1,1		;TEMPORARIES
	XPP T2,2		; ..
	XPP T3,3		; ..
	XPP T4,4		; ..
	T5==5			;T5 AND T6 USED MAINLY
	T6==6			; FOR EXTENDED INSTRUCTIONS

	MB==7		 	;MESSAGE BLOCK POINTER

	P1==10			;PRESERVED ACS
	P2==11			; ..

	MS==12			;POINTER TO CURRENT MSD FOR DNxyBY
				;ALSO SEE D36SYM CONCERNING THESE REDEFS
	FREE1==13		;FIRST FREE
	FREE2==14		;FREE1,2,ETC CAN BE ANY NON-ZERO AC
	FREE3==15		; THAT IS NOT OTHERWISE DEFINED HERE

	XPP CX,16		;SCRATCH AC

	XPP P,17		;THE STACK POINTER

>
	OPDEF	TRASH	[HRROI 474747] ;SIMPLE PROCEDURE TO LEAVE JUNK IN AN AC

IFN FTOPS10,<
	OPDEF  CALLRET [JRST]	; to be defined with CALL and RET
	.NODDT CALLRET

;LOCAL CALL ERROR RETURN

DEFINE RETBAD (ERN,EXTRA)<
	IFNB <ERN'EXTRA>,<
	JRST [	EXTRA
	   IFNB <ERN>,<MOVEI T1,ERN>
		RET]>
	IFB <ERN'EXTRA>,<
	RET>>

;HARDWARE INTERLOCK DEFINITIONS

OPDEF	D36OFF [JSP CX,D36PIF##]
OPDEF	D36ON  [JSP CX,D36PIN##]

;MACROS TO CHANGE SECTION (WILL CALL COROUTINES, TO ENSURE RETURNING TO
;	PROPER SECTION WHEN CURRENT ROUTINE POPJ'S)
;

DEFINE	SEC0,<
IFN FTXMON,<PUSHJ P,SSEC0##>
>

DEFINE	SEC1,<
	SE1ENT
>

DEFINE S0CALL(ROUTINE),<
IFN FTXMON,<
	CALL [	SEC0		;;ROUTINE WANTS TO BE IN SECTION 0
		CALLRET ROUTINE] ;;ROUTINE IN SEC 0, HE WILL POPJ TO SEC N
	>; END IFN FTXMON
IFE FTXMON,<CALL ROUTINE>	;;JUST CALL IT (NO SECTION PROBLEMS)
>; END DEFINE S0CALL

DEFINE DNSNUP(LABEL,%A),<
LABEL::	TRN			;****LABEL FOR DNSNUP
>;END DEFINE DNSNUP

MSEC0==(MCSEC0)			;SECTION 0 MONITOR CODE
MSEC1==(MCSEC1)			;SECTION 1 MONITOR CODE
	SUBTTL MISC CONSTANTS

;MISC CONSTANTS

.INFIN==:377777,,777777		;PLUS INFINITY
.MINFI==:1B0			;MINUS INFINITY
.LHALF==:777777B17		;LEFT HALF
.RHALF==:777777			;RIGHT HALF
.FWORD==:-1			;FULL WORD

>;END OF IFN FTOPS10


IFN FTOPS20,<
	DEFINE D36OFF <PIOFF>
	DEFINE D36ON <PION>

   Repeat 0,< ;Old defs
	DEFINE D36OFF <
	   CONSO PI,77000	    ;;CHECK TO SEE IF AT PI LEVEL
	   NOSKED		    ;;NO, KEEP SCHEDULER OUT TOO
	   CHNOFF DLSCHN
	>
	DEFINE D36ON <
	   CHNON DLSCHN
	   CONSO PI,77000	    ;;CHECK TO SEE IF AT PI LEVEL
	   OKSKED		    ;;NO, MATCH D36OFF'S NOSKED
	>
   >
	DEFINE SYSPIF <		    ;System PIOFF
	   PIOFF
	>
	DEFINE SYSPIN <		    ;System PION
	   PION
	>
	DEFINE SEC0 <S0.ENT>
	DEFINE SEC1 <EA.ENT>
>;END IFN FTOPS20

;Define a mask to strip off area and node from the Phase IV message

	XP RN%ARE,MASK.(^D6,^D25)  ;MASK TO GET AREA
	XP RN%NOD,MASK.(^D10,^D35) ;MASK TO GET NODE


IFN FTOPS10,<

;The following definition of USRSAV is the default.  Redefine it if
;you want.  The calls to SPCSAV have two arguments: the routine name
;and a list of ACs saved by that routine.  The IFDEFs are not needed
;if you are sure the ACs will be defined.

DEFINE USRSAV,<
  IFDEF .FPAC,<
	SPCSAV(.SAV1,.FPAC)
	SPCSAV(.SAV2,<.FPAC,.FPAC+1>)
	SPCSAV(.SAV3,<.FPAC,.FPAC+1,.FPAC+2>)
	SPCSAV(.SAV4,<.FPAC,.FPAC+1,.FPAC+2,.FPAC+3>)
  >
>

EXT <.SAV1,.SAV2,.SAV3,.SAV4>
;THE FOLLOWING MACRO MAY BE USED TO SUPPRESS CREF ENTRIES FOR
;ALL THE JUNK SYMBOLS USED INTERNALLY WITHIN MACROS IN MACSYM

DEFINE .XCMSY <
	.XCREF
	.XCRF1 <..ACT,..CSC,..CSN,..IFT,..JX1,..MSK,..MX1,..MX2>
	.XCRF1 <..NAC,..NRGS,..NS,..NV,..PST,..STKN,..STKQ,..STKR>
	.XCRF1 <..TRR,..TSA1,..TX1,..TX2,..TXAC,.FP,.FPAC,.NAC,.SAC,.SAV1>
	.XCRF1 <.SAV2,.SAV3,POINTR,POS,..LDE,..FLG,WID,..CAS1,..CNS,..CNS2>
	.XCRF1 <..DPB,..GNCS,..ICNS,..JE,..JN,..LDB,..STR0,..STR1,..STR2>
	.XCRF1 <..STR4,..TMO,..TMZ,..TSAC,..TSIZ,..TX,..TY,.ACV1,.ACV2>
	.XCRF1 <..TX1,..TX2,..TXAC,..TX3,..TYNE,..TYNN>
	.XCRF1 <.ACV3,.CASE,.DECR0,.IF0,.INCR0,.OPST1,.OPST2,.STKV1>
	.XCRF1 <.STKV2,.STKV3,.TRV1,.TRV2,.TRV3>
	.XCRF1 <..OLD,...OLD,..BITS,..OFF,..LOC,.LDBE,..LDBE>
	.XCRF1 <..RELO>
	.CREF
   >
DEFINE .XCRF1 (SYMS)<
	IRP SYMS,<
	 IFDEF SYMS,< .XCREF SYMS>>>

>;END OF IFN FTOPS10
	SUBTTL	Definitions -- Operating System Dependent

;The following are some definitions that must be redefined depending upon
;the operating system being used.

;These are the TOPS-20 specific definitions

IFN FTOPS20,<

; $RELOC is kept for compatibility only

DEFINE	$RELOC <
	IF1,<PRINTX %Warning: $RELOC is being phased out>
	>

DEFINE	$HIGH <
	IF1,<PRINTX %Warning: $HIGH is being phased out>
	RESCD
	>

DEFINE	$LOW <
	IF1,<PRINTX %Warning: $LOW is being phased out>
	RESDT
	>

;For code generation, one of the TOPS-20 macros RESCD, RESCD(INIT),
; RESCD(SEC0) or SWAPCD should be used.

;For data declarations, one of the following macros should be used
;
; RESDT		Move to initialized data psect
; RESVR		Move to zeroed data psect
; SWAPVR	Move to swappable zeroed data psect

;Resident or non-resident variables in extended sections must be
; defined in STG; the macros live only within STG

DEFINE	RESVR <
	.ENDPS
	.PSECT RSVAR
	>

DEFINE	SWAPVR <
	.ENDPS
	.PSECT NRVAR
	>

>

IFN FTOPS10,<

;The TOPS-20 code and data generation macros are turned into $HIGH or $LOW
; on the 10.

DEFINE RESCD <$HIGH>
DEFINE SWAPCD <$HIGH>
DEFINE RESDT <$LOW>
DEFINE RESVR <$LOW>
DEFINE SWAPVR <$LOW>

;THE FOLLOWING OPCODES ARE USED TO REFERENCE DATA IN THE 'PREVIOUS
;CONTEXT'.  THE PREVIOUS CONTEXT IS THE USER ADDRESS SPACE IF
;THE JSYS CALL WAS EXECUTED BY A USER PROGRAM, OR THE
;MONITOR ADDRESS SPACE IF IT WAS EXECUTED BY THE MONITOR.
;WHEN WRITING JSYS CODE HOWEVER, IT IS CONVENIENT TO THINK OF THE
;CURRENT CONTEXT AS 'MONITOR' AND THE PREVIOUS CONTEXT AS
;'USER'.  THESE TERMS SHOULD BE UNDERSTOOD IN THIS WAY IN THE
;FOLLOWING DISCUSSION AND IN THE OPDEF'S.

;XCTU IS THE GENERAL CASE AND IS USED FOR ALL ORDINARY (ONE-ADDRESS)
;INSTRUCTIONS.  IF USED FOR BLT, IT WILL CAUSE BOTH SOURCE AND
;DESTINATION TO BE USER.

;XCTUU ARE USED TO BOTH COMPUTE EFFECTIVE ADDRS IN USER AND FETCH
;FROM USER, I.E. - XCTUU [MOVE T1,@T1]

;XBLTMU AND XBLTUM ARE USED WITH BLT TO DO MONITOR-TO-USER
;AND USER-TO-MONITOR BLT'S RESPECTIVELY.  XBLTUU IS ALSO DEFINED
;FOR CONSISTENCY FOR USER-TO-USER BLT.

;XCTBU IS USED WITH BYTE INSTRUCTIONS WHERE POINTER IS IN MONITOR,
;DATA IN USER.  XCTBUU IS BYTE INSTRUCTION WITH POINTER AND DATA
;IN USER (KI10 DOES NOT SUPPORT).

;XPSHUM AND XPOPMU ARE THE ONLY CASES OF PUSH AND POP CURRENTLY USED.
;XPSHUM MEANS PUSH USER-TO-MONITOR, XPOPMU MEANS POP MONITOR-TO-USER, ETC.
;ADDITIONAL SUCH MNEMONICS WILL BE DEFINED IF NEEDED.

OPDEF	XCTU	[XCT 4,0]	;DATA ONLY IS IN PREVIOUS CONTEXT
OPDEF	XCTUU	[XCT 14,0]	;"E" AND DATA FROM PREV. CONTEXT (INCLUDES AC LOOK-UP)


OPDEF	XBLTMU	[XCT 4,0]	;DATA FROM PREVIOUS CONTEXT
OPDEF	XBLTUM	[XCT 1,0]	;DATA TO PREVIOUS CONTEXT
OPDEF	XBLTUU	[XCT 5,0]	;DATA FROM AND TO PREVIOUS CONTEXT
OPDEF	XCTBU	[XCT 3,0]	;EXTENDED BLT - DATA FROM PREVIOUS CONTEXT
OPDEF	XCTBMU	[XCT 1,0]	;BLT - DATA TO PREVIOUS CONTEXT
OPDEF	XCTBUU	[XCT 7,0]	;POINTER,POINTER E AND DATA FROM PREVIOUS CONTEXT

OPDEF	XPSHUM	[XCT 4,0]	;STACK IN PREVIOUS CONTEXT
OPDEF	XPOPMU	[XCT 4,0]	;STACK IN PREVIOUS CONTEXT

.NODDT XCTU,XCTUU,XBLTMU,XBLTUM,XBLTUU,XCTBU,XCTBMU,XCTBUU,XPSHUM,XPOPMU

>;END IFN FTOPS10

	SUBTTL Macro Definitions -- Queue Management Macros

;These macros depend on the data structures QH and QP in NSPUNV.

;Put the block pointed to by BLKPTR at the end of HEADER's queue
;The arguments:	blkptr:	ac that points to block to be queued
;		header: pointer to QH data structure
;		offset: offset into block of forward pointer for this q
;		ac:	a temp ac other than CX, don't count on value


DEFINE ENDQUE(blkptr,header,offset,tempac),<
	OPSTR <SKIPN tempac,>,QHEND,+header
	STOR blkptr,QHBEG,+header
	SKIPE tempac
	STOR blkptr,QPNXT,+offset(tempac)
	STOR blkptr,QHEND,+header
	SETZRO QPNXT,+offset(blkptr)
	INCRQH(header,tempac)
>;END OF DEFINE ENDQUE



;INCRQH is used in LLINKS by the QSRTMB routine as well as by ENDQUE

DEFINE INCRQH(header,tempac),<

IF1,<IFN <QHCNT!QHMAX>+1 + <QHMAX!777777>+1 + QH.CNT - QH.MAX,<
	PRINTX ?BEGSTR QH is defined wrong for INCRQH(header)
>>
	AOS tempac,QH.CNT+header	;;ONE MORE ENTRY ON Q
	HLRZ CX,tempac			;;ISOLATE OLD MAX
	CAIGE CX,(tempac)		;;GOT A NEW MAX?
	HRLM tempac,QH.MAX+header	;;YES, STORE IT
>;END OF DEFINE INCRQH


;DECRQH is separated for symmetry with INCRQH

DEFINE DECRQH(header),<
	DECR QHCNT,+header
>;END OF DEFINE DECRQH
;These macros depend on the data structures QH and QP in NSPUNV.

;Take the first element off a queue and put pointer in designated AC
;The arguments:	ac:	Return pointer to dequeued block here
;		header: pointer to QH data structure
;		offset: offset into block of forward pointer for this q
;		empty:	JRST EMPTY if queue is empty
;		%label:	default this one, of course


DEFINE DEQUE(ac,header,offset,empty),<
	OPSTR <SKIPN ac,>,QHBEG,+header
	JRST empty
	OPSTR <SKIPN CX,>,QPNXT,+offset(ac)
	STOR CX,QHEND,+header
	STOR CX,QHBEG,+header
	DECRQH header
>
;Remove the block pointed to by BLKPTR from HEADER's queue
;The arguments:	blkptr:	ac that points to block to be queued
;		header: pointer to QH data structure
;		offset: offset into block of forward pointer for this q
;		ac:	a temp ac other than CX, don't count on value


DEFINE RMVQUE(blkptr,header,offset,tempac,%lab1,%lab2,%lab3),<
				;;POINT TO HEAD-OF-QUEUE PTR
IFN QPNXT+1,<PRINTX QPNXT muxt be a full word for RMVQUE>
IFN QHBEG+1,<PRINTX QHBEG muxt be a full word for RMVQUE>
IFN QHEND+1,<PRINTX QHEND muxt be a full word for RMVQUE>
	XMOVEI tempac,QH.BEG-QP.NXT-offset+header
%lab1:!
	OPSTR <CAMN blkptr,>,QPNXT,+offset(tempac)
	JRST %lab2		;;FOUND IT, NOW REMOVE IT
	LOAD tempac,QPNXT,+offset(tempac) ;;GET NEXT POINTER
	JUMPE tempac,%lab3	;;NO MORE, CAN'T REMOVE IF NOT THERE
	JRST %lab1		;;NOW TRY THIS ONE
%lab2:!
	SKIPN CX,QP.NXT+offset(blkptr)	;;GET NEXT POINTER
	STOR tempac,QHEND,+header     	;;IF ITS ZERO, UPDATE END PTR
	STOR CX,QPNXT,+offset(tempac) 	;;STORE IT IN PREVIOUS BLOCK
	SKIPN tempac,QH.BEG+header    	;;IF LIST IS NOW EMPTY
	STOR tempac,QHEND,+header     	;; THEN ZERO END PTR TOO FOR ENDQUE
	DECRQH header		;;DECREMENT THE Q COUNTER
%lab3:!
>;END OF RMVQUE MACRO

	SUBTTL	Macro Definitions -- ASSUME - verify symbol values

;Assume macro verifies a relation between two values
	DEFINE ASSUME(A,B,C) <
	IFIDN <B><EQ>,<IFN <A> - <C>,<IF1 <PRINTX ?ASSUME failed: 'A 'B 'C>>>
	IFIDN <B><NE>,<IFE <A> - <C>,<IF1 <PRINTX ?ASSUME failed: 'A 'B 'C>>>
	IFIDN <B><GT>,<IFLE <A> - <C>,<IF1 <PRINTX ?ASSUME failed: 'A 'B 'C>>>
	IFIDN <B><LT>,<IFGE <A> - <C>,<IF1 <PRINTX ?ASSUME failed: 'A 'B 'C>>>
	>

	SUBTTL	Macro Definitions -- D36SYM - MACSYM fixups

;D36SYM should be called by DECnet-36 modules which call TOPS-20's
;MACSYM universal after SEARCHing MACSYM and D36PAR.  It redefines
;those variables, macros and OPDEFs from MACSYM which do not fit into
;the DECnet-36 environment as defined in MACSYM.

IFE FTOPS10,<DEFINE D36SYM,<PURGE P3,P4>>

	SUBTTL	Macro Definitions -- Network management -- Error macro

;Define error macro that works like RETBAD, except that it understands
; negative error codes

DEFINE RNMXER (ERN,EXTRA)<
	IFNB <ERN'EXTRA>,<
	JRST [	EXTRA
	   IFNB <ERN>,<MOVX T1,ERN>
		RET]>
	IFB <ERN'EXTRA>,<
	RET>>

	SUBTTL	Macro Definitions -- Network management -- No data macro

;Define macro that returns a 'no data present' code

DEFINE RNMXND <
	JRST [	MOVX T1,NF.NDP
		RET]
>

	SUBTTL	Macro Definitions -- Network management -- Success macro

;Define success macro that does a return with success code loaded into T1

DEFINE RNMXOK <
	JRST [	MOVX T1,NF.FCS
		RET]
>

	SUBTTL	Macro Definitions -- Network management -- Parameters

;The PA structure is used to keep the information for a DECnet network
;management parameter.  It is pointed to by a table, generated with the
;PARAMETER macro.  This structure is read by the routine NTPARM in D36COM.

	BEGSTR PA
		FIELD FLA,5	;Flag field
	  	  BIT NST	;Cannot set this parameter
		  BIT NCL	;Cannot clear this parameter
		  BIT NRD	;Cannot read this parameter (Write only memory)
		  BIT BEX	;Buffer from NTMAN expected
		  BIT DRC	;Don't range check "set" value
		FILLER 13
		HWORD PNR	;Parameter #
		WORD DEF	;Default value for parameter
		WORD MAX	;Maximum value that can be set
		WORD MIN	;Minimum value that be set
		WORD SET	;Instruction to execute to set the parameter
		WORD RED	;Instruction to execute to read the parameter
		WORD CLR	;Instruction to execute to clear the parameter
	ENDSTR

;The PARAMETER macro generates one entry in the parameter table
;Make sure that the assumtions are valid
	ASSUME PAPNR,EQ,<0,,-1>
	ASSUME PA.PNR,EQ,0
	ASSUME PA.NST,EQ,0
	ASSUME PA.NCL,EQ,0
	ASSUME PA.NRD,EQ,0
	ASSUME PADEF,EQ,-1
	ASSUME PA.DEF,EQ,1
	ASSUME PA.MAX,EQ,2
	ASSUME PA.MIN,EQ,3
	ASSUME PA.SET,EQ,4
	ASSUME PA.RED,EQ,5
	ASSUME PA.CLR,EQ,6
;Define PARAMETER macro
DEFINE PARAMETER (NR,XFLAG,XMAX,XMIN,XDEF,XSET,XREAD,XCLEAR,COMNT) <
   IFB <XFLAG>,<FLAG==0>
   IFNB <XFLAG>,<FLAG==XFLAG>
   IFB <XMAX>,<MAX==^D65535>
   IFNB <XMAX>,<MAX==XMAX>
   IFB <XMIN>,<MIN==0>
   IFNB <XMIN>,<MIN==XMIN>
   IFB <XDEF>,<DEF==0,,-1>
   IFNB <XDEF>,<DEF==XDEF>
   IFE <<CURPSX-PXRESCD>*<CURPSX-PXSWAPCD>>,<
	XCDSEC,,[FLAG!NR>
   IFN <<CURPSX-PXRESCD>*<CURPSX-PXSWAPCD>>,<
	 MSEC1,,[FLAG!NR>
		DEF
		MAX
		MIN
  IFNB <XSET>, <XSET>
   IFB <XSET>, <TRN>
 IFNB <XREAD>, <XREAD>
  IFB <XREAD>, <TRN>
 IFNB <XCLEAR>,<XCLEAR>
 IFB <XCLEAR>, <TRN> ]
>

	SUBTTL	Macro Definitions -- Network management -- Counters

;The CT structure is used to keep the information for a DECnet network
;management counter.  It is pointed to by a table, generated with the
;COUNTER macro.  This structure is read by the routine NTCTRS in D36COM.

	BEGSTR CT
		FIELD BMF,1	;Bit map flag
		FIELD HDR,35	;Counter width, number
		WORD RED	;Instruction to execute to read the counter
		WORD CLR	;Instruction to execute to clear the counter
		WORD BMP	;Instruction to execute to get the bit map
	ENDSTR

;The COUNTER macro generates one entry in the counter table
;First make sure that the COUNTER macros assumptions are valid
	ASSUME CTRED,EQ,-1
	ASSUME CT.RED,EQ,1
	ASSUME CTCLR,EQ,-1
	ASSUME CT.CLR,EQ,2

;Now define COUNTER macro
DEFINE COUNTER(NR,WIDTH,ACCESS,CLEAR,BMACC,COMMENT) <

  IFNB <BMACC>,<FLAG==<CTBMF_-^D18>>
   IFB <BMACC>,<FLAG==0>

   IFE <<CURPSX-PXRESCD>*<CURPSX-PXSWAPCD>>,<
	XCDSEC,,[XWD FLAG!WIDTH,NR>
   IFN <<CURPSX-PXRESCD>*<CURPSX-PXSWAPCD>>,<
	MSEC1,,[XWD FLAG!WIDTH,NR>
		ACCESS
 IFNB <CLEAR>, <CLEAR>
 IFB <CLEAR>,  <TRN>
 IFNB <BMACC>, <BMACC> ]
>

	SUBTTL	Structure Definitions -- Queue Header

;See macros ENDQUE, DEQUE and RMVQUE for examples of QH uses.
;LLINKS also uses these definitions in its QSRTMB routine

;When a queue is emptied, DEQUE assures that the QHBEG pointer, the
;QHEND pointer and the QHCNT count will be zero.

BEGSTR QH
	WORD BEG		;THESE MAY BE MADE LESS THAN FULL WORDS
	WORD END		; IF NEED BE AND FULL-WORD ADDRESSING
				; IS NOT REQUIRED.
	HWORD MAX		;MAX LENGTH QUEUE EVER GOT
	HWORD CNT		;CURRENT LENGTH OF QUEUE
ENDSTR


;Structure QP, queue pointer, is included to emphasize the fact that
;ENDQUE and DEQUE expect the forward pointer in a block to be a full
;word, and to simplify the addition of backward pointers should that
;become desirable.

;Note that the message block does not use QP, since it is in the
;universal file, not in LLINKS.  There is a comment in the definition
;of the message block pointing out that the forward pointer must be a
;full word for LLINKS.

BEGSTR QP
	WORD NXT		;POINTER TO NEXT BLOCK ON QUEUE
ENDSTR

;Byte pointer and count structure. Routines DNGUBY, DNPUBY, and
;all related DNGUnB require a pointer to this type of structure.
;All byte pointers are section local (for the moment)

BEGSTR BP
	WORD BPT		;BYTE POINTER TO USER STRING
	WORD BYT		;BYTE COUNT LEFT
ENDSTR

;DNGUBY will return an error of NEPAM% if the count BPPYT runs out,
;DNPUBY will return an error of NEPVL% if the count runs out,
;and both will return NEADC% if they get an addressing error of
;any kind.

	SUBTTL	Structure Definitions -- DECnet-36 Initialization Block

;The initialization block is the argument to all DECnet-36 initialization
; routines.  It is set with NODE% jsys functions, and read by the various
; DECnet layers during and after initialization.

	BEGSTR IB
		FIELD PH2,1	;Set if Phase II desired
		FILLER 1
		FIELD RTR,4	;Routing type: one of
				; RNT.L1 Level-1 router
				; RNT.NR Endnode
		FIELD FCM,2	;Default flow control
		WORD NAM	;Executor node name (in sixbit)
		WORD ADR	;Executor node address (16-bit address)
		WORD MXA	;Maximum address
		WORD MXB	;Maximum buffers
		WORD DGL	;Default goal
		WORD DBL	;Default # of buffers per link
		WORD BIP	;Buffer input percentage
		WORD BSZ	;Buffer size
	ENDSTR

;Router type from field IBRTR

	XP RNT.L2,3		;LEVEL 2 ROUTER
	XP RNT.L1,4		;LEVEL 1 ROUTER
	XP RNT.NR,5		;NON-ROUTING
	SUBTTL	Structure Definitions -- DECnet-36 Message Descriptor

;This is the DECnet-36 Message Segment Descrpitor.  Every Segment of
;the message is described by this small block.  In the typical case,
;this descriptor resides in the owner's (the owner being a level of
;DECnet) portion of the Message Block.
;
;NSP's message trace facility (TRCMSG) makes illicit use of the MSD
;fields and of the nature of the position value returned by DNRPOS.
;The trace program DNTATL also knows about the structure of the MSD.
;
;Note that DTESER and D8KINT 'know' that all the fields in the MSD
;are full-words.

BEGSTR MD		;Input Meaning,      ;Output Meaning
	WORD NXT,QP.LEN	;MUST BE ZERO        ;PTR TO NEXT MSD
	WORD PTR	;ILDB PTR INTO MSG   ;IDPB PTR INTO MSG
	WORD AUX	;NOT USED            ;ILDB PTR TO BEG OF MSG
	WORD BYT	;BYTES LEFT TO READ  ;BYTES WRITTEN SO FAR
	FIELD VMC,3	;VIRTUAL MAP CONTEXT
		VMC.XC==:0	;EXEC Context (Map through EPT)
		VMC.US==:1	;USER Context (Map through UPT)
		VMC.NO==:2	;DO NOT Map (Physical Address)
	HWORD ALL	;ALLOCATED LENGTH IN BYTES
	WORD ALA	;ALLOCATED ADDRESS OF SEGMENT'S DATA
ENDSTR
	SUBTTL	Structure Definitions -- DECnet-36 Message Block

;The following is the definition of the DECnet-36 Message Block.  This is
;the fundamental data structure used to represent an individual message.
;The Message Block is divided up into a public section and several private
;sections which belong to each of the layers of the DECnet architecture.

;The Public Section

BEGSTR MB
	WORD NXT		;PTR TO NEXT MESSAGE.  MUST BE FULL
				; WORD FOR NSP, SEE BEGSTR QP IN LLINKS.MAC
	WORD FMS		;POINTER TO FIRST MSD (DLLs
				; EXPECT THIS FIELD TO BE RIGHT HERE)
	WORD MSN		;DDCMP MESSAGE NUMBER (DLLs
				; EXPECT THIS FIELD TO BE RIGHT HERE)
	HWORD DST		;DESTINATION NODE
	HWORD SRC		;SOURCE NODE
	WORD DS1		; FIRST 32 BITS OF DESTINATION
	WORD SR1		; FIRST 32 BITS OF SOURCE
	FIELD FLG,9		;FLAGS
	  BIT OTH		;ON THE "OTHER" SUBLINK
	  BIT BOM		;BEGINNING OF MESSAGE
	  BIT EOM		;END OF MESSAGE
	  BIT EBF		;MESSAGE BLOCK HAS BEEN ALLOCATED FROM
				; EMERGENCY BUFFER FREE LIST
	  BIT PH2		;PHASE II MESSAGE
	  BIT DON		;"SYNCHRONOUS" INTERLOCK DONE BIT (NSP & SC)
	  BIT LCL		;BOUND FOR THE LOCAL NSP
	  BIT UNR		;UNREACHABLE

	FIELD VST,9		;VISITS COUNT
	HWORD ABS		;Adjacency's block size
	WORD CHN		;LOOPBACK CHANNEL (CIRCUIT ID)
	WORD PRC		;PROCEDURE PROCESSOR (NSP & SC)
	WORD AR1		;ARGUMENT STORAGE #1 (NSP & SC)
	WORD AR2		;ARGUMENT STORAGE #2 (NSP & SC)
	WORD AR3		;ARGUMENT STORAGE #3 (NSP & SC)
ENDSTR
;Router's Section

	RMH.LN==^D 21		;BYTES FOR RTR HEADER

BEGSTR RM,MB.LST
	WORD OCP		;OUTPUT CIRCUIT BLK PTR
	WORD ICP		;INPUT CIRCUIT BLK PTR
	WORD OAP		;OUTPUT ADJACENCY POINTER
	WORD IAP		;INPUT ADJACENCY POINTER
	FILLER 1		;FILLER SO THAT FST FITS BETTER
	FIELD FST,8		;FIRST BYTE IN MESSAGE
				;** THIS ORDER MUST BE ENFORCED **
				;Phase III definitions
	  BIT MZ1		; RESERVED (MUST BE ZERO)
	  BIT EVL		; EVOLUTION BIT (RESERVED)
	  BIT MZ2		; RESERVED (MUST BE ZERO)
	  BIT RTS		; BEING RETURNED TO SENDER
	  BIT RQR		; RETURN REQUESTED
	  BIT MZ3		; RESERVED (MUST BE ZERO)
	  BIT MB1		; RESERVED (MUST BE ONE)
	  BIT CTL		; CONTROL MESSAGE (NOT DATA)
;
; Redefine the bits for the Phase IV packet format

;	SYNSTR RMPFD,RMMZ1 ;PAD FIELD
;	SYNSTR RMVER,RMEVL ;VERSION (1 IF PHASE II)
;	SYNSTR RMINP,RMMZ2 ;INTRA-NI PACKET
;	SYNSTR RMLGF,RMMZ3 ;LONG FORMAT HEADER

	FIELD CTY,3		; CONTROL MESSAGE TYPE
	FIELD FLG,5		;FLAG FIELD
	  BIT ODN		; LOCAL NSP DOESN'T WANT THIS LOCAL MESSAGE
				;  "ODN"ED
	  BIT PH2		;MESSAGE SEEMS TO BE PHASE II
	  BIT TRY		;NSP wants Router to "TRYHARD" on the NI
	  BIT TST		;This is a test message
	  BIT DRM		;This message should be resent to multicast
				; "All-Endnodes"
	WORD MSD,MD.LEN		;ROOM FOR RTR MESSAGE DESCRIPTOR

;Note that the HDR field is only used on output and that the marks
;are only used on input, so they occupy the same space.

	WORD HDR,<<RMH.LN+3>/4> ;RTR HEADER ROOM (** OUTPUT ONLY **)
	WORD MK1		;FIRST MARK
	WORD MK2		;SECOND MARK
ENDSTR
;Network Services Section

	NMH.LN==^D 12		;LENGTH OF HEADER SPACE (BYTES)
				;** MUST BE AT LEAST 2 WORD FOR MARKS

BEGSTR NM,RM.LST
	FIELD FLG,6		;FLAGS
	  BIT ACK		;NEEDS TO BE ACKED
	  BIT RET		;RETURN MSG TO SC
	  BIT DLY		;ACK DELAY ALLOWED
	FIELD SGN,12		;MESSAGE SEGMENT NUMBER
	FIELD MGF,9		;THE MSGFLG FIELD OF THE NSP HEADER
	FIELD CNT,9		;# OF TIMES WE'VE SENT MESSAGE
	WORD TIM		;TIME STAMP
	WORD PRT		;PTR TO PORT BLOCK
	HWORD LLA		;LOCAL LINK ADDRESS
	HWORD RLA		;REMOTE LINK ADDRESS
	WORD MSD,MD.LEN		;SPACE FOR MSD

	WORD ORQ,QP.LEN		;ORQ queue link
	WORD MAG		;Magic word for DTESRV

;Note that the HDR field is only used on output and that the marks
;are only used on input, so they occupy the same space.

	WORD HDR,<<NMH.LN+3>/4> ;NSP HEADER ROOM
	WORD MK1		;FIRST MARK
	WORD MK2		;SECOND MARK
ENDSTR
;Here is the User Data Area

	UDH.LN==^D16		;BYTES OF USER DATA KEPT IN MSG BLK

BEGSTR UD,NM.LST
	WORD MSD,MD.LEN		;SPACE FOR MSD
	WORD DAT,<<UDH.LN+3>/4>	;ROOM FOR 16 BYTES ALWAYS AVAILABLE
ENDSTR

	MB.LEN==UD.LST		;REDEFINE LENGTH OF MB

;We make use of the User Data MSD (UD.MSD) as the input MSD (on input
;all the message data is in one MSD.  References to the input MSD
;should use the symbol IN.MSD.
;
	XP IN.MSD,UD.MSD	;DEFINE THE INPUT MSD
;
;We will also define a first MSD (FI.MSD), which will most likely be
;RM.MSD (the router MSD), although all references to it should be
;to FI.MSD.
;
	XP FI.MSD,RM.MSD	;FIRST MSD IN A MESSAGE BLOCK
;
;The following fields are used to pass the NSP.  UUO arguments from
;SCxUUO and SCLUUO to SCLINK.  When SCLINK returns control back to
;SCxUUO, it changes these arguments and expects SCxUUO to change them
;in the user's argument block.  These arguments are stored over the
;private portions of the message block.
;
;When Session Control uses a message block like this, it can never be
;used as a conventional message block (i.e.  with MSDs, etc.).

BEGSTR SA,MB.LST		;START RIGHT AFTER PUBLIC PORTION OF MB
	FIELD FLG,6		;FLAGS (NOTE: THESE MUST BE IN
				; THE SAME ORDER AS NSWAI AND NSEOM)
	  BIT WAI		; WAIT IF USER WANTS (CHECK NS.WAI)
	  BIT EOM		; END OF MESSAGE FLAG
	  BIT BOM		; BEGINNING OF MESSAGE FLAG
	  BIT KCB		; KEEP CONNECT BLOCK FOR LIFE OF LINK
	  BIT BLK		; HIBER ROUTINE HAS BLOCKED.
				;Room for future MONUSR flags 
	FIELD MFG,6		;MONUSR FLAGS, NOT PART OF SAFLG!
	  BIT EVA		; USER BUFFER IN EXEC VIRTUAL ADDR SPACE
	  BIT SAT		; DATA READ SATISFIED
				;Room for future monitor flags
	HWORD ERR		;PLACE TO STORE ERROR RETURN
	HWORD NAG		;NUMBER OF USER ARGUMENTS SUPPLIED
	HWORD AFN		;FUNCTION CODE
	HWORD AST		;STATUS VARIABLE
	HWORD ACH		;CHANNEL OR JOB NUMBER
	WORD AA1		;ARGUMENT ONE
	WORD AA2		;ARGUMENT TWO
	WORD AA3		;ARGUMENT THREE
	WORD SBP		;POINTER TO STRING BLOCK
	WORD CBP		;POINTER TO CONNECT BLOCK
	WORD BCT		;BUFFER BYTE COUNT
	WORD BPT,2		;BUFFER BYTE POINTER (POSSIBLY EXTENDED)
	WORD SJB		;POINTER TO SESSION CONTROL JOB BLOCK
	WORD SLB		;POINTER TO SESSION CONTROL LINK BLOCK
	WORD SLT		;Indirect table entry this SAB belongs in

	WORD HBA		;ADDRESS OF ROUTINE TO PERFORM HIBER
	WORD WKA		;ADDRESS OF ROUTINE TO PERFORM WAKE

	WORD UID		;SLB'S SERIAL NUMBER - FOR STALE DETECTION
ENDSTR

IFG <SA.LST-MB.LEN>,<IF2,<PRINTX ?Session Control SA structure is longer
			  PRINTX ? than a message block.>>
SA.LEN==SA.LST+1		;MAKE SA.LEN INCLUDE MB.LEN
	SUBTTL	Structure Definitions -- Session Control Link Block

;This is the sub-link block.  There are two of these in the SL block, one
;for the normal sub-link and one for the other sublink.

BEGSTR SS
	FIELD FLG,18		;FLAG FIELD
	  BIT OTH		;INDICATES THIS IS THE "OTHER" SUB-LINK
	FIELD XDO,9		;SUBLINK TRANSMIT DRQS OUTSTANDING
	FIELD RDO,9		;SUBLINK RECEIVE DRQS OUTSTANDING
	WORD INQ,QH.LEN		;SUBLINK INPUT QUEUE
ENDSTR


;This is the Session Control Link Block.  It contains all the per-logical
;link data.

BEGSTR SL			;SESSION CONTROL LINK BLOCK
	WORD ASQ		;NEXT SLB ON ALL SLBs QUEUE
	WORD NXP		;NEXT SLB WITH ACTIVE PSI
	WORD JFQ		;NEXT SLB WITH ACTIVE JIFFY REQUEST
	WORD SLB		;CHECK POINTER TO THIS SLB
	WORD SJB		;POINTER TO JOB BLOCK (SJB)
	WORD CHN		;CHANNEL NUMBER (STARTS AT 1)

	HWORD DOB		;DESTINATION OBJECT TYPE
	HWORD SOB		;SOURCE OBJECT TYPE

	FIELD FLG,18		;FLAG FIELD
	  BIT CCB		; CHECK CONNECT BLOCK
	  BIT KCB		; KEEP CONNECT BLOCK FOR LIFE OF LINK
	  BIT PSI		; PSI PENDING FLAG
	  BIT PH2		; PHASE II HAS NO RESEND CAPABILITY
	  BIT ABO		; TRYING TO CLOSE AFTER ABORT & RELEASE
	  BIT FSL		; FREE THE SLB WHEN DONE WITH ALL PROCESSING
	  BIT BSY		; SLB IS BUSY (CANNOT BE FREED)
	  BIT LBC		; LINK IS BEING CLOSED BY NSP
	  BIT JFR		; JIFFY REQUEST OUTSTANDING
	  BIT EOM		; LAST SEGMENT OUTPUT WAS END OF MESSAGE
	  BIT PAS		; Set if this SLB belongs to a passive task

	FIELD STA,6		;SESSION CONTROL STATE
	FIELD XFL,3		;TRANSMIT FLOW CONTROL OPTION
	FIELD RFL,3		;RECEIVE FLOW CONTROL OPTION

	HWORD GOL		;RECEIVE DATA REQUEST GOAL

	HWORD INQ		;INPUT QUOTA FOR LINK
	HWORD OTQ		;OUTPUT QUOTA FOR LINK
	HWORD INU		;INPUT BUFFERS IN USE
	HWORD OTU		;OUTPUT BUFFERS IN USE

	HWORD SST		;LINK STATUS WORD
	HWORD PSM		;THE PSI MASK

	WORD NSL,SS.LEN		;"NORMAL" SUBLINK
	WORD OSL,SS.LEN		;"OTHER" SUBLINK

	HWORD DRR		;NORMAL DATA REQUESTS TO RESEND AT CLOCK LEVEL
	HWORD RSN		;REASON CODE OF DISCONNECT OR REJECT (16 BITS)

	WORD PID		;NSPpid OF PORT

	HWORD DNA		;DESTINATION NODE ADDRESS
	HWORD SIZ		;SEGMENT SIZE IN BYTES

	WORD CTM		;CONNECT INITIATE TIMER
	WORD WKA		;ADDRESS OF WAKEUP ROUTINE
	WORD CDM		;PTR TO CONNECT/DISCONNECT MESSAGE
	WORD CBP		;POINTER TO CONNECT BLOCK FOR PASSIVE TASK
	WORD OTM		;PTR TO PARTIALLY FILLED OUTPUT MESSAGE

	WORD UID		;SERIAL NUMBER - FOR STALE DETECTION

	HWORD BYS		;User bytes sent
	HWORD BYR		;User bytes received

	HWORD PKS		;PACKETS SENT OUT
	HWORD PKR		;PACKETS RECIEVED
ENDSTR
	SUBTTL	Structure Definitions -- Session Control Job Block

;We allocate SLT.LN number of channels in the channel table in the SJB
;itself.  When a job has more than SLT.LN channels open, we allocate
;the table from free core.
;
	XP SLT.LN,4		;LENGTH OF INITIAL SLB TABLE
;
;There is one Session Control Job Block for every job with an open
;logical link on the system.

BEGSTR SJ			;SESSION CONTROL JOB BLOCK
	WORD NXT		;NEXT JOB BLOCK IN SYSTEM
	WORD CHT		;PTR TO SLB TABLE (INDEXED BY CHANNEL)
	WORD CHC		;COUNT OF SPACES ALLOCATED IN SLB TABLE
	WORD PSJ		;POINTER TO SYSTEM'S POINTER TO THE SJB
				; THIS POINTS TO PDBSJB ON TOPS-10 AND
				; IS USED FOR RESET PROCESSING

	FIELD FLG,9		;FLAGS FIELD
IFN FTOPS20,BIT BLK		;(20  )THIS FORK IS BLOCKED
IFN FTOPS10,BIT PRV		;(10  )USER IS PRVJ PRIVILEGED
	  BIT RST		;(both)RESET IN PROGRESS
IFN FTOPS10,FIELD JOB,9		;(10)JOB NUMBER
IFN FTOPS20,FIELD FRK,9		;(20)FORK NUMBER
	HWORD CTA		;NUMBER OF CI TIMERS ACTIVE FOR JOB

	WORD SLT,SLT.LN		;INITIAL SLB TABLE
	WORD TXQ,QH.LEN		;TRANSACTION QUEUE OF LLINKS CALLS
	WORD PSQ,QH.LEN		;QUEUE OF SLBs WITH PSIs OUTSTANDING

;Note that the following two quotas are copied in SCUUO from the PDB's
;information about the job quotas

	HWORD GOL		;INPUT DATA REQUEST GOAL
	HWORD INQ		;JOB INPUT QUOTA
	HWORD OTQ		;JOB OUTPUT QUOTA
	HWORD INU		;BUFFERS USED TOWARD INPUT QUOTA BY JOB
	HWORD OTU		;BUFFERS USED TOWARD OUTPUT QUOTA BY JOB

	WORD SAB		;SA BLOCK POINTER
IFN FTOPS10,WORD MUU		;(10)SAVE MUUO WORD HERE FOR STOTAC, ETC
IFN FTOPS20,<
	WORD PRT		;(20)Pointer to the port indirect table
	WORD MXP		;(20)Number of slots in port table
> ;End of FTOPS20
ENDSTR
	SUBTTL Structure Definitions -- NSP Sublink Block

;The Sublink Block is part of the link block.  It holds the information
;about the "normal" and the "other" sublinks.
;
;The structure name ES is used instead of the more obvious NS
;(NSP Sublink) to avoid a conflict with the other NS structure
;defined in this universal file.  The "E" stands for the new
;name for the NSP layer: "End-to-end" layer.

BEGSTR ES
	FIELD FLG,12		;FLAGS, KEEP FIELD MOD 3 WIDE FOR DDT
	  BIT OTH		;SET IF THIS IS OTHER SUBLINK
	  BIT ACK		;SEND ACK FOR THIS SUBLINK NEXT JIFFY
	  BIT NAK		;SEND NAK TO PH2 NSP (TURN ACK ON TOO)
	  BIT ROF		;RECEIVE IS OFF
	  BIT ROC		;RECEIVE OFF HAS CHANGED
	  BIT XOF		;XMIT IS OFF
;	  BIT XOC		;XMIT OFF HAS CHANGED (NOT USED)
	  BIT BFR		;REMOTE IS "BUFFER-RICH" ON THIS LINK
	  BIT DLY		;ACK DELAYING ALLOWED
	FILLER 1		;MAKE FOLLOWING FIELD PRETTY FOR DDT
	FIELD RFL,2		;RECEIVE FLOW CONTROL TYPE
	FILLER 1		;MAKE FOLLOWING FIELD PRETTY FOR DDT
	FIELD XFL,2		;XMIT FLOW CONTROL TYPE
	FIELD GOL,9		;DATA REQUEST GOAL (9 FOR DDT EASE)
	FIELD CGL,9		;AFTER-CONGESTION RECOVERY GOAL

	NXTWRD
	FIELD XLD,8		;XMIT DRQS OUTSTANDING TO LOCAL SC
	FIELD XRD,8		;XMIT DRQS OUTSTANDING TO REMOTE NSP
	FIELD XSD,8		;XMIT DRQS NEED TO SEND TO SC

	NXTWRD
	FIELD RLD,8		;RECEIVE DRQS OUTSTANDING TO LOCAL SC
	FIELD RRD,8		;RECEIVE DRQS OUTSTANDING TO REMOTE NSP
	FIELD RSD,8		;RECEIVE DRQS NEED TO SEND TO SC

	NXTWRD
	FIELD LMA,12		;LAST MESSAGE NUMBER ASSIGNED
	FIELD LAR,12		;LAST ACK RECEIVED (AND PROCESSED)
	FIELD LMR,12		;LAST MESSAGE RECEIVED

	WORD AKQ,QH.LEN		;QUEUE HEADER FOR THE TO-BE-ACKED Q
	WORD RCQ,QH.LEN		;QUEUE HEADER FOR THE RECEIVE Q
	WORD XMQ,QH.LEN		;QUEUE HEADER FOR THE XMIT Q

	FIELD CWS,12		;Current window size
	FIELD CDA,12		;# of ACKs since last window change
	FIELD DLT,12		;ACK delay timer

ENDSTR
 	SUBTTL Structure Definitions -- NSP LINK Block

;The Link Block holds all the NSP information about this logical link.

BEGSTR EL
	WORD APQ,QP.LEN		;NEXT IN QUEUE OF ALL LINK BLOCKS
	WORD HBQ,QP.LEN		;NEXT IN QUEUE OF LINKS IN A HASH BUCKET
	WORD JFQ,QP.LEN		;NEXT IN QUEUE OF LINKS NEEDING JIFFY SERVICE
	FIELD FLG,9		;FLAGS, MOD 3 NUMBER OF BITS FOR DDT
	  BIT OJQ		;LINK IS ON THE JIFFY-REQUEST QUEUE
	  BIT SNC		;SET IF NOT YET TOLD SC ABOUT NO CONF
	  BIT CNF		;SET IF WE HAVE CONFIDENCE IN LINK
	  BIT SCM		;SEND CONNECT ACK MESSAGE NEXT JIFFY
	  BIT SDM		;SEND DISCONNECT CONFIRM MESSAGE NEXT JIFFY
	  BIT ABO		;ABORTING THIS LOGICAL LINK
	  BIT DTO		;DELAY TIMER IS FOR "OTHER" SUBLINK
	FIELD STA,6		;NSP STATE OF THIS LINK
	HWORD SIZ		;MAX SIZE OF A SEGMENT ON THIS LINK

	HWORD LLA		;LOCAL LINK ADDRESS
	HWORD RLA		;REMOTE LINK ADDRESS

	WORD ORQ,QH.LEN		;Queue header for MBs sent to ROUTER and
				; expected to be returned to LLINKS
	WORD CLC		;Count of retries left, trying to close a
				; port waiting for MBs to be returned from
				; ROUTER and children.

	HWORD ORC		;COUNT OF MSGS OUT IN ROUTER
	FIELD VER,3		;VERSION OF REMOTE NSP, SEE VER3.1,VER3.2
	FILLER 3		;MAKE DTM RIGHT JUSTIFIED FOR DDT
	FIELD DSG,12		;MSG SEGMENT BEING TIMED FOR DELAY CALC
				; (MUST BE SEGNUM-SIZE FIELD FOR CMODxx)
	WORD DTM		; AND TIME IT WAS FIRST SENT

	HWORD NNM		;THE REMOTE'S NODE NUMBER
	WORD NDB		;PTR TO NSP NODE BLOCK

	WORD TMA		;INACTIVITY TIMER
	WORD SCV		;SESSION CONTROL CALL VECTOR BASE ADDRESS
	WORD SCB		;SESSION CONTROL BLOCK ID
	WORD CIM		;Ptr to (R)CI message
	WORD DIM		;PTR TO DI MESSAGE
	WORD NSL,ES.LEN		;THE NORMAL SUBLINK BLOCK
	WORD OSL,ES.LEN		;THE OTHER SUBLINK BLOCK


	WORD CIR		;OUTPUT CIRCUIT FOR LOOPBACK CONNECTION

	WORD CHK		;ADDRESS OF THIS EL, FOR ADDR CHECK
ENDSTR

	SUBTTL	NSP Node Block Definition

;Note - many counters are full words, even though they only have to be
; 16 bits wide. This is so the OPSTR logic will generate a single
; read-modify-write instruction when updating them, and will spare
; us the worry of interlocking this data base.

BEGSTR NN			;NETWORK NODE BLOCK
	WORD  NXT,QP.LEN	;PTR TO NEXT NODE BLOCK

	WORD TLZ		;Time (from DNGTIM) when last zeroed

	FIELD FLG,2		;MAKE NNNOD RIGHT-JUST IN HALF-WORD
	  BIT GDL		;SET IF WE'VE "GOT DELAY", SEE UPDELAY
	FIELD MSG,1		;Set if we've sent a 'link broken' message
				; for this node
	FILLER 15

	HWORD NOD		;NETWORK NODE ID (2 BYTES) (HWORD for speed)

	WORD TMC		;MESSAGE TIMEOUTS TO NODE

	WORD RBC		;User bytes received from node
	WORD XBC		;User bytes transmitted to node
	WORD RMC		;User msgs received from node
	WORD XMC		;User msgs transmitted to node

	WORD TBR		;Total # of bytes received from node
	WORD TBX		;Total # of bytes transmitted to node
	WORD TMR		;Total # of messages received from node
	WORD TMX		;Total # of messages received from node

	WORD RCC		;CONNECT INITS RECEIVED FROM NODE
	WORD XCC		;CONNECT INITS TRANSMITTED TO NODE

	WORD RRC		;REJECTS RECEIVED FROM NODE
	WORD XRC		;REJECTS TRANSMITTED TO NODE

	WORD LKC		;CURRENT ACTIVE LINKS TO NODE
	WORD LKM		;MAX ACTIVE LINKS TO NODE

	WORD CRC		;CONNECT RESOURCE ERRORS RECEIVED
	WORD DLY		;ESTIMATED ROUND-TRIP DELAY (MSECS)

	WORD SLZ		;SECONDS SINCE LAST ZEROED (TIME STAMP)

	WORD PSZ		;Pipe size (= 3 * last message's visit count)
ENDSTR

	SUBTTL  Structure Definitions -- Router Adjacency Block
BEGSTR AJ
	WORD NXT		;Pointer to next adjacency block

	FIELD STA,2		;Adjacency state
	FIELD NTY,4		;Neighbor node type

	FIELD FLA,6		;Flag field
	  BIT PH4		;Phase 4 node
	  BIT VRQ		;Verification requested by remote
	  BIT BLO		;Blocking is requested by this node
	  BIT RJF		;Reject flag
	  BIT MTA		;No multi-cast traffic accepted
	FIELD VER,8		;Version of neighbor's router
	FIELD ECO,8		;ECO number of neighbor's router
	FIELD CUS,8		;Customer version of neighbor's router

	WORD NAH		;Adjacency's hi-order address (NI)
	FIELD NAL,18		;Low order in string format <a1,a2>
	FILLER 2
	FIELD NAA,6		;Adjacency's node area
	FIELD NAN,10		;Adjacency's node number
	 MSKSTR (AJADR,AJ.NAN,<AJNAA!AJNAN>) ; 16 bit address of adjacency
; Make a macro to be sure masks are in same word
	WORD RTV		;Pointer to this adjacency's routing vector
	WORD CBP		;Circuit block for this adjacency
	WORD BSZ		;Block size requested by neighbor
	WORD NHT		;Neighbor's hello timer
	WORD TLR		;Time last message received from adjacency
	FIELD PRI,8		;Routers priority to be designated router (NI)
	FIELD ARE,8		;Routers area (reserved field)
	FIELD MPD,^D16		;MPD (reserved)

ENDSTR


;These are the various types of nodes (in FIELD AJNTY).

	XP ADJ.3F,0		;Phase III routing node
	XP ADJ.3S,1		;Phase III non-routing node
	XP ADJ.L2,3		;Phase IV level II router
	XP ADJ.L1,4		;Phase IV level I router
	XP ADJ.LN,5		;Phase IV non-routing
	 ADJ.MX==ADJ.LN		;Maximum node type

;These are the various states in field AJSTA

	XP ADJ.UN,0		;This entry is currently unused
	XP ADJ.IN,1		;Currently initializing
	XP ADJ.UP,2		;Adjacency is up
	XP ADJ.OL,3		;Adjacency is off-line
	SUBTTL  Structure Definitions -- Router Circuit Block

;This structure contains all the "per-circuit" data for Router-36.

BEGSTR RC
	WORD NXT		;Pointer to next circuit block
	WORD LID		;Circuit ID
	WORD DLB		;Data link block address
	WORD AJQ,QH.LEN		;Queue of adjacencies belonging to this circuit

	FIELD FLG,9		;Place for some flags
	  BIT BCT		; Broadcast circuit (should be bit 0)
	  BIT SRM		; Send routing message flag
	  BIT EBU		; Emergency buffer is in use
	  BIT SHM		; Send hello message
	  BIT DSR		; We are the designated router
IFN FTOPS10,<
	  BIT OPN		; Call Kontroller function DF.OPN
	  BIT CLS		; Call Kontroller function DF.CLS
>; END IFN FTOPS10

	FIELD STA,3		; Circuit state
	FIELD CST,12		; Circuit cost
	FIELD DRT,9		; Timer before we assume DSR role

	WORD TLS		;Time last message of any type was sent
	WORD TLR		;Time last routing message was sent
	WORD TLH		;Time we sent the last hello (NI only)
	WORD TIN		;Time we got protocol up from controller
	WORD TM3		;Hello message timer
	HWORD BSZ		;Minimum of adjacencies' block sizes
	HWORD RBS		;Receive block size for this circuit
	HWORD MXR		;Maximum routers allowed on this circuit
	HWORD NRO		;Number of routers online
	WORD DSH		;ID of current designated router (NI only)
	HWORD DSL		; ...
	HWORD PRI		;Priority to be designated router (NI only)

	WORD JSQ,QH.LEN		;Queue header for jiffy resend queue
				;Circuit counters:
	WORD CMQ		; Messages queued
	WORD CLC		; Local messages
	WORD SLZ		;   (0) Time stamp of when last zeroed.
	WORD CAP		; (800) Arriving packets received (to NSP)
	WORD CDP		; (801) Departing packets sent (from NSP)
	WORD CAL		; (802) Arriving congestion loss (to NSP)
	WORD CTR		; (810) Transit packets received
	WORD CTS		; (811) Transit packets sent
	WORD CTL		; (812) Transit congestion loss
	WORD CCD		; (820) Circuit down events
	WORD AJD		;	Adjacency down
	WORD CIF		; (821) Initialization failures
	WORD BSX		; (xxxx) Adjacency block size exceeded /output
ENDSTR

;These are the possible circuit states (in FIELD RCSTA).

	XP RCS.OF,0		;Off, not to be looked at
	XP RCS.RJ,1		;Rejected - Attempt to queue output failed
	XP RCS.FA,2		;Failed - Received line down from DLL
	XP RCS.WT,3		;Waiting for protocol up (initializing)
	XP RCS.TI,4		;Waiting for Router inititialization message
	XP RCS.TV,5		;Waiting for Router verification message
	XP RCS.TT,6		;Through-put testing (or whatever)
	XP RCS.RN,7		;Circuit is up and running

	SUBTTL  Structure Definitions -- DNADLL data link block

BEGSTR DL
	WORD NXT		; Link to next data link block
	WORD UID		; ID supplied by DNADLL user
	WORD DID		; Device ID
	FIELD FLG,6		; Data link flags
	  BIT RUN		; Data link is running
	  BIT EBU		; Emergency buffer in use
	  BIT LIU		; Line in use by circuit
IFN FTOPS20,<
	HWORD KNO		; Kontroller number (DTE only)
	WORD UNB		; Pointer to the User-NI block
	WORD PID		; Portal ID
	WORD LTP		; Line table pointer
>; END IFN FTOPS20
IFN FTOPS10,<
	WORD LNB		; Line data block address
>; END IFN FTOPS10
	WORD SLZ		;(0) Seconds since last zeroed
	WORD BYR		;(1000) Total bytes received
	WORD BYS		;(1001) Total bytes sent
	WORD DBR		;(1010) Total data blocks received
	WORD DBS		;(1011) Total data blocks sent
	WORD UBU		;(1065) User buffer unavailable
ENDSTR
;Router test message data block

IFN FTRTST,<

BEGSTR TR
	WORD TND		; Node to test with
	WORD TSN		; Serial number of message
	WORD TAF		; Time when message reaches RTRFWD
	WORD TIC		; Time at input complete
	WORD TOC		; Time when output complete is received
	WORD TTD		; Time given to DLL
	WORD TTA		; Total time to turn around (TIC-TAF)
	WORD TED		; Time to get from FWD to DLL (TTD-TAF)
	WORD TFD		; Time from forward to output done (TTF-TOC)
ENDSTR
> ;End FTRTST

;This structure describes the DECnet word in the TOPS-10 PDB.
;Note that this field never made it into the PDB.

BEGSTR PD			;DECNET WORD IN PDB
	FIELD GOL,12		;PROCESS'S GOAL
	FIELD DQT,12		;PROCESS'S DEFAULT QUOTA
	FIELD IPR,12		;PROCESS'S INPUT PERCENTAGE
ENDSTR

	SUBTTL Value Definitions --  NSP Port States

;Define the Port State constants

DEFINE STATE(st),<
	ZZ==ZZ+1
	NPS.'st==ZZ>
	ZZ==0

	STATE	OP		;OPEN, WAITING FOR ENTER ACTIVE FROM SC
	STATE	CI		;CONNECT INITIATE SENT
	STATE	CD		;CONNECT DELIVERED
	STATE	CR		;CONNECT RECEIVED
	STATE	CC		;CONNECT CONFIRM
	STATE	DR		;DISCONNECT REJECT
	STATE	RC		;DISCONNECT REJECT COMPLETE (DRC)
	STATE	RN		;RUN
	STATE	RJ		;REJECT
	STATE	DI		;DISCONNECT INITIATE
	STATE	IC		;DISCONNECT INITIATE COMPLETE (DIC)
	STATE	DN		;DISCONNECT NOTIFICATION
	STATE	CN		;CLOSE NOTIFICATION
	STATE	NR		;NO RESOURCES
	STATE	NC		;NO COMMUNICATION
	STATE	CL		;CLOSED
	STATE	DP		;DESTROY PORT

PURGE	ZZ,STATE
	SUBTTL Value Definitions -- DECnet Standard Parameters

;The REASON values for a Disconnect Initiate or Disconnect Confirm message

	..RDX==10		;SAVE PRESENT RADIX
	RADIX 10		;USE DECIMAL FOR THE REASONS

	RSNRBO==0		;REJECTED BY OBJECT
	RSNDBO==0		;DISCONNECTED BY OBJECT (WHEN RUNNING)
	RSNRES==1		;NO RESOURCES
	RSNUNN==2		;UNRECOGNIZED NODE NAME
	RSNRNS==3		;REMOTE NODE SHUT DOWN
	RSNURO==4		;UNRECOGNIZED OBJECT
	RSNIOF==5		;INVALID OBJECT NAME FORMAT
	RSNOTB==6		;OBJECT TOO BUSY
	RSNABM==8		;ABORT BY MANAGEMENT
	RSNABO==9		;ABORT BY OBJECT
	RSNINF==10		;INVALID NODE NAME FORMAT
	RSNLNS==11		;LOCAL NODE SHUT DOWN
	RSNACR==34		;ACCESS CONTROL REJECTION
	RSNNRO==38		;NO RESPONSE FROM OBJECT
	RSNNUR==39		;NODE UNREACHABLE
	RSNNLK==41		;NO LINK
	RSNDSC==42		;DISCONNECT COMPLETE
	RSNIMG==43		;IMAGE FIELD TOO LONG (RQSTRID,
				; PASSWORD, ACCOUNT, USRDATA, ETC)

	RADIX ..RDX		;RESTORE PREVIOUS RADIX
	SUBTTL Value Definitions -- DECnet-wide states

;The following states are from the possible executor states as defined
;by Network Management.  This state is contained in the cell DCNSTA
;located in D36COM.

	XP DS.ON,0		;ON
	XP DS.OFF,1		;OFF
	XP DS.SHU,2		;SHUT
	XP DS.RES,3		;RESTRICTED

	SUBTTL Inter-Layer Parameters -- Overall Argument Conventions

;Session Control will be called with the following basic calling
;sequence:

;Call:	T1/ Function-specific argument, see below
;	T2/ Function-specific argument, see below
;	T3/ Function code = SV.xxx, defined below
;	T4/ Full-word pointer to a message block
;	CALL	@NP.SCV(PB)
;	Normal Return
;Changes T1,T2,T3,T4, preserves all others



;NSP will be called with the following basic calling sequence:

;Call:	T1/ Function-specific argument, see below
;	T2/ Function-specific argument, see below
;	T3/ Function code = NV.xxx, defined below
;	T4/ Full-word pointer to a message block
;	CALL	NSP
;	Normal Return
;Changes T1,T2,T3,T4, preserves all others



;Router will be called with the following basic calling sequence:

;Call:	T1/ RT%RQR set if return is requested on transmission failure
;	MB/ Pointer to the message block
;	CALL	RTRXMT
;	Normal Return
;Changes T1,T2,T3,T4, preserves all others


;The DLL layer kontrollers are called with the the following sequence:

;Call:	T1/ Kontroller Function (KF.xxx)
;	T2/ Pointer to Line Block to use
;	T3/ Function dependant data (usually pointer to message block)
;	CALL CALKON
;	Normal Return
;Changes T1-T4

	SUBTTL Inter-Layer Parameters -- Session Control Function Codes

;These are the function codes for the calls to Session Control from
;NSP.

	XP SV.CCR, 0		;CONNECT CONFIRMED CALL
	XP SV.DIR, 1		;DISCONNECT INITIATE RECEIVED CALL
	XP SV.DCR, 2		;DISCONNECT CONFIRM RECEIVED CALL
	XP SV.OND, 3		;OUTPUT NOT DONE CALL
	XP SV.ODN, 4		;OUTPUT DONE CALL
	XP SV.SEG, 5		;SEGMENT RECEIVED CALL
	XP SV.DRQ, 6		;DATA REQUEST RECEIVED CALL
	XP SV.NCF, 7		;NO CONFIDENCE IN PORT CALL
	XP SV.NRS,10		;NO RESOURCES CALL
	XP SV.CLS,11		;CLOSE COMPLETED CALL
	XP SV.NLK,12		;NO LINK CALL
	XP SV.NCM,13		;NO COMMUNICATION CALL
	XP SV.NRN,14		;NOT IN RUN STATE
	XP SV.CAK,15		;CONNECT ACKNOWLEGE CALL

				;The Connect Initiate call does not go
				;through the vectored interface, since
				;it must go to a single routine
				;capable of sorting out which Session
				;Control will handle the incoming
				;message.  the connect initiate call
				;goes to the global label SCTLCI.
	SUBTTL Inter-Layer Parameters -- NSP Function Codes

	XP NV.OPN, 0		;OPEN FROM SESSION CONTROL
	XP NV.ACT, 1		;ENTER ACTIVE FROM SESSION CONTROL
	XP NV.ACC, 2		;ACCEPT CONNECT FROM SESSION CONTROL
	XP NV.REJ, 3		;REJECT CONNECT FROM SESSION CONTROL
	XP NV.SEG, 4		;SEND SEGMENT FROM SESSION CONTROL
	XP NV.DRQ, 5		;REQUEST DATA FOR SESSION CONTROL
	XP NV.GOL, 6		;SET QUOTA/GOAL FROM SESSION CONTROL
	XP NV.DSC, 7		;SEND DISCONNECT FROM SESSION CONTROL
	XP NV.ABO,10		;SEND ABORT FROM SESSION CONTROL
	XP NV.CLS,11		;CLOSE PORT FROM SESSION CONTROL

	XP NV.RVF,12		;FIRST ROUTER CALL VECTOR OFFSET
	XP NV.RCV,12		;RECEIVE MESSAGE FROM ROUTER
	XP NV.ODN,13		;OUTPUT DONE FROM ROUTER
	XP NV.RTS,14		;RETURN TO SENDER FROM ROUTER
	XP NV.RFR,15		;Returned to sender from remote router
	XP NV.RVL,15		;LAST ROUTER CALL VECTOR OFFSET

	SUBTTL Inter-Layer Parameters -- Session Control/NSP

;Arguments passed between Session Control and NSP:

;Flow Control Mode, for NSP and Session Control.  These must not be
;changed, as they mirror definitions in the protocol.

	XP FCM.NO,0		;NO FLOW
	XP FCM.SG,1		;SEGMENT
	XP FCM.MG,2		;MESSAGE
	XP FCM.XX,3		;RESERVED


;The DATA REQUEST call's argument definitions for T2

BEGSTR QA
	FIELD FLG,6
;	  BIT OFF		;SET IF THE SUBLINK IS TO BE TURNED OFF
	HWORD CNT		;THE DATA REQUEST COUNT BEING REQUESTED
ENDSTR				;IF NEGATIVE, ITS 2'S COMPLEMENT IN FIELD
				; HALF WORD SO LOADE CAN MAKE HRRE
;Some of the calls between Session Control and NSP require more arguments
;than will fit into the two registers reserved for argument passing.
;These calls pass instead a pointer to an argument block.  The formats
;of those blocks are described here.

;The OPEN call's argument block

BEGSTR OA			;OPEN ARGUMENT BLOCK
	WORD SCB		;SCB ID FOR NEW PORT
	WORD NOD		;DESTINATION NODE
	WORD FLO		;FLOW CONTROL TYPE
	WORD GOL		;DATA REQUEST GOAL
	WORD SIZ		;MAX BYTES ALLOWED IN A MESSAGE SEGMENT
	WORD SCV		;SESSION CONTROL'S ENTRY ADDRESS
	WORD CIR		;LOOPBACK CIRCUIT
ENDSTR


;The ACCEPT call's argument block

BEGSTR AA			;ACCEPT ARGUMENT BLOCK
	WORD SCB		;SCB ID FOR NEW PORT
	WORD PID		;NSP'S PORT IDENTIFIER
	WORD FLO		;FLOW CONTROL TYPE
	WORD GOL		;DATA REQUEST GOAL
	WORD SIZ		;MAX BYTES ALLOWED IN A MESSAGE SEGMENT
	WORD SCV		;SESSION CONTROL'S ENTRY ADDRESS
ENDSTR

;The Connect Initiate and Connect Confirm calls' argument format for T2.
;T1 holds the NSPpid for the new logical link.

BEGSTR IA
	HWORD FLO		;FLOW CONTROL TYPE
	HWORD SIZ		;MAX BYTES ALLOWED IN A MESSAGE SEGMENT
				;SOURCE NODE ID AND ROUTER CHANNEL ARE
				; IN THE PUBLIC PART OF THE MESSAGE BLOCK
ENDSTR
	SUBTTL Inter-Layer Parameters -- NSP/Router

;Arguments passed between NSP and Router:

;NSP passes this flag in T1 to Router on a call to RTRXMT if it wants
;to request a return of the message it is sending.

	XP RT%RQR,1B0		;RETURN REQUESTED ON TRANSMISSION FAILURE
	XP RT%ODN,1B1		;RETURN MESSAGE BLOCK TO NSP WHEN OUTPUT DONE
	XP RT%TRY,1B2		;TRYHARD WHEN OUTPUT CIRCUIT IS NI

;NSP passes this flag in T1 to Router on a call to RTRINI, to say that he
;is the one and only NSP which will take Phase II messages.

	XP RT%PH2,1B0		;I AM THE "PHASE2" NSP

	SUBTTL Inter-Layer Parameters -- Router/DLL

;The interface between Router and the DLL is vectored. These are the
;functions codes of the interrupts which the DLL ("kontroller") will
;pass to Router.


	XP DI.ODN,1		;OUTPUT DONE
	XP DI.INC,2		;INPUT COMPLETE
	XP DI.LSC,3		;LINE STATE CHANGE
	XP DI.ICB,4		;INITIALIZE CIRCUIT BLOCK
	XP DI.MAX,DI.ICB	;MAXIMUM FUNCTION

;The DLL performs these functions for Router.

	XP DF.OPN,0		;OPEN THE CIRCUIT
	XP DF.CLS,1		;CLOSE THE CIRCUIT
	XP DF.XMT,2		;TRANSMIT MESSAGE

;The DLL preforms these functions for Network management (NTMAN)

	XP DF.SET,3		;NTMAN - SET FUNCTION
	XP DF.CLR,4		;NTMAN - CLEAR FUNCTION
	XP DF.RED,5		;NTMAN - READ FUNCTION
	XP DF.SHC,6		;NTMAN - Show counters
	XP DF.SZC,7		;NTMAN - Show and zero counters
	XP DF.RET,10		;NTMAN - Return list (e.g. show known lines)
	XP DF.A2N,11		;NTMAN - Map node address to name
	XP DF.N2A,12		;NTMAN - Map node name to address
	XP DF.CET,13		;NTMAN - Check entity
	XP DF.MAX,DF.CET	;MAXIMUM FUNCTION NUMBER

;These are needed until NTMAN is modernized

	XP KF.SET,5		;Set parameters
	XP KF.CLR,6		;Clear parameters
	XP KF.RED,7		;Read parameters

;These are DTESRV specific functions

	XP DD.OPN,0 		; Open circuit
	XP DD.CLS,1 		; Close circuit
	XP DD.QUE,2 		; Queue output buffer
	XP DD.PRB,3 		; Post receive message block
	XP DD.CKE,4		; Check existance of DTE
	XP DD.MAX,DD.CKE	; Maximum function number

;This is the KONTROLLER interface to DDCMP KONTROLLERS
;Functions (to KONTROLLER)
	XP DC.FHL,0		; Halt protocol
	XP DC.FIL,1		; Initialize protocol
	XP DC.FSM,2		; Set maint mode
	XP DC.FQB,3		; Queue output buffer
	XP DC.FAL,4		; Assign line (Used to exchange portal IDs)
	XP DC.FMX,DC.FAL	; Max fcn

;Interrupts (to user)
	XP DC.IPU,0		; Protocol up
	XP DC.IPD,1		; Protocol down
	XP DC.IMR,2		; Maint msg received
	XP DC.ISR,3		; Start msg received
	XP DC.IOD,4		; Output done
	XP DC.IOF,5		; Output failed
	XP DC.IIC,6		; Input complete
	XP DC.IGB,7		; Get buffer (for input msg)
	XP DC.IOC,10		; Open circuit (define line)
	XP DC.ICC,11		; Close circuit (undefine line)
	XP DC.IMX,DC.ICC	; Max fn

;These are the generic line states.

	XP LS.ON,0		; On
	XP LS.OFF,1		; Off
	XP LS.SRV,2		; Service
	XP LS.CLR,3		; Cleared

;These are the error codes CIDLL will return to DNADLL on non-network
; management functions.

	XP CIEBAS,2000		;CI errors have a base of 2000

	XP CNSUC%,0!CIEBAS	;Success
	XP CNNCI%,1!CIEBAS	;No CI interface present
	XP CNNRE%,2!CIEBAS	;No resources
	XP CNNSP%,3!CIEBAS	;No such port
	XP CNPNA%,4!CIEBAS	;Port block not allocated
	XP CNPAO%,5!CIEBAS	;Port is already open
	XP CNLPT%,6!CIEBAS	;Local port is illegal
	XP CNPWS%,7!CIEBAS	;Port is in wrong state
	XP CNIMS%,10!CIEBAS	;Illegal message size
	XP CNXMF%,11!CIEBAS	;SCA datagram send failed

	SUBTTL Inter-Layer Parameters -- Layer/NMX (Event logger)

;The interface between a layer and the event logger in NTMAN is vectored.
;These are the function codes a layer will pass to NTMAN.

	XP EV.GEC,0		;Get an EC block
	XP EV.REC,1		;Release an EC block
	XP EV.FIL,2		;Filter an event
	XP EV.LOG,3		;Log an event
	XP EV.SIG,4		;Log a signal

	SUBTTL Network Management -- Argument blocks

;The following is the defintion of the Line-ID that router maps into
;a line block address. This is used
;	On an initial open from the DLL to ROUTER;
;	By router to determine an Kontroller specific peculiarities;
;	By network management to communicate with ROUTER.

BEGSTR LI			;LINE-ID
	FIELD LXC,1		; BIT INDICATING LINE ID OR CIRCUIT ID.
	FILLER 2		;  (BIT=0 MEANS CIRCUIT, =1 MEANS LINE)
	FIELD DEV,6		; DEVICE TYPE
	FIELD KON,9		; CONTROLLER NUMBER (CPU# FOR DTE'S AND CI'S)
	FIELD UNI,9		; UNIT NUMBER
	FIELD DRP,9		; DROP NUMBER (PORT FOR CI'S)
ENDSTR

;These are the bits indicating which of the above fields are present
	XP KD.DEV,1		;DEVICE NAME (ALWAYS PRESENT)
	XP KD.KON,2		;CONTROLLER NUMBER
	XP KD.UNI,4		;UNIT NUMBER
	XP KD.DRP,10		;DROP NUMBER

;These are the types of devices that we know about (in field LIDEV).

	XP LD.TST,0		;TEST BED DRIVER (OBSOLETE)
	XP LD.DTE,1		;DTE
	XP LD.KDP,2		;KDP
	XP LD.DDP,3		;DDP
	XP LD.CIP,4		;CI PORT
	XP LD.ETH,5		;ETHERNET
	XP LD.DMR,6		;DMR
	   LD.MAX==LD.DMR
;Define block of ''globals'' used by NMX

BEGSTR NX
	FIELD FLG,7		;FLAGS
	 BIT  WRM		;WRITING MONITOR'S DATA BASE. 1=WRITING
	 BIT  WUS		;WRITING USERS DATA STRING. 1=WRITING
	 BIT  ZMC		;ZEROING OR CLEARING MONITOR CORE.
	 BIT  CXP		;COUNTER=1 OR PARAMETER=0.
	 BIT  NIL		;NOT IN LAYER. (I DIDN'T BIT)
	 BIT  ECV		;DO ENTITY CONVERSION
	 BIT  MCX		;BUFFER IS IN MONITOR CONTEXT
	FILLER 2
	FIELD NTY,3		;NODE TYPE, IF NODE.
	 XP NX.EXN,1		;EXECUTOR NODE
	 XP NX.REN,2		;REMOTE NODE
	 XP NX.LPN,3		;LOOPBACK NODE
	FIELD LTY,3		;LINE TYPE
	 XP NX.TST,0		;TEST BED DRIVER (OBSOLETE)
	 XP NX.DTE,1		;DTE
	 XP NX.KDP,2		;KDP
	 XP NX.DDP,3		;DDP
	 XP NX.CIP,4		;CI PORT
	 XP NX.NI,5		;ETHERNET
	 XP NX.DMR,6		;DMR
	FIELD ENT,3		;ENTITY TYPE
	HWORD PRM		;PARAMETER/COUNTER IDENTIFIER.
	WORD NUM		;ENTITY SEQUENCE NUMBER. (NODE ADDR OF LINE ID)
	WORD VAL,8		;MAXIMUM STRING SIZE (32 BYTES)
	WORD MBY		;MAXIMUM NUMBER OF BYTES
	WORD ADR		;USER VIRTUAL ADDRESS OF ARGUMENT BLOCK
	WORD UUO		;SAVED CALLING UUO (NEED FOR STOTAC)
	WORD EID,BP.LEN		;STRING POINTER TO ENTITY ID
	WORD FNC		;FUNCTION CODE.
	WORD SEL		;SELECTION CRITERIA FOR FUNCTION.
	WORD DAT,BP.LEN		;STRING POINTER FIELD TO DATA STRING
	WORD ERR		;ERROR CODE.
ENDSTR

;A special error code

	NEADC%==-^D47

	SUBTTL Network Management -- NSP and ROUTING VERSION Number Formats
;Define NSP and Routing Version number words

BEGSTR VN
	FIELD VER,8		;Version number
	FIELD ECO,8		;ECO number
	FIELD UCO,8		;User ECO number
	FILLER 12		;Fill up the word
ENDSTR


;Define Counter Block Sub-fields

BEGSTR KB
	FIELD BMF,1		;Bit Map Flag
	FIELD WID,^D17		;Counter width in bits
	HWORD TYP		;Counter Type (Number)
	WORD VAL		;Counter Value
	WORD MSK		;Bit Mask
ENDSTR

	SUBTTL Network Management -- Values used by NMX

	XP NSXILL,0		;ILLEGAL
	XP NSXVRS,1		;NSP VERSION NUMBER
	XP NSXECO,2		;ECO NUMBER
	XP NSXUEC,3		;USER ECO NUMBER
	XP NSXDLY,4		;DELAY
	XP NSXDLW,5
	XP NSXIAT,6		;
	XP NSXRTM,7		;RESPONSE TIMEOUTS

;Line states according to NMX

	XP NCK.ON,0		;CIRCUIT/LINE STATE ON
	XP NCK.OF,1		;STATE OFF
	XP NCK.SR,2		;SERVICE
	XP NCK.CL,3		;CLEARED

;Line substates according to NMX

	XP NCB.ST,0		;--STARTING
	XP NCB.SN,^D10		;--SYNCHRONIZING
	XP NCB.FA,^D11		;--FAILED
;Circuit states according to Router
	XP RNS.OF,0		; Off
	XP RNS.FA,1		; Failed
	XP RNS.ST,2		; Starting
	XP RNS.ON,3		; Running

;Network management node states
	XP RM.REA,4		;Reachable
	XP RM.UNR,5		;Unreachable

;For LLINKS and ROUTER
;Entity types
	XP .NTNON,-1
	XP .NTNOD,0		;NODE ENTITY
	XP .NTLIN,1		;LINE
	XP .NTLOG,2		;LOGGING
	XP .NTCKT,3		;CIRCUIT
	XP .NTMOD,4		;MODULE
	XP .NTARE,5		;AREA


;Qualifiers for functions
	XP .NTSGN,-5		;SIGNIFICANT		;(FOR .NTRET)
	XP .NTADJ,-4		;ADJACENT
	XP .NTLOP,-3		;LOOP
 	XP .NTACT,-2		;ACTIVE ITEMS
	XP .NTKNO,-1		;KNOWN ITEMS		


	SUBTTL	Network Management -- NMX Function Block Definition

;This is the NMX Interface Function Argument Block.  Its purpose
;is to implement a standard calling interface between Network
;Management (NTMAN) and the DECnet Layers.
;Define Network management Functions Block

BEGSTR NF
	WORD EID		;Entity ID
	HWORD BYT		;Byte count
	HWORD PRM		;Parameter Number
	FIELD BFF,1		;Buffer Flag
	FIELD UBF,1		;User Buffer passed (for return KNOWN NODES)
	FIELD QUF,1		;Qualifier Flag
	FIELD ETY,6		;Entity Type
	FIELD SEL,9		;Selector
	HWORD BLN		;Buffer Length
	WORD QUA		;Qualifier
	WORD BUF		;Buffer Address or Parameter value
	WORD BPT		;Byte pointer to data
ENDSTR

;Network management Function Codes
	XP NF.ILG,-1		;Illegal Function
	XP NF.SET,0		;Set Parameter
	XP NF.CLR,1		;Clear Parameter
	XP NF.RED,2		;Read Parameter
	XP NF.COU,3		;Show Counters
	XP NF.SZC,4		;Show and Zero Counters
	XP NF.RET,5		;Return list of Entity Ids
	XP NF.A2N,6		;Map Node Address to Name
	XP NF.N2A,7		;Map Node Name to Address
	XP NF.CET,10		;Check Entity
	XP NF.CKL,11		;Check Loopback Node

	NF.MAX==NF.CKL		;Maximum Function code value

;Network Management Interface Error returns

;These error codes are for internal monitor use only
	XP NF.FCS,^D1		;Function completed successfully
	XP NF.NDP,^D0		;No data present

;The following error codes may be returned to the user level
	XP NF.UFO,^D-1		;Unrecognized Function or Option
	XP NF.IMF,^D-2		;Invalid Message Format
	XP NF.PRV,^D-3		;Privilege Violation
	XP NF.MPE,^D-5		;Management Program Error
	XP NF.UPT,^D-6		;Unrecognized Parameter Type
	XP NF.URC,^D-8		;Unrecognized Component
	XP NF.INI,^D-9		;Invalid Identification
	XP NF.CWS,^D-11		;Component in Wrong State
	XP NF.RES,^D-15		;Resource Error
	XP NF.IPV,^D-16		;Invalid Parameter Value
	XP NF.NRM,^D-20		;No room, or slot already taken
	XP NF.PNA,^D-22		;Parameter not applicable
	XP NF.PVL,^D-23		;Parameter value too long
	XP NF.OPF,^D-25		;Operation failure
	XP NF.FNS,^D-26		;Function not supported
	XP NF.IPG,^D-27		;Invalid Parameter grouping
	XP NF.PAM,^D-29		;Parameter missing

	SUBTTL	Network Management -- Event Parameters and Argument blocks

;Event Classes
	XP .NCNML,0		;NETWORK MGMT LAYER
	XP .NCALP,1		;APPLICATION LAYER
	XP .NCSCT,2		;SESSION CONTROL LAYER
	XP .NCNSP,3		;NETWORK SERVICES (NSP) LAYER
	XP .NCRTR,4		;ROUTER LAYER
	XP .NCDLL,5		;DATA LINK LAYER
	XP .NCPLL,6		;PHYSICAL LINK LAYER
;		7-31		;RESERVED FOR COMMON CLASSES
;		32-63		;RESERVED FOR RSTS
;		64-95		;RESERVED FOR RSX
	XP .NCLCG,^D96		;TOPS-10/20 specific events
;		97-127		;RESERVED FOR TOPS-10/20
;		128-159		;RESERVED FOR RT
;		160-479		;RESERVED FOR FUTURE DEC USE
;		480-511		;RESERVED FOR CUSTOMER USE

;Event and signal queue maximum lengths
	XP NMXELN,^D10		;Maximum # of entries in event queue
	XP NMXSLN,^D3		;Maximum # of entries in signal queue

;Event communication block.
;
;The EC block is a communications area between a layer and NTMAN.

BEGSTR EC
	;NTMAN private section
	HWORD LOS		;Count of "events lost"
	HWORD CNT		;Count of events on queue
	FIELD DEL,1		;This EC block marked for deallocation
	FILLER 2

	;Communications area, set by the layer
	FIELD LAY,3		;DECnet layer this EC block belongs to
	HWORD ETY		;Entity type of DECnet device this EC block
				; belongs to
	WORD EID		;Entity ID of DECnet device this EC block
				; belongs to
	HWORD MAX		;Maximum # of events on queue allowed
ENDSTR

;Network event block
;
;A NE block contains all information about an event

BEGSTR NE
	WORD NXT		;Pointer to next NE block on queue
	WORD TIM		;Time of event
	WORD CBK		;Address of callback routine
	WORD ECP		;Pointer to event communications block
	FIELD CCL,13		;Event class
	FIELD CTY,5		;Event type
	HWORD DLN		;Data length in bytes
	HWORD ETP		;Entity type
	WORD EID		;Entity ID
	WORD DAT		;Fullword pointer to data string
ENDSTR

;Filter argument block
;
;Used to pass arguments to the EV.FIL function of NMXEVT

BEGSTR FA			;Filter argument block
	HWORD CCL		;Event class
	HWORD CTY		;Event type
ENDSTR

IFN FTDEBUG <

;For test and debug purposes there is an extra function of the NTMAN jsys.
;This function will log an event or signal.
;
;The function code is -5 (.NTTEV)
	.NTTEV==:-5
;
;The entity ID and type for the event are taken from the standard words in
;the NTMAN argument block.
;
;Word .NTSEL points to a secondary argument block of the following layour
;
	BEGSTR ET
		FIELD SIG,1	;Set if this is a signal
		HWORD CNT	;Replication count
		FIELD CCL,13	;Event class
		FIELD CTY,5	;Event type
		HWORD DLN	;Data length in bytes
		WORD DAT,<44/4>	;Space for data
	ENDSTR
>

	SUBTTL	Test Bed Stuff

;Here are the TRACE and ETRACE symbols.

	XP TRCCOM,1B35		;/TRACE:COM
	XP TRCRTR,1B34		;/TRACE:RTR
	XP TRCNSP,1B33		;/TRACE:NSP
	XP TRCSC,1B32		;/TRACE:SC
	XP TRCUSR,1B31		;/TRACE:USR
	XP TRCNMX,1B30		;/TRACE:NMX

	XP ETRCOM,1B35		;/ETRACE:COM
	XP ETRRTR,1B34		;/ETRACE:RTR
	XP ETRNSP,1B33		;/ETRACE:NSP
	XP ETRSC,1B32		;/ETRACE:SC
	XP ETRUSR,1B31		;/ETRACE:USR
	XP ETRNMX,1B30		;/ETRACE:NMX

;This is a macro for generating traces about things.

DEFINE	TRACE(PREFIX,TEXT),<
  IFN FTTRACE,<
	EXT <S.TRAC,.TSTRG>
	CALL [SAVEAC <T1,T2,T3,T4> ;;YES, SAVE SOME AC'S
	      HRRZ T1,S.TRAC	;;GET THE TRACE SWITCH
	      TXNN T1,TRC'PREFIX ;;IF HE WANTS IT, GIVE IT TO HIM
	      RET		;;RETURN TO SENDER
	      MOVEI T1,[ASCIZ/['PREFIX: 'TEXT]
/] 				;;SET UP FOR SCAN .TSTRG
	      CALLSCAN .TSTRG	;;CALL HIM
	      RET]		;; AND RETURN
  >;END OF IFN FTTRACE
>

DEFINE	ETRACE(PREFIX,TEXT),<
  IFN FTTRACE,<
	EXT <S.ETRA,.TSTRG>
	CALL [SAVEAC <T1,T2,T3,T4> ;;YES, SAVE SOME AC'S
	      HRRZ T1,S.ETRA	;;GET THE TRACE SWITCH
	      TXNN T1,ETR'PREFIX ;;IF HE WANTS IT, GIVE IT TO HIM
	      RET		;;RETURN TO SENDER
	      MOVEI T1,[ASCIZ/['PREFIX: 'TEXT]
/] 				;;SET UP FOR SCAN .TSTRG
	      CALLSCAN .TSTRG	;;CALL HIM
	      RET]		;; AND RETURN
  >;END OF IFN FTTRACE
>
	SUBTTL  FIXADJ Macro - Compensate for bug in negative ADJBP

;This macro should be removed if and when the KL microcode is fixed to
;handle byte pointers that have a 777777 in the right half and an index
;AC that points to the first address in a section.  Such a byte pointer
;might be generated by backing up a byte pointer with an ADJBP instruction.

;For example, if the byte pointer is 41006,,777777 and AC 6 contains 10,,0
;the effective address calculation computes an address of 7,777777.  If it
;is the case that section 7 is not mapped a page fault will result even if
;the instruction is an ILDB wishing to get its byte from 10,,0.  This macro
;will change the byte pointer from 410xx,,-1 to 4410xx,,0.

DEFINE FIXADJ (ac),<
	TLNE ac,700000		;Is it 0410xx,,xxx?
	IFSKP.
	  TLO ac,400000		;Yes, make it 4410xx,,xxx
	  HRRI ac,1(ac)		;Non-carrying add to RH, TLO just made IFIW!
	ENDIF.
>

IFN FTOPS20,<
DEFINE TSTS6 <>

;;Hack in test section 6
;DEFINE TSTS6 <
;  IF2,<IFNDEF $TSTS6,<EXTERNAL $TSTS6>>
;	JSP CX,$TSTS6
;>
> ;END IFN FTOPS20

IFN FTOPS10,<
	SUBTTL	LOBOTOMIZED definitions of things for TOPS-10

;
;Definition of PSECT numbers.  These are not used on TOPS-10
;
	PSWAPCD==0
	PRESCD==0
	PXSWAPCD==0
	PXRESCD==0
	CURPSX==0

	XCDSEC==(MS.HGH)	;TOPS-10 uses only section MS.HGH for code

;
;Definition of XTENDed section stuff
;
	DEFINE XADDR.($ADDR),<XCDSEC,,$ADDR>
	DEFINE XRESCD,<$PSECT(SKY)>
	DEFINE XSWAPCD,<$PSECT(SKY)>
	DEFINE TSTS6,<>

;Definitions for extended code

;Transfer to RESCD
DEFINE TORESCD (%LBL) <
IFN FTXMON,<
	XJRST .+1
	XWD MSEC1,%LBL
	RESCD
%LBL:!
>; FTXMON
>

;Transfer to SWAPCD
DEFINE TOSWAPCD (%LBL) <
IFN FTXMON,<
	XJRST .+1
	XWD MSEC1,%LBL
	SWAPCD
%LBL:!
>; FTXMON
>

;Transfer to extended resident code
DEFINE TOXRESCD (%LBL) <
IFN FTXMON,<
	XJRST .+1
	%LBL
	XRESCD
%LBL:!
>; FTXMON
>

;Transfer to extended swappable code
DEFINE TOXSWAPCD (%LBL) <
IFN FTXMON,<
	XJRST .+1
	%LBL
	XSWAPCD
%LBL:!
>; FTXMON
>

;Define an entry point in extended resident code
DEFINE XRENT ($NAME,G) <
	RESCD
IFB <G>,<$NAME: XCALLRET (,X'$NAME)>
IFNB <G>,<$NAME:: XCALLRET (,X'$NAME)>
	XRESCD
X'$NAME:
.IF $NAME,INTERNAL,<INTERNAL X'$NAME>
>

;Define an entry point in extended swappable code
DEFINE XNENT ($NAME,G) <
	SWAPCD
IFB <G>,<$NAME: XCALLRET (,X'$NAME)>
IFNB <G>,<$NAME:: XCALLRET (,X'$NAME)>
	XSWAPCD
X'$NAME:
.IF $NAME,INTERNAL,<INTERNAL X'$NAME>
>

;Call a monitor subroutine in specific context/section
DEFINE MCALL ($CTX, $SECNR, $ADDR) <
IFE FTXMON,<
    IFB  <$CTX>,<CALL $ADDR>
    IFNB <$CTX>,<
	IFDIF <$CTX><RG>,<IFDIF <$CTX><DN>,<PRINTX ?Illegal context $CTX>>
	IFIDN <$CTX><RG>,<RGCALL $ADDR>
	IFIDN <$CTX><DN>,<DNCALL $ADDR>
    >; END IFNB <$CTX>
>; END IFE FTXMON
IFN FTXMON,<
    IFB  <$SECNR>,<CALL $ADDR>
    IFNB <$SECNR>,<SNCALL ($ADDR, <$SECNR>B17)>
>; END IFN FTXMON
>; END DEFINE MCALL

;Call a subroutine in another section from any non-zero section
DEFINE CALLX ($SECNR, $ADDR) <
	IFB <$SECNR>,<CALL @[$ADDR]>
	IFNB <$SECNR>,<CALL @[$SECNR,,$ADDR]>
>

;Call a subroutine in another section from MSEC1
DEFINE XCALL ($SECNR, $ADDR) <
	SE1ENT
	IFB <$SECNR>,<CALL @[$ADDR]>
	IFNB <$SECNR>,<CALL @[$SECNR,,$ADDR]>
>

;JSP to another section
DEFINE XJSP (AC, $SECNR, $ADDR) <
	SE1ENT
	IFB <$SECNR>,<JSP AC,@[$ADDR]>
	IFNB <$SECNR>,<JSP AC,@[$SECNR,,$ADDR]>
>

;CALLRET to another section
DEFINE XCALLRET ($SECNR, $ADDR) <
	SE1ENT
	IFB <$SECNR>,<XJRST [$ADDR]>
	IFNB <$SECNR>,<XJRST [$SECNR,,$ADDR]>
>

;Execute one or more instructions in section 1
DEFINE S1XCT (A) <
	TORESCD
	A
	TOXRESCD
>
> ;END IFN FTOPS10
	SUBTTL	End of D36PAR

	END