Google
 

Trailing-Edge - PDP-10 Archives - PCL_FOR_701 - comnet.mac
There are 6 other files named comnet.mac in the archive. Click here to see a list.
TITLE COMNET - COMMON COMMUNICATION AREA FOR NETWORKS - V136
SUBTTL	D. TODD/EJW/JBS/EGF		25 JUL 80
	SEARCH F,S,NETPRM
	$RELOC
	$HIGH



;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
; COPYRIGHT (C) 1974,1975,1976,1977,1978,1979,1980 BY DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
XP	VCOMNET,136	;PUT VERSION NUMBER IN GLOB AND LOADER MAP

COMNET::ENTRY	COMNET		;LOAD IF IN LIBRARY SEARCH MODE

;"NORMALIZE" CERTIAN MONGEN PARAMETERS.

IFNDEF M.TTDN,<M.TTDN==:0>
IFNDEF M.XTL,<M.XTL==:0>
XP M.TLTL,M.TLTL+M.TTDN		;REDEFINE FOR RSX-20F LINES
XP M.TLTL,M.TLTL+M.XTL		;REDEFINE FOR XTC LINES
IFN M.KS10,<
XP	KLILIN,M.TLTL+M.RMCR	;LINE NO. FOR KS10 KLINIK
XP	M.TLTL,M.TLTL+1		;ADD ONE FOR KLINIK LINE
>

IFNDEF M.DLP,<XP M.DLP,0>	;DEFINE NUMBER OF -20F LINE PRINTERS
IFNDEF M.DCR,<XP M.DCR,0>	;DEFINE NUMBER OF -20F CARD READERS

;COUNT NUMBER OF VARIOUS TYPES OF TAPE DRIVES (FOR CONFIG INFO)
DEFINE TDMAC(X),<		;;HELPER MACRO
  XP	DT'X'N,M.DT'X
  M.DTXN==M.DTXN+M.DT'X
>;TDMAC

ZZ=="A"
M.DTXN==0
REPEAT M.TD10,<
  TDMAC(\"ZZ)
ZZ==ZZ+1
>

IFNDEF M.TM10,<XP M.TM10,0>
IFNDEF M.TC10,<XP M.TC10,0>
IFNDEF M.TX01,<XP M.TX01,0>
IFNDEF M.TM02,<XP M.TM02,0>
IFNDEF M.DX20,<XP M.DX20,0>
XP TAPN,M.TM10+M.TC10+M.TX01+M.TM02+M.DX20+M.TM78

DEFINE	MTXADD(CHN)<
IFDEF M.MT'CHN,<MTXN==MTXN+M.MT'CHN>>

MTXN==0
ZZ==-1
REPEAT	TAPN,<MTXADD(\<ZZ==ZZ+1>)>

IFN FTKL10,<			;ON A KL WE NEED TO MAKE M.D87S RIGHT
	DEFINE	X(Y),<		;;DEFINE A HELPER MACRO
IFNDEF	M'Y'D87S,<M'Y'D87S==0>
	M.D87S==M.D87S+M'Y'D87S	;;COUNT ANOTHER DN87S
	>
M.D87S==0			;START OFF WITH NO DN87S'S
ZZ==0	
REPEAT	M.CPU,<			;FOR ALL CPU'S
	X \ZZ			;COUNT IT'S DN87S'S
	ZZ==ZZ+1		;BUMP OUR INDEX
>				;AND COUNT THEM ALL
	PURGE	X,ZZ		;CLEAN UP
>;END FTKL10
;SEE IF THE USER WANTED ANY NETWORKS AT ALL.

IFN M.NET,<
 IFE FTNET,<
    PRINTX	FTNET MUST BE ASSEMBLED AS FTNET==-1 FOR NETWORKS
    M.NET==0			;FORCE NETWORKS OFF (DON'T LOAD NETSER)
  >
>;M.NET

IFE M.NET,<		;IF NO NETWORKS, FIXUP VARIOUS SYMBOL DEFS

NTLCKJ==:CPOPJ##	;IF NO NETWORKS, THEN NO INTERLOCKS
NTCHCK==:CPOPJ##	;  SO JUST MAKE THE INTERLOCK MANAGEMENT
NTLERR==:CPOPJ##	;  ROUTINES BE POPJS
NETSEC==:CPOPJ##	;NO ONCE/SECOND STUFF
NTDSTP==:CPOPJ##	;NO NETWORK STOP-CODES
CLRTTY==:CPOPJ##	;NO NETWORK LDB'S TO CLEAR
NTDIDA==:CPOPJ##	;NEVER TELL MSGSER THAT INPUT'S AVAILABLE
SCNMCR==:CPOPJ1##	;SCNSER WILL NOT ECHO CHARACTERS ON NETWORK LINES
NETOPR==:CPOPJ1##	;WE DON'T NEED TO WORRY ABOUT WHICH REMOTE IS OPR
FEKINT==:CPOPJ##	;NO NETSER INTERRUPT ROUTINES
NODE.S==:CPOPJ##
VTMREC==:CPOPJ##	;NO NETWORK VIRTUAL TERMINALS
VTMDSO==:CPOPJ##	;  AND HENCE NO NETWORK VIRTUAL TERMINAL
VTMDSF==:CPOPJ##	;  MODEM CONTROL.
VTMENQ==:CPOPJ##	;  AND NO VTM QUEUE
VTMPRL==:CPOPJ##	;  AND NO PTY RELEASE CODE

NDBTBL==:0		;NO NETWORK GETTABS
NDBMXL==:0
NDBSNM==:0
TSK.==:CPOPJ##		;NO TSK. UUO
KDP.==:CPOPJ##		;NO KDP. UUO
KDPONC==:CPOPJ##	;NO D8KINT
KDPLDR==:CPOPJ##	;NO KDPLDR

TSTRDX==:CPOPJ##	;NO RDX DEVICES
TSTTSK==:CPOPJ##	;NO TSK DEVICES

NETCHN==:0		;NO NETWORK PI-CHANNELS TO TURN
NTFCHN==:0		;  ON AND OFF

BRKFEK==:CPOPJ##	;WE DON'T NEED TO CRASH FEK'S WHEN A CPU GOES DOWN
FEKCPS==:CPOPJ##	;DON'T CRASH FEKS
FEKCPW==:CPOPJ##	;DON'T RESTART FEK'S IF NO NETWORKS

	END		;OF COMNET
>;M.NET


	EXTERN	NETSER	;FORCE LOADING OF NETSER
;CHECK OPTIONS FOR NETWORK DEVICES THAT HAVE THEIR OWN FEATURE TESTS.
;  IF DEVICE NOT LOADED, DEFINE APPROIATE "DUMMY" SYMBOLS TO SATISFY LINK

;CHECK TSKSER'S PARAMETERS
IFE FTTSK,<
  IFN M.RJOB,<
    IF1,<
      PRINTX ? Remote tasks will not work with FTTSK = 0.
      PRINTX ? Remote task code will not be loaded in this monitor.
    >;IF1
  >;M.RJOB
  XP M.RJOB,0			;REMOVE REMOTE PROCESSES
>;FTTSK

;DEFINE DUMMY SYMBOLS FOR TSKSER
IFE M.RJOB,<
	TSK.==:CPOPJ##		;TSK. UUO WILL GIVE "TSKSER NOT LOADED" ERROR
	TSTTSK==:CPOPJ##	;TSTTSK NEVER FINDS A TASK
	TSKSEC==:CPOPJ##	;NO ONCE/SECOND TSK PROCESSING
>

;CHECK RDXSER'S PARAMETERS
IFE FTRDX,<
  IFN M.RDX,<
    IF1,<
      PRINTX ? Remote data entry will not work with FTRDX = 0.
      PRINTX ? Remote data entry will not be included in this monitor.
    >;IF1
  >;M.RDX
  XP M.RDX,0			;NO REMOTE DATA ENTRY SERVICE
>;FTRDX

;DEFINE DUMMY SYMBOLS FOR RDXSER.
IFE M.RDX,<
	TSTRDX==:CPOPJ##	;TSTRDX NEVER FINDS ONE
>


;CHECK PARAMETERS FOR KMC/DUP-11 SYNCHRONOUS LINE UNITS
IFE FTKS10,<			;KMC/DUP CURRENTLY ONLY VALID ON KS-10'S
  IFN M.KDUP,<
    IF1,<
      PRINTX ? KMC/DUP-11 will only work on a KS-10 processor.
      PRINTX ? KMC/DUP-11 support will not be included in this monitor.
    >;IF1
  >;M.KDUP
  XP M.KDUP,0			;FORCE KMC/DUP-11 LINES OFF
>;FTKS10

IFE M.KDUP,<			;IF NO KMC/DUP-11'S
	KDPONC==:CPOPJ##	;NO-OP THE INITIALIZATION CODE
	KDP.==:CPOPJ##		;MAKE THE KDP. UUO GIVE "NOT IMPLEMENTED" RTN
	KDPLDR==:CPOPJ##
>
				COMMENT @

			    PCBMRK and PCBCHK

     These routines are used to manage the transfer of PCB's to and from
Front End Kontrollers in a Multi-Cpu, or Cached environment.  The protocol
for using these two routines is as follows.

   PCBMRK	This routine should be called after the PCB is altered by
		the -10.  In a cached environment, it stores the Cache Sweep
		Serial number so that PCBCHK can tell if cache needs to be
		swept at a later date.  On a non-cached, or multi-cpu machine
		(free core is not cached on a SMP system) this routine is a
		no-op.

   PCBCHK	This routine should be called with J := FEK address, and
		U := PCB address.  It should be immediatly before either
		"FEKRDD" or "FEKWRT" is executed.  If it skips, then that
		implies that the FEK may access the data.  If it does not
		skip, then either the FEK is on the wrong CPU, or the data
		is still in cache, and may not be accessed by the FEK.

				    @

IFN FTKL10,<			;THINGS ARE MESSY FOR KL'S
PCBMRK::CONSO	APR,LP.CSB+LP.CSD ;IF THE CACHE IS ALREADY SWEEPING (BUSY)
	TDZA	T1,T1		;  THEN IT MAY HAVE MISSED SOME OF THE PCB
	MOVEI	T1,1		;  IF SO, ADD ONE TO THE SWEEP SERIAL NUMBER
	ADD	T1,.CPCSN##	;GET SWEEP SERIAL NUMBER (MAYBE PLUS ONE)
	MOVEM	T1,PCBCSN(U)	;SAVE IT FOR PCBCHK TO LOOK AT
	POPJ	P,		;EXIT WITH THE PCB MARKED

PCBCHK::
IFG <M.CPU-1>,<			;IF SINGLE, THEN FREECORE ALWAYS CASHED

PCBCK1:	PUSHJ	P,MLSCSH##	;SEE IF FRECOR IS CACHED
	  POPJ	P,		;  RETURN NOW. (NO SWEEP PROBLEMS)

>;END <M.CPU-1>			;END OF SMP ONLY CHECKS

	MOVE	T1,.CPCSN##	;GET THE CURRENT CSSN
	CAMG	T1,PCBCSN(U)	; SEE IF WE'VE SWEPT SINCE LAST ACCESS TO PCB
	PUSHJ	P,CSDMP##	;IF NOT, SWEEP NOW.  (TOO SLOW TO WAIT)
	POPJ	P,		;WE'VE SWEPT, GIVE GOOD RETURN

>;END FTKL10
	SUBTTL	BRKFEK -- CRASH FEK'S WHEN OWNING CPU GOES DOWN

IFN M.CPU-1,<		;ONLY ASSEMBLE IF MORE THAN 1 CPU

;BRKFEK	ROUTINE CALLED FROM CPNSER WHEN A CPU HAS CRASHED.  THIS
;  ROUTINE TELLS NETSER WHICH FRONT ENDS HAVE BECOME INACCESSABLE DUE
;  TO THE CPU GOING DOWN
;CALL	T1 := POINTER TO THE CDB OF THE CRASHED CPU.
;PRESERVES ALL ACS.

BRKFEK::PUSHJ	P,SAVT##	;PRESERVE THE T'S
	MOVSI	T2,FK.CPD	;FLAG THAT SAYS "THIS FEK'S CPU DIED"
	SKIPA	T3,[FEKFST##]	;GET ADDRESS OF THE FIRST FEK.
BRKFE1:	HRRZ	T3,FEKBLK(T3)	;GET THE ADDRESS OF THE NEXT FEK.
	JUMPE	T3,CPOPJ##	;ZERO ADDRESS MEANS WEVE DONE THEM ALL
	HLRE	T4,FEKUNI(T3)	;GET THE CPU NUMBER OF THIS FEKS CPU
	CAME	T4,.CPCPN##-.CPCDB##(T1) ;SEE IF THIS IS THE CPU THAT DIED
	JRST	BRKFE1		;NO
	AOS	.CPNBI##-.CPCDB##(T1) ;COUNT THE BROKEN INTERLOCK
	IORM	T2,FEKBLK(T3)	;IF ON JUST-DEAD CPU, SET BIT FOR 1/SECOND
	JRST	BRKFE1		;GO CHECK THE NEXT FEK.
>

IFLE M.CPU-1,<BRKFEK==:CPOPJ##>	;NOT NECESSARY ON SINGLE CPU SYSTEMS
	SUBTTL	FEKCPS / FEKCPW - FEK ROUTINES FOR SYSTEM SLEEP

;FEKCPS	ROUTINE TO CALL ALL FEK'S ON THIS CPU ON THEIR FF.CPS ENTRY
;CALL	PUSHJ	P,FEKCPS
;RETURN	CPOPJ			;CLOBBERS NO REGISTERS

FEKCPS::PUSHJ	P,SAVE1##	;SAVE P1
	MOVEI	P1,FF.CPS	;GET THE "CPU SLEEP" BIT
	JRST	FEKCPC		; AND GO TO COMMON CODE TO CALL THE FEKS

;FEKCPW	ROUTINE TO CALL ALL FEK'S ON THEIR FF.CPW ENTRY
;CALL	PUSHJ	P,FEKCPW
;RETURN	CPOPJ			;CLOBBERS NO REGISTERS

FEKCPW::PUSHJ	P,SAVE1##	;SAVE P1
	MOVEI	P1,FF.CPW	;GET THE "CPU WAKING UP" FUNCTION CODE
;	PJRST	FEKCPC		;GO TO COMMON CODE

;CODE TO CALL ALL FEKS ON THIS CPU WITH THE FUNCTION CODE IN "P1"
FEKCPC:	PUSHJ	P,SAVT##	;SAVE ALL THE TEMPS (FOR SPRINI)
	PUSH	P,U		;  AS WELL AS
	PUSH	P,F		;  SUNDRY OTHER
	PUSH	P,W		;  REGISTERS
	PUSH	P,J		;  ..
	MOVEI	J,FEKFST##	;START WITH THE FIRST FEK
	JUMPE	J,FEKCP2	;  IF NONE AT ALL, WE'RE DONE
FEKCP1:	MOVE	T1,P1		;GET THE FUNCTION CODE
IFN FTMP,<
	HLRZ	T2,FEKUNI(J)	;GET THE CPU THIS FEK IS ON
	CAMN	T2,.CPCPN##	;  AND IF WE ARE ON THE RIGHT ONE.
>
	XCT	FEKDSP(J)	;CALL THE FEK
	HRRZ	J,FEKBLK(J)	;GET THE NEXT FEK
	JUMPN	J,FEKCP1	;  AND CALL HIM TOO.
FEKCP2:	POP	P,J		;RESTORE ALL
	POP	P,W		;  THESE REGISTERS
	JRST	FUPOPJ##	;AND WE'RE DONE
SUBTTL NETDDB DISPATCH TABLE
	JSP	T4,DSPOBJ	;(-5) ON LINE CHECK
	POPJ	P,0		;DEVOP.UUO
	JSP	T4,DSPOBJ	;(-3) RETURN BUFFER SIZE
	POPJ	P,		;(-2) DEVICE INITIALIZATION
	JSP	T4,DSPOBJ	;(-1) HUNG DEVICE
NETDSP::JSP	T4,DSPOBJ	;(0)  RELEASE DEVICE
	JSP	T4,DSPOBJ	;(1)  CLOSE
	JSP	T4,DSPOBJ	;(2)  OUTPUT
	JSP	T4,DSPOBJ	;(3)  INPUT
	JSP	T4,DSPOBJ	;(4)  ENTER
	JSP	T4,DSPOBJ	;(5)  LOOKUP
	JSP	T4,DSPOBJ	;(6)  DUMP MODE OUTPUT
	JSP	T4,DSPOBJ	;(7)  DUMP MODE INPUT
	JSP	T4,DSPOBJ	;(10) USETO
	JSP	T4,DSPOBJ	;(11) USETI
	JSP	T4,DSPOBJ	;(12) UGETF UUO
	JSP	T4,DSPOBJ	;(13) RENAME UUO
	JSP	T4,DSPOBJ	;(14) CLOSE INPUT
	JSP	T4,DSPOBJ	;(15) UTPCLR UUO
	JSP	T4,DSPOBJ	;(16) MTAPE UUO

;DISPATCH ON THE OBJECT TYPE
DSPOBJ:	SUBI	T4,NETDSP+1	;RELOCATE THE ENTRY
	HRRES	T4		;MAKE IT A FULL WORD NUMBER
	MOVSI	T1,DVCNET	;GET THE NETWORK DEVICE BIT
	TDNN	T1,DEVCHR(F)	;IS THIS A NETWORK DEVICE?
	STOPCD	CPOPJ##,DEBUG,DFU,;++DEVICE UNRECONIZED
	JUMPL	T4,DSPOB1	;DON'T INTERLOCK HUNG DEVICE CHECK ETC.
				; (THEY COME IN AT LEVEL #7)
	NETDBJ			;NETSER INTERLOCK FROM HERE ON..
DSPOB1:
	HLRZ	W,DEVNET(F)	;GET THE NDT POINTER
	LDB	T1,NDTOBJ	;GET THE -11 DEVICE TYPE
	ROT	T1,-1		;DIVIDE BY 2
	HLRZ	T2,OBJDSP(T1)	;GET THE EVEN ENTRY
	SKIPGE	T1		;WAS IT EVEN?
	HRRZ	T2,OBJDSP(T1)	;NO, GET THE ODD ENTRY
	JUMPE	T2,CPOPJ##	;NOT IMPLEMENTED
	ADDI	T4,(T2)		;POINT TO THE DISPATCH ENTRY
	PJRST	(T4)		;GO TO DEVICE DEPENDENT ROUTINE
IF2,<IFNDEF NDEVTT,<NDEVTT==0>>	;IF ROUTINE NOT LOADED
IF2,<IFNDEF NDEVTY,<NDEVTY==0>>	;IF ROUTINE NOT LOADED
IF2,<IFNDEF NDEVCD,<NDEVCD==0>>	;IF ROUTINE NOT LOADED
IF2,<IFNDEF NDEVLP,<NDEVLP==0>>	;IF ROUTINE NOT LOADED
IF2,<IFNDEF NDEVPR,<NDEVPR==0>>	;IF ROUTINE NOT LOADED
IF2,<IFNDEF NDEVPP,<NDEVPP==0>>	;IF ROUTINE NOT LOADED
IF2,<IFNDEF NDEVPL,<NDEVPL==0>>	;IF ROUTINE NOT LOADED
IF2,<IFNDEF NDEVMT,<NDEVMT==0>>	;IF ROUTINE NOT LOADED
IF2,<IFNDEF NDEVDT,<NDEVDT==0>>	;IF ROUTINE NOT LOADED
IF2,<IFNDEF NDEVTS,<NDEVTS==0>>	;IF ROUTINE NOT LOADED
IF2,<IFNDEF NDEVRX,<NDEVRX==0>>	;IF ROUTINE NOT LOADED
OBJDSP:				;NETWORK SUPPORTED DEVICE TABLE
	XWD	NDEVTT,NDEVTY	;(0)MCR CTL	(1)TERMINAL USER
	XWD	NDEVCD,NDEVLP	;(2)CARD READER	(3)LINE PRINTER
	XWD	NDEVPR,NDEVPP	;(4)PAPER READ	(5)PAPER TAPE PUNCH
	XWD	NDEVPL,NDEVMT	;(6)PLOTTER	(7)MAG TAPE
	XWD	NDEVDT,NDEVTS	;(10)DECTAPE	(11)TASK(JOB)
	XWD	NDEVRX,0	;(12)RMT DATA	(13)0
SUBTTL NETDDB PROTOTYPE DEVICE DATA BLOCK FOR NETWORKS

DEFINE X(OFFSET,EXPR)<		;MACRO TO SET SELECTED LOCATIONS IN THE BLOCK
	RELOC NETDDB+OFFSET	;GO TO THE RIGHT WORD
	EXPR			;ASSEMBLE IN THE EXPRESSION
>

	$LOW

NETDDB::
	X	DEVCHR,<XWD <6*HUNGST>+DVC2IO,0>
	X	DEVSER,<XWD 0,NETDSP>	;DEFINE NETWORK DISPATCH VECTOR
	X	DEVSTA,<XWD DEPLEN,DEPEVM> ;VARIABLE LENGTH BUFFERS, NO EVM
	X	DEVCPU,<EXP 707B8>	;SET DEYPCL SO WILL RUN ON ANY CPU.
	X	NETLEN,0	;RESERVE ENOUGH SPACE FOR ENTIRE DDB

	PURGE	X		;FLUSH THE MACRO

	$HIGH
SUBTTL NETNDB -- PROTOTYPE NODE DATA BLOCK

DEFINE X(OFFSET,EXPR)<		;MACRO TO SET SELECTED LOCATIONS IN THE BLOCK
	RELOC NETNDB+OFFSET	;GO TO THE RIGHT WORD
	EXPR			;ASSEMBLE IN THE EXPRESSION
>

	$LOW
NETNDB::
	X	NDBNNM,<XWD OURNNM,0>	;SET OUR NODE-NUMBER
	X	NDBSID,<XWD SYSDAT##,CONFIG##>	;CREATION DATE,LONG-NAME
	X	NDBSNM,<XWD STANAM,0>	;6 CHAR STATION NAME
	X	NDBFLG,<XWD NDB.UP,0>	;MAKE SURE WE DON'T TRY A STARTUP SEQ
	X	NDBFEK,<XWD 0,NL0FEK##>	;POINT TO OUR "NULL" FEK (CPU 0)
	X	NDBMOM,<EXP 10>	;MAXIMUM OF 10 OUTSTANDING MSGS
	X	NDBDEV,<BYTE	(9)1,M.TLTL,M.CDR+M.DCR,M.LPT+M.DLP,M.PTR,M.PTP,M.PLT,MTXN,M.DTXN,M.RJOB,0,M.CDP>
	X	NDBLEN,0	;RESERVE ENOUGH SPACE FOR THE ENTIRE NDB

	PURGE	X		;FLUSH THE MACRO

	$HIGH
SUBTTL BP -- NETWORK DEPENDANT BYTE POINTERS

;BYTE POINTERS INTO NETWORK DDB'S (INDEXED BY "F")

NETRSN::EXP	NT%RSN		;REASON BYTE
NETSLA::EXP	NT%SLA		;SOURCE LINK ADDRESS
NETDLA::EXP	NT%DLA		;DESTINATION LINK ADDRESS
NETRLN::EXP	NT%RLN		;LOGICAL RECORD LENGTH
NETDVT::EXP	NT%DVT		;DEVICE ATTRIBUTE BITS (SEE NETPRM)



;BYTE POINTERS INTO PCB'S.  INDEXED BY "U"

PCBPCV::EXP	PC%PCV		;CONVERSION TYPE
PCBMSN::EXP	PC%MSN		;MESSAGE NUMBER



;BYTE POINTERS INTO NDB'S (GETTAB TABLE .GTNDB==161)

NDBTBL::EXP	NDBLEN		;(00) LENGTH OF NDB
	EXP	NB%NXT		;(01) ADDRESS OF NEXT NDB
	EXP	NB%NNM		;(02) NODE NUMBER
	EXP	NB%SNM		;(03) ADDRESS OF STATION NAME
NDBTIM::EXP	NB%TIM		;(04) TIMER. 
	EXP	NB%NGH		;(05) FIRST NEIGHBOR ENTRY
	EXP	NB%NGL		;(06) LAST NEIGHBOR ENTRY
	EXP	NB%NGN		;(07) NODE NUMBER FROM NB%NGH
	EXP	NB%OPR		;(10) ADDRESS OF OPR LDB
	EXP	NB%CTJ		;(11) JOB NUMBER OF STATION CTL
				;	OUTPUT MESSAGE NUMBERS
NDBLAR::EXP	NB%LAR		;(12) LAST ACK RECEIVED
NDBLAP::EXP	NB%LAP		;(13) LAST OUTPUT MESSAGE# ACK'ED
NDBLMS::EXP	NB%LMS		;(14) LAST MESSAGE SENT
NDBLMA::EXP	NB%LMA		;(15) LAST MESSAGE NUMBER ASSIGNED
NDBLAS::EXP	NB%LAS		;(16) LAST ACK SENT
				;	INPUT MESSAGE NUMBERS
NDBLMR::EXP	NB%LMR		;(17) LAST INPUT MESSAGE RECEIVED
NDBLMP::EXP	NB%LMP		;(20) LAST MESSAGE PROCESSED

	NDBMXL==:<.-NDBTBL-1>_^D9 ;LENGTH OF NDB POINTERS TABLE (GETTAB)
;POINTERS INTO A NETWORK DEVICE TABLE

NDTTYP::EXP	ND%TYP		;-10 DEVTYP BYTE
NDTBFZ::EXP	ND%BFZ		;-10 BUFFER SIZE
NDTSPL::EXP	ND%SPL		;-10 SPOOL BITS
NDTDVT::EXP	ND%DVT		;-11 DEVICE ATTRIBUTES
NDTOBJ::EXP	ND%OBJ		;-11 DEVICE TYPE CODE
NDTDCM::EXP	ND%DCM		;NETWORK DEVICE MODES


;POINTER TO THE "STATE" FIELD OF A LAT ENTRY (INDEXED BY T1)

LATSTA::LT%STA	NETLAT(T1)	;POINT TO THE "STATE" FIELD OF A LAT ENTRY

;POINTERS INTO THE KMC/DUP LINE BLOCKS

IFN M.KDUP,<			;ONLY DEFINE THESE IF KMC/DUP-11S EXIST

KDLSTA::EXP	KD%STA		;THE KDL LINE STATE VARIABLE
KDLTIM::EXP	KD%TIM		;THE KDL DDCMP TIMER
KDLXNK::EXP	KD%XNK		;POINTER TO THE NAK CODE TO BE TRANSMITTED
KDLRMN::EXP	KD%RMN		;POINTER TO THE RECEIVE MESSAGE COUNTER
KDLLMX::EXP	KD%LMX		;POINTER TO LAST MESSAGE NUMBER ASSIGNED
KDLLMA::EXP	KD%LMA		;POINTER TO LAST MESSAGE ACKED
KDLRPC::EXP	KD%RPC		;POINTER TO THE REP COUNTER
>;M.KDUP
SUBTTL NDT -- NETWORK DEVICE TABLE DEFINITIONS
	DEFINE NDT(XDEV,XIDEV,BUFSZ,CHR,DCM,DVT,SPL)<
	ZZ.==ZZ.+1
	BYTE	(18)<(SIXBIT /XDEV/)>,<(SIXBIT /XIDEV/)>
	XWD	CHR,XDEV'MOD
	BYTE	(10)DCM(8)OBJ.'XIDEV(2)0(16)DVT
	BYTE	(6)<.TY'XDEV/.TYEST>(12)BUFSZ(8)SPL(10)0
	Z	@'XDEV'NDP##(T1)
>
	ZZ.==0				;COUNT THE NDT'S

IFG M.RMCR,<EXTERNAL NETMCR>
IFG M.RVTM,<EXTERNAL NETVTM>
IFLE M.RVTM,<
VTMREC::
VTMJIF::
VTMENQ::
VTMHST::
VTMDSF::
VTMDSO::
VTMPRL::
REPEAT 5,<POPJ P,>
VTMNDP::
REPEAT 5,<POPJ P,>
>
NDTTBL=:.			;START OF NDT TABLE
IFG M.RLPT,<			;IF LINE PRINTER SUPPORT REQUESTED
  EXTERNAL NDEVLP,NETLPT	;LOAD LINE PRINTERS
  LPTMOD==1_A+1_AL+1_I		;LEGAL -10 MODES
  NDT(LPT,LP,33,<DVOUT!DVLPT>,<DCM.CP!DCM.AS>,0,.SPLPT) ;BUILD THE NDT
>

IFG M.RCDR,<			;IF CARD READER SUPPORT REQUESTED
  EXTERNAL NDEVCD,NETCDR	;LOAD CARD CODE, GET DISPATCH TABLE ADDR
  CDRMOD==1_A+1_AL+1_I+1_IB+1_B	;LEGAL MODES FOR CDR'S
  NDT(CDR,CD,34,<DVIN!DVCDR>,<DCM.DI>,0,.SPCDR)	;BUILD THE CDR NDT
>

IFG M.RPTR,<			;IF TAPE READERS REQUESTED
  EXTERNAL NDEVPR,NETPTR	;LOAD CODE
  PTRMOD==1_B+1_AL+1_I+1_IB+1_A
  NDT(PTR,PR,41,<DVIN!DVPTR>,<DCM.AS!DCM.IM>,0,.SPPTR)	;BUILD NDT
>

IFG M.RPTP,<			;IF TAPE PUNCHES REQUESTED
  EXTERNAL NDEVPP,NETPTP	;LOAD CODE
  PTPMOD==1_B+1_AL+1_I+1_IB+1_A
  NDT(PTP,PP,41,<DVOUT!DVPTP>,<DCM.AS!DCM.IM>,0,.SPPTP) ;BUILD NDT

>

IFG M.RPLT,<			;IF PLOTTERS REQUESTED
  EXTERNAL NDEVPL,NETPLT	;LOAD CODE
  PLTMOD==1_B+1_AL+1_I+1_IB+1_A
  NDT(PLT,PL,41,<DVOUT>,<DCM.AS!DCM.IM>,0,.SPPLT) ;BUILD NDT

>

IFG M.RJOB,<			;IF TASK'S REQUESTED
  EXTERNAL NDEVTS,NETTSK	;LOAD TSKSER
  TSKMOD==1_B+1_I+1_IB+1_A+1_AL+1_BYTMOD
  NDT(TSK,TK,101,<DVIN!DVOUT!DVLNG!DVDIR>,<DCM.AS!DCM.IM>,0,0) ;BUILD NDT
>

IFN M.RDX,<			;IF REMOTE DATA ENTRY TERMINALS REQUESTED
  EXTERNAL NDEVRX,NETRDX	;LOAD RDXSER
  RDAMOD==1_BYTMOD+1_PIMMOD+1_A+1_AL
  NDT(RDA,RD,101,<DVIN!DVOUT>,<DCM.AS>,0,0)
>

NDTPTR::XWD	-ZZ.,NDTTBL	;POINTER TO SEARCH THE NDT TABLE
SUBTTL OBJTAB -- TABLES INDEXED BY OBJECT TYPE

;NOW MAKE A TABLE INDEXED BY OBJECT TYPE.  THE FORMAT OF THIS TABLE IS:
;	BYTE (12)0 (6)TYPE (18)SIXBIT/NAME/
;
	DEFINE X(A,B,C)<	;;MACRO CALLED TY OBJTYP
	XWD	C,SIXBIT /   A/	;;MAKE THE ENTRY
>
OBJTAB::OBJTYP			;MAKE DEVICE DESCRIPTORS


;A BYTE POINTER TO THE TYPE FIELD IN OBJTAB.

	XP	OB%TYP,<POINT 6,0,17> ;POINT TO TYPE FIELD IN OBJTAB ENTRY


;A TABLE OF POINTERS INTO CONFIGURATION TABLE OF AN NDB.
; INDEXED BY W (THE STANDARD NDB POINTER)

	DEFINE X(A,B,C)<	;;MACRO CALLED IN OBJTYP
	POINT	9,NDBDEV+<B/4>(W),8+<<3&B>*9>
>
NETCNF::OBJTYP			;MAKE THE BYTE POINTERS


;DCITAB	A VECTOR OF ADDRESSES (INDEXED BY OBJECT TYPE) OF ROUTINES
; TO HANDLE CONNECT INITIATE MESSAGES.
;THE NAME OF OF THE ROUTINE TO HANDLE THE CONNECT INITIATE IS
; N'"DEV"'CI WHERE "DEV" IS THE 3 CHAR NAME FOR THE DEVICE.

	DEFINE	X(A,B,C)<	;;STANDARD FORM FOR OBJTYP MACRO
	%%%OFF==0		;;FLAG
IFIDN <MCR><A>,<		;;DO WE ACCEPT CONNECTS FOR THIS TYPE
	%%%OFF==1		;;SET FLAG SAYING THAT WE KNOW THIS TYPE
	JRST	N'A'CI##	;;WE UNDERSTAND MCR'S
>
IFE %%%OFF,<JRST RTNOT>		;;GIVE ERROR RETURN IF WE DON'T KNOW THE DEVICE.
>
DCITAB::OBJTYP			;DEFINE THE DEFAULT CONNECT VECTOR

RTNOT:				;HERE TO RETURN "RSN.OT" FOR UNKNOWN DEVICES
	MOVEI	T1,RSN.OT	;GET THE ERROR CODE
	POPJ	P,		;GIVE A FAILURE RETURN TO THE CONNECT.
SUBTTL RANDOM -- RANDOM POINTERS TO VARIOUS THINGS OF INTEREST

	$LOW

;LINK ADDRESS TABLE.  ONE ENTRY FOR EACH NETWORK CONNECTION

	XP	LATLEN,M.CONN+1	;LENGTH OF TABLE (MAXIMUM NUMBER OF CONNECTS
				; PLUS ONE FOR NETDDB)

NETLAT::XWD	0,NETDDB		;POINT TO THE DDB (EXEC PROCESS)
	BLOCK	LATLEN-1		;REST OF THE TABLE


	$HIGH

;SIX CHARACTER STATION NAME

STANAM::SYSNDE


;POINTER TO REMOTE TERMINAL SECTION OF LINTAB
NETRTY::XWD	-M.RMCR,NETOFS##	;AOBJN POINTER TO LINTAB ENTRYS


;MAXIMUM NUMBER OF DATA-REQUESTS THAT MAY BE SEND (FOR INPUT DEVICES ONLY)
IFNDEF MAXODR,<MAXODR==:6>	;6 SEEMS LIKE ENOUGH...

;SIZE OF A "TERMINAL PCB"  MUST BE A POWER OF 2, AND .LE. ^D32
IFNDEF NTTPLN,<NTTPLN==:^D32>	;SIZE OF A TERMINAL PCB


;PARAMETERS THAT CONTROL THE AUTO-DISCONNECT FEATURE.
IFNDEF IDLSEC,<IDLSEC==^D90>	;ANY TERMINAL IDLE THIS LONG GET'S DISCONNECTED
IFNDEF IDLQTM,<IDLQTM==:^D5>	;DO IDLE CHECK'S EVERY IDLQTM SECONDS.
IDLMAX==:<IDLSEC+IDLQTM-1>/IDLQTM ;NUMBER OR "QUANTA" TILL DISCONNECT

	XLIST			;DON'T LIST THE LITERALS
	$LIT
	LIST
CNTEND::END