Google
 

Trailing-Edge - PDP-10 Archives - BB-R598A-RM_1983 - swskit-v3/listings/xpt/xptsel.list
There are no other files named xptsel.list in the archive.
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page   1
								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (1)

;	  0001	module XPTSEL	(
;	  0002			IDENT = 'X01710'
;	  0003			) =
;	  0004	begin
;	  0005	
;	  0006	!
;	  0007	!                    COPYRIGHT (c) 1980, 1981, 1982
;	  0008	!                    DIGITAL EQUIPMENT CORPORATION
;	  0009	!                        Maynard, Massachusetts
;	  0010	!
;	  0011	!     This software is furnished under a license and may  be  used
;	  0012	!     and copied only in accordance with the terms of such license
;	  0013	!     and with the inclusion of the above copyright notice.   This
;	  0014	!     software  or any other copies thereof may not be provided or
;	  0015	!     otherwise made available to any other person.  No  title  to
;	  0016	!     and ownership of the software is hereby transferred.
;	  0017	!
;	  0018	!     The information  in  this  software  is  subject  to  change
;	  0019	!     without  notice  and should not be construed as a commitment
;	  0020	!     by DIGITAL EQUIPMENT CORPORATION.
;	  0021	!
;	  0022	!     DIGITAL assumes no responsibility for the use or reliability
;	  0023	!     of  its  software  on  equipment  which  is  not supplied by
;	  0024	!     DIGITAL.
;	  0025	!
;	  0026	
;	  0027	!++
;	  0028	! FACILITY:	Transport
;	  0029	!
;	  0030	! ABSTRACT:
;	  0031	!
;	  0032	!	Transport Select module:  Determines what line to send
;	  0033	!	a forwarded message over.  Builds routing headers for
;	  0034	!	the messages.  Calls Forwarding to transmit the messages.
;	  0035	!
;	  0036	! ENVIRONMENT:	MCB
;	  0037	!
;	  0038	! AUTHOR: L. Webber , CREATION DATE:  2-Aug-79
;	  0039	!
;	  0040	! MODIFIED BY:
;	  0041	!
;	  0042	!	L. Webber, 2-Aug-79 : VERSION 01
;	  0043	!
;	  0044	! 1.01	L. Webber, 3-Oct-79
;	  0045	!	Replaced routines SELECTOR and HDR_BUILD, added RCVECL, RCVPH2,
;	  0046	!	BLDPH2, BLDPH3, and INTERCEPT
;	  0047	!
;	  0048	! 1.02	L. Webber, 3-Apr-80
;	  0049	!	Modified to support node and line sub-data-bases
;	  0050	!
;	  0051	! 1.03	L. Webber, 30-Jun-80
;	  0052	!	Modify to use MCBLIB macros
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page   2
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (1)

;	  0053	!
;	  0054	! 1.04	L. Webber, 3-Oct-80
;	  0055	!	Modify to recognize own node name in routing header
;	  0056	!
;	  0057	! 1.05	A. Peckham, 16-Oct-80
;	  0058	!	Do not translate C_LIN in CCB from ECL in RCVECL.
;	  0059	!
;	  0060	! 1.06	A. Peckham, 21-Oct-80
;	  0061	!	Change all CE_ERR returns into SIGNAL_STOPs.
;	  0062	!
;	  0063	! 1.07	A. Peckham, 22-Oct-80
;	  0064	!	Set adjustment factor to zero in BLDPH3 for ECL CCBs.
;	  0065	!
;	  0066	! 1.08	A. Peckham, 22-Oct-80
;	  0067	!	Fix adjustment factor problems once and for all....
;	  0068	!
;	  0069	! 1.09	A. Peckham, 24-Oct-80
;	  0070	!	Change some CE_ERRs back from SIGNAL_STOPs.
;	  0071	!
;	  0072	! 1.10  L. Webber, 31-Oct-80
;	  0073	!	Check source & dest addrs for 0 in RCVECL
;	  0074	!
;	  0075	! 1.11	L. Webber, 20-Nov-80
;	  0076	!	Modify to intercept DI's
;	  0077	!
;	  0078	! 1.12	L. Webber, 11-Dec-80
;	  0079	!	Modify to support MCB 3.1
;	  0080	!
;	  0081	! 1.13	L. Webber, 13-Jan-80
;	  0082	!	Replace "no link" DC with "bad routing header" DC
;	  0083	!
;	  0084	! 1.14	L. Webber, 23-Jan-81
;	  0085	!	Add counter and event-logging code
;	  0086	!
;	  0087	! 1.15	L. Webber, 9-Feb-81
;	  0088	!	Change references to Forwarding routines (ECLFWD, FORWARDER, TERMINATE)
;	  0089	!	to CALL$E
;	  0090	!
;	  0091	! 1.16	L. Webber, 9-Feb-81
;	  0092	!	Change references back (a interface module has been added)
;	  0093	!
;	  0094	! 1.17	L. Webber, 10-Feb-81
;	  0095	!	MAPBUF is now a macro
;	  0096	!
;	  0097	! 1.18	L. Webber, 11-Feb-81
;	  0098	!	Put the local node name in a Phase II routing header when the local
;	  0099	!	node is the source, instead of the number.
;	  0100	!
;	  0101	! 1.19	L. Webber, 20-Feb-81
;	  0102	!	Fix linkage in RCVDAT (C_LIX already translated from LIX)
;	  0103	!
;	  0104	! 1.20	L. Webber, 20-Feb-81
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page   3
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (1)

;	  0105	!	Don't flag a DC which can't be intercepted.
;	  0106	!
;	  0107	! 1.21	L. Webber, 23-Feb-81
;	  0108	!	Make the Event Buffer data an image field.
;	  0109	!
;	  0110	! 1.22	L. Webber, 25-Feb-81
;	  0111	!	Make calls to $CDBV and $CBDMG CALL$E's
;	  0112	!
;	  0113	! 1.23	L. Webber, 3-Mar-81
;	  0114	!	Change code for implementing local routing (ECL-ECL)
;	  0115	! 
;	  0116	! 1.24	L. Webber, 5-Mar-81
;	  0117	!	If a Phase II packet is received with a numeric destination
;	  0118	!	node name, the header is not useable and must be rebuilt if
;	  0119	!	the adjacent node is Phase II.
;	  0120	!
;	  0121	! 1.25	L. Webber, 5-Mar-81
;	  0122	!	Split INTERCEPT into its own XPESEL module.
;	  0123	!
;	  0124	! 1.26	L. Webber, 11-Mar-81
;	  0125	!	Take out "return-to-sender" processing for packets from the
;	  0126	!	ECL; NSP never uses the feature.
;	  0127	!
;	  0128	! 1.27	L. Webber, 12-Mar-81
;	  0129	!	Fix BLDPH2 so that if the source node is adjacent and Phase 2,
;	  0130	!	the ASCII source name is put into the routing header.
;	  0131	!
;	  0132	! 1.28	L. Webber, 16-Mar-81
;	  0133	!	Fix a couple of "cleanup" places so that they UNSPAWN the
;	  0134	!	spawned CCB, instead of just releasing it.
;	  0135	!
;	  0136	! 1.29	L. Webber, 16-Mar-81
;	  0137	!	Modify so that only links where at least one end is Phase II (not
;	  0138	!	II+) are intercepted.
;	  0139	!
;	  0140	! 1.30	L. Webber, 18-Mar-81
;	  0141	!	Fix bug in RCVPH2 that was inspecting the wrong line as the
;	  0142	!	output one.
;	  0143	!
;	  0144	! 1.31	L. Webber, 19-Mar-81
;	  0145	!	Fix the same bug in RCVDAT.
;	  0146	!
;	  0147	! 1.32	L. Webber, 20-Mar-81
;	  0148	!	Fix mistake in header-flag parameter in a call to BLDPH2.
;	  0149	!
;	  0150	! 1.33	L. Webber, 3-Apr-81
;	  0151	!	Put LIX for input line as entity into LOG_EVENT call (except
;	  0152	!	for the Aged Packet Loss event, which takes no entity).
;	  0153	!
;	  0154	! 1.34	L. Webber, 17-Apr-81
;	  0155	!	Fix RCVPH2 to map to input line data base when processing
;	  0156	!	a packet for self.
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page   4
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (1)

;	  0157	!
;	  0158	! 1.35	L. Webber, 1-May-81
;	  0159	!	Make sure no more than 60 bytes goes in the Event Buffer in
;	  0160	!	UNREACH in RCVPH2.
;	  0161	!
;	  0162	! 1.36	L. Webber, 6-May-81	*** TEMPORARY ***
;	  0163	!	Crash when an invalid format message is received from a Phase
;	  0164	!	II node.
;	  0165	!
;	  0166	! 1.37	L. Webber, 6-May-81
;	  0167	!	Set C.LIX (the input channel) to 0 when sending a packet to the
;	  0168	!	local node in RCVECL.
;	  0169	!
;	  0170	! 1.38	L. Webber, 6-May-81	*** TEMPORARY ***
;	  0171	!	Fix PH2HDR to call a mismatch between source name and adjacent
;	  0172	!	node name "unreachable" instead of "format error", so that the
;	  0173	!	event doesn't cause a crash while 1.36 is in.
;	  0174	!
;	  0175	! 1.39	L. Webber, 8-May-81
;	  0176	!	Fix local link code in RCVECL to do an LDBRT on resource failure.
;	  0177	!
;	  0178	! 1.40	L. Webber, 11-May-81
;	  0179	!	Take out 1.36 and 1.38.
;	  0180	!
;	  0181	! 1.41	L. Webber, 1-Jun-81
;	  0182	!	Modify all LOG_EVENT calls for a circuit entity to pass the NMXid.
;	  0183	!
;	  0184	! 1.42	L. Webber, 3-Jun-81
;	  0185	!	Allocate a specific buffer size instead of an SDB.
;	  0186	!
;	  0187	! 1.43	L. Webber, 4-Jun-81
;	  0188	!	Set C_LIN in Select, not Forwarding, when going to the ECL.
;	  0189	!
;	  0190	! 1.44	L. Webber, 25-Jun-81
;	  0191	!	Modify UNREACH subroutine of RCVPH2 to call SEND_DC (in XPESEL)
;	  0192	!	instead of constructing and sending the DC itself.
;	  0193	!
;	  0194	! 1.45	L. Webber, 7-Jul-81
;	  0195	!	Fix RCVDAT to handle congestion by UNSPAWNing before TOSSing.
;	  0196	!
;	  0197	! 1.46	L. Webber, 20-Jul-81
;	  0198	!	Decrement INPUTcount when sending a DC back to the source of a
;	  0199	!	buffer in RCVPH2, thus closing the books on the buffer.
;	  0200	!
;	  0201	! 1.47	L. Webber, 22-Jul-81
;	  0202	!	Enhance 1.46 to clear out a CCB's type code when it is allocated
;	  0203	!	in RCVPH2 and RCVDAT.  This assures that _TERMINATE (1.12) will do the
;	  0204	!	right thing with INPUTcount even when the CCB isn't actually forwarded
;	  0205	!	anywhere.
;	  0206	!
;	  0207	! 1.48	L. Webber, 24-Jul-81
;	  0208	!	Fix local link processing in RCVECL to get a CCB as well as a buffer.
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page   5
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (1)

;	  0209	!
;	  0210	! 1.49	L. Webber, 31-Jul-81
;	  0211	!	Fix RCVPH2 so that a bogus "Phase II" packet will not cause a
;	  0212	!	SIGNAL_STOP, but instead will cause a "packet format error" event
;	  0213	!	to be logged and the packet to be discarded.
;	  0214	!
;	  0215	! 1.50	L. Webber, 5-Aug-81
;	  0216	!	Fix the first call to TOSS in RCVDAT to pass information which has
;	  0217	!	not yet been determined, as 0.
;	  0218	!
;	  0219	! 1.51	L. Webber, 6-Aug-81
;	  0220	!	Zero out both adjustment factor and buffer type of a newly acquired
;	  0221	!	CCB in RCVECL.  (Cf. 1.47).
;	  0222	!
;	  0223	! 1.52	L. Webber, 12-Aug-81
;	  0224	!	Fix UNREACH in RCVPH2 to zero out the adjustment factor in the
;	  0225	!	spawned CCB before sending a DC.
;	  0226	!
;	  0227	! 1.53	L. Webber, 12-Aug-81
;	  0228	!	Fix 1.49 to refer to the right CCB (CCB_P) throughout.
;	  0229	!
;	  0230	! 1.54	L. Webber, 12-Aug-81
;	  0231	!	Fix 1.52 to un-adjust the pass-through CCB before zeroing out
;	  0232	!	the adjustment factor.  Also, un-chain the pass-through (i.e.,
;	  0233	!	zero out the spawned CCB's C_CHN).
;	  0234	!
;	  0235	! 1.55	L. Webber, 16-Sep-81
;	  0236	!	Fix all three main routines so that a line state for a selected
;	  0237	!	output circuit other than "running" will make a node unreachable over
;	  0238	!	that circuit.  This is to handle the window during which TLI has
;	  0239	!	brought the circuit down, but XPT hasn't processed the "line down"
;	  0240	!	CCB.
;	  0241	!
;	  0242	! 1.56	L. Webber, 16-Sep-81
;	  0243	!	Modify BLDPH2 so that, if the source node is a Phase II node, it
;	  0244	!	searches first the input circuit for the packet and then all circuits
;	  0245	!	for an matching adjacent Phase II node.  If it finds one, it converts
;	  0246	!	the address into an ASCII node name.  The change from the old way
;	  0247	!	of doing things is that all circuits and not just the input circuit
;	  0248	!	are checked.
;	  0249	!
;	  0250	! 1.57	L. Webber, 20-Sep-81
;	  0251	!	Fix 1.55 not to check the "output circuit" for a packet to the
;	  0252	!	local node.
;	  0253	!
;	  0254	! 1.58	A. Peckham, 23-Sep-81
;	  0255	!	Fix dot bug in RCVPH2.
;	  0256	!
;	  0257	! 1.59	L. Webber, 24-Sep-81
;	  0258	!	Modify event logging calls to use new macros for storing parameters
;	  0259	!	in the Event Buffer.
;	  0260	!
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page   6
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (1)

;	  0261	! 1.60	L. Webber, 16-Oct-81
;	  0262	!	Change UNREACH in RCVPH2 not to DC an unreachable packet if the
;	  0263	!	source node is 2+, but rather just to toss the packet.
;	  0264	!
;	  0265	! 1.61	L. Webber, 16-Nov-81
;	  0266	!	Fix RCVDAT when destination is unreachable, to address the input
;	  0267	!	circuit data base before incrementing the "transit packets in"
;	  0268	!	counter (currently the output data base for OL = -1 is being ad-
;	  0269	!	dressed).
;	  0270	!
;	  0271	! 1.62	L. Webber, 21-Dec-81
;	  0272	!	Fix UNREACH in RCVPH2 so that it exchanges the source and destination
;	  0273	!	node names, and recognizes a DC in a packet with a routing header.
;	  0274	!
;	  0275	! 1.63	L. Webber, 17-Feb-82
;	  0276	!	Fix UNREACH in RCVPH2 to log a packet header using a pointer to the
;	  0277	!	beginning of the header, not the pointer used to scan it.
;	  0278	!
;	  0279	! 1.64	L. Webber, 23-Feb-82
;	  0280	!	Add maintenance of DLLquota.
;	  0281	!
;	  0282	! 1.65	L. Webber, 24-Feb-82
;	  0283	!	Fix bug in RCVECL that lost routing header buffers when a packet
;	  0284	!	was discarded.
;	  0285	!
;	  0286	! 1.66	L. Webber, 3-Mar-82
;	  0287	!	Fix RCVPH2 to increment right circuit data base for Transit In's,
;	  0288	!	when the output circuit is Phase III.
;	  0289	!
;	  0290	! 1.67	L. Webber, 3-Mar-82
;	  0291	!	Streamline the whole module somewhat.  This mostly involves minor
;	  0292	!	rearranging of code, but the following features have been deleted:
;	  0293	!
;	  0294	!	1.  Validating the source node address in RCVECL (it is assumed that
;	  0295	!	    NSP is a good guy).
;	  0296	!	2.  Validating the output circuit in RCVECL (ditto).
;	  0297	!	3.  Taking out the scan of the Node Translate Table in PH2HDR.  This
;	  0298	!	    table is no longer generated anyway.  Just in case, the code is
;	  0299	!	    only commented out.
;	  0300	!
;	  0301	! 1.68	L. Webber, 19-Mar-82
;	  0302	!	Fix a bug in UNREACH in RCVPH2 that misused the buffer pointer to
;	  0303	!	packets received without routing headers, resulting in invalid DC's
;	  0304	!	being sent.
;	  0305	!	Change code in the same module that threw away a packet with an invalid
;	  0306	!	routing header.  The new code tries to DC the packet as best it can.
;	  0307	!	(It also takes less space.)
;	  0308	!
;	  0309	! 1.69	A. Peckham, 19-Apr-82
;	  0310	!	Eliminate calls to LOG_EVENT, GETNODE, GETLINE, PKTB_HDR.
;	  0311	!       PKTA_HDR has gone to XPE.
;	  0312	!	Make calls to $CDBV and $CBDMG regular linkages again
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page   7
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (1)

;	  0313	!       and rename them to CDTB and CBTD respectively.
;	  0314	!
;	  0315	! 1.70	A. Peckham, 14-Jun-82
;	  0316	!	Fix UNREACH in RCVPH2 to log PACKET HEADER parameter
;	  0317	!       for all errors except for $XPT$E_FMT.
;	  0318	!
;	  0319	! 1.71	A. Peckham, 2-Jul-82
;	  0320	!	Rename INTERCEPT to INTPH2.
;	  0321	!
;	  0322	!--
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page   8
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (2)

;	  0323	
;	  0324	!
;	  0325	! TABLE OF CONTENTS
;	  0326	!
;	  0327	
;	  0328	forward routine
;	  0329		RCVECL,
;	  0330		RCVDAT: novalue,
;	  0331		RCVPH2: novalue,
;	  0332		BLDPH2,
;	  0333		BLDPH3,
;	  0334		PH2HDR;
;	  0335	
;	  0336	!
;	  0337	! INCLUDE FILES:
;	  0338	!
;	  0339	
;	  0340	require 'XPTMAC';
;	  0438	
;	  0439	!
;	  0440	! MACROS:
;	  0441	!
;	  0442	
;	M 0443	macro GETBUF(len,ccb) =
;	M 0444	    BEGIN
;	M 0445	    MAP CCB: REF BLOCK FIELD (C_XPT_FIELDS);
;	M 0446	    IF $MCB_GET_BUFFER (len,ccb[C_ADDR]) THEN BEGIN
;	M 0447		SMAP$(ccb[C_BIAS]);
;	M 0448		ccb[C_XPT_ALLOCATION] = len;
;	M 0449		TRUE
;	M 0450		END
;	M 0451	    ELSE FALSE
;	  0452	    end%;
;	  0453	
;	  0454	!
;	  0455	! EQUATED SYMBOLS:
;	  0456	!
;	  0457	
;	  0458	!
;	  0459	! OWN STORAGE:
;	  0460	!
;	  0461	
;	  0462	!
;	  0463	! EXTERNAL REFERENCES:
;	  0464	!
;	  0465	
;	  0466	external routine
;	  0467	    FORWARDER,
;	  0468	    ECLFWD,
;	  0469	    CDTB,
;	  0470	    CBTD,
;	  0471	    RE_QUEUE: novalue,
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page   9
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (2)

;	  0472	    TERMINATE: novalue,
;	  0473	    UNSPAWN: novalue;
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  10
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (3)

;	  0474	
;	  0475	global
;	  0476	routine RCVECL (CCB_P) =
;	  0477	
;	  0478	!++
;	  0479	! FUNCTIONAL DESCRIPTION:
;	  0480	!
;	  0481	! This routine processes data packets received from a local Transport
;	  0482	! user.  It determines the output line (or local Transport user) corresponding
;	  0483	! to the specified destination, and attempts to forward the packet to that
;	  0484	! destination.  If the destination is unreachable, it will attempt to return
;	  0485	! the packet to the source Transport user.  If the packet is returned to
;	  0486	! sender, or if a congestion or resource error occurs during processing of the
;	  0487	! packet, the function CCB is returned to the caller with an error.
;	  0488	!
;	  0489	! FORMAL PARAMETERS
;	  0490	!
;	  0491	!	CCB_P - address of the function CCB, which points to the
;	  0492	!		packet to be transmitted.
;	  0493	!
;	  0494	! IMPLICIT INPUTS
;	  0495	!
;	  0496	!	CB[C_PRM1] - source address
;	  0497	!	CB[C_PRM2] - destination node address
;	  0498	!	CB[C_STS]  - bit 0, if on, specifies that "return to sender" be
;	  0499	!		     set in the header
;	  0500	!	CB[C_LIN]  - channel to send the packet on, or 0 if Select is to
;	  0501	!		     determine the channel
;	  0502	!
;	  0503	! ROUTINE VALUE: A "success" code, or one of several "failure" codes
;	  0504	! COMPLETION CODES:
;	  0505	!
;	  0506	!	CS_SUC - success
;	  0507	!	CE_DIS - destination unreachable; packet will be separately returned
;	  0508	!		 to sender if so requested
;	  0509	!	CE_RTE - packet rejected for because of congestion or resource failure
;	  0510	!	CE_NTE - source Transport user has not issued an OPEN to Transport
;	  0511	!	CE_ERR - invalid parameter specified
;	  0512	!
;	  0513	! SIDE EFFECTS:
;	  0514	!
;	  0515	!	On a success return, Select has taken control of the
;	  0516	!	CCB passed it; that CCB should not be used by the caller again.
;	  0517	!
;	  0518	!--
;	  0519	
;	  0520	begin
;	  0521	
;	  0522	local NODEb,LINEb;
;	  0523	require 'XPTSYM';
;	  0560	local CCB: ref block field (C_XPT_fields);
;	  0561	map CCB_P: ref block field(C_fields);
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  11
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (3)

;	  0562	local OTYPE,OLINE,SOURCE,DEST,CALLER,RET;
;	  0563	
;	  0564	!--------------------------------------------!
;	  0565	!					     !
;	  0566	!  Routine to do "unreachability" processing !
;	  0567	!					     !
;	  0568	!--------------------------------------------!
;	  0569	
;	  0570	routine UNREACH (CB,CALLER,SOURCE,DEST) =
;	  0571	begin
;	  0572	
;	  0573	literal NO_NODEb = 0;		! Make sure NODEb isn't mapped
;	  0574	literal NO_LINEb = 0;		! Ditto for LINEb
;	  0575	require 'XPTSYM';
;	  0612	map CB: ref block field(C_XPT_fields);
;	  0613	
;	  0614	COUNTER_INCREMENT(XPTDB,XPTunreach_loss);       ! Increment node counter
;	  0615	$NM_LOG_BEGIN();
;	  0616	PARAMETER_CM(0,4);		! Multiple fields, 4 of them
;	  0617	PARAMETER_H_1(,uplit(2));	! Hex field, 1 byte: (canned) routing flags
;	  0618	PARAMETER_DU_2(,DEST);		! Decimal unsigned, 2 bytes: dest. address
;	  0619	PARAMETER_DU_2(,SOURCE);	! Decimal unsigned, 2 bytes: source address
;	  0620	PARAMETER_H_1(,uplit(0));	! Hex field, 1 byte: (canned) forwarding flags
;	  0621	$NM_LOG_END(4^6+$XPT$E_UNR,-1); ! "unreachability packet loss" event
;	  0622	if .CB [C_XPT_ALLOCATION] neq 0 then    ! Get rid of our CCB
;	  0623	    $MCB_RETURN_CCB_AND_BUFFER(.CB [C_XPT_ALLOCATION],.CB)	!  (with or
;	  0624	else $MCB_RETURN_CCB(.CB);			!   without a buffer)
;	  0625	return(CE_DIS)					!   and return an error
;	  0626							
;	  0627	end;


						.TITLE	XPTSEL
						.IDENT	/X01710/


000000						.PSECT	$PLIT$,  RO ,  D  
000000	000002 				P.AAA:	.WORD	2
000002	000000 				P.AAB:	.WORD	0


						.GLOBL	FORWARDER, ECLFWD, CDTB, CBTD
						.GLOBL	RE.QUEUE, TERMINATE, UNSPAWN, .CRDAT
						.GLOBL	$NLBEG, $DPCM, $TPH1, $TPDU2, $NLEND
						.GLOBL	$CBBRT, $CCBRT


						.SBTTL	UNREACH
000000						.PSECT	$CODE$,  RO 

000000	004167  000000G			; UNREACH
					U.11:	JSR	R1,$SAVE4			;					0570
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  12
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (3)

000004	016700  000002G				MOV	U.9,R0				;					0614
000010	062700  000136 				ADD	#136,R0
000014	005210 					INC	(R0)
000016	001001 					BNE	1$
000020	005310 					DEC	(R0)
000022	004767  000000G			1$:	JSR	PC,$NLBEG			;					0615
000026	005046 					CLR	-(SP)				;					0616
000030	012700  000004 				MOV	#4,R0
000034	004767  000000G				JSR	PC,$DPCM
000040	116700  000000'				MOVB	P.AAA,R0			;					0617
000044	004767  000000G				JSR	PC,$TPH1
000050	016600  000016 				MOV	16(SP),R0			; DEST,*				0618
000054	004767  000000G				JSR	PC,$TPDU2
000060	016600  000020 				MOV	20(SP),R0			; SOURCE,*				0619
000064	004767  000000G				JSR	PC,$TPDU2
000070	116700  000002'				MOVB	P.AAB,R0			;					0620
000074	004767  000000G				JSR	PC,$TPH1
000100	012700  000401 				MOV	#401,R0				;					0621
000104	012701  177777 				MOV	#-1,R1
000110	004767  000000G				JSR	PC,$NLEND
000114	016604  000024 				MOV	24(SP),R4			; CB,*					0622
000120	016401  000034 				MOV	34(R4),R1
000124	001403 					BEQ	2$
000126	004767  000000G				JSR	PC,$CBBRT			;					0623
000132	000402 					BR	3$				;					0622
000134	004767  000000G			2$:	JSR	PC,$CCBRT			;					0624
000140	005726 				3$:	TST	(SP)+				;					0570
000142	012700  177520 				MOV	#-260,R0			;					0571
000146	000207 					RTS	PC				;					0570

; Routine Size:  52 words,	Routine Base:  $CODE$ + 0000
; Maximum stack depth per invocation:  7 words


;	  0628	
;	  0629	
;	  0630	!****************** START OF ROUTINE MAINLINE **************************!
;	  0631	
;	  0632	
;	  0633	!
;	  0634	!  Pick up the parameters and validate them
;	  0635	!
;	  0636	
;	  0637	CCB = .CCB_P;
;	  0638	DEST = .CCB[C_PRM2];                    ! Pick up the destination address
;	  0639	NODEb = $XPT_GET_NODE_DB(.DEST);	!  and address its data base entry
;	  0640	if .NODEb eql 0 then                    ! Invalid destination -
;	  0641	    return (CE_ERR);                    !  return "parameter error"
;	  0642	SOURCE = .CCB[C_PRM1];                  ! Pick up the source address
;	  0643	OLINE = .CCB[C_LIN];                    ! Pick up the output line
;	  0644	CALLER = .CCB[C_PIX];                   ! Pick up Transport user's PDV index
;	  0645	
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  13
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (3)

;	  0646	!
;	  0647	!  Determine the output line
;	  0648	!
;	  0649	
;	  0650	if .OLINE eql 0                         ! Line not specified - default
;	  0651	then if not .Local_node
;	  0652	     then OLINE = .OL;
;	  0653	
;	  0654	!
;	  0655	!  Spawn a CCB
;	  0656	!
;	  0657	
;	  0658	if not $MCB_GET_CCB (CCB)
;	  0659	then return (CE_RTE);
;	  0660	CCB [C_XPT_ALLOCATION] = 0;
;	  0661	
;	  0662	if .OLINE eql 0 then
;	  0663	    begin                               !   Local link:
;	  0664	    local TMPCCB: ref block field (C_FIELDS), BUFSIZE;
;	  0665	    TMPCCB = .CCB_P;                    !     Trace through the input CCB chain
;	  0666	    BUFSIZE = 0;
;	  0667	    do                                  !     and accumulate message length
;	  0668	        BUFSIZE = .BUFSIZE + .TMPCCB[C_CNT]
;	  0669	    while (TMPCCB = .TMPCCB[C_CHN]) neqa 0;
;	  0670	    if not GETBUF(.BUFSIZE,CCB)         !  Get a buffer that size      
;	  0671	    then begin                          !  and if failure
;	  0672	         $MCB_RETURN_CCB(.CCB);         !  then return CCB
;	  0673	         return (CE_RTE);               !  and "resource error"
;	  0674	         end;
;	  0675	    end;				!   Not local link - just get the CCB
;	  0676	
;	  0677	if .OLINE neq 0 then			!If the path isn't local,
;	  0678	    CCB[C_STK] = .CCB_P;		!  chain in the pass-through CCB
;	  0679	CCB[C_PRM4] = 0;
;	  0680	
;	  0681	!
;	  0682	!  Check destination for unreachability
;	  0683	!
;	  0684	
;	  0685	LINEb = $XPT_GET_LINE_DB(.OLINE);
;	  0686	if (not .Reach					!Destination
;	  0687	or ((.OLINE neq 0) and (.LINEstate neq RU))) then! unreachable:
;	  0688	    return (UNREACH(.CCB,.CALLER,.SOURCE,	!    do "unreachability"
;	  0689		.DEST));			!    processing
;	  0690	
;	  0691	!
;	  0692	!  Destination is local
;	  0693	!
;	  0694	
;	  0695	RET %(the return from Forwarding)% =
;	  0696	
;	  0697	(if .OLINE eql 0 then
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  14
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (3)

;	  0698	if .Local_node then begin
;	  0699	    OTYPE = 0;					!Set output type to "local"
;	  0700	    CCB[C_CNT] = 				!Copy the data
;	P 0701		$MCB_COPY_CHAIN_TO_BUFFER(.CCB_P,	!    into the single
;	  0702		    (.CCB[C_BIAS],.CCB[C_ADDR]));	!    data buffer
;	  0703	    CCB[C_LIX] = 0;				!Input channel is null
;	  0704	    if (ECLFWD(.CCB,.SOURCE,.DEST,0)            !Try to forward the packet
;	  0705	    neq CS_SUC) then				!  to the specified user
;	P 0706		return ($MCB_RETURN_CCB_AND_BUFFER	!Failed -
;	  0707		    (.CCB[C_PRM5],.CCB); CE_RTE)	!  set error code
;	  0708	    else begin					!Worked -
;	  0709		TERMINATE(.CCB_P,CS_SUC);		!  return the input
;	  0710		INPUTquota = .INPUTquota - 1;		!  buffer (but don't
;	  0711		CS_SUC					!  return the admission
;	  0712		end					!  permit)
;	  0713	    end
;	  0714	else SIGNAL_STOP (CE_ERR)		!Output line = 0, destination not Self
;	  0715	
;	  0716	!
;	  0717	!  Adjacent node is Phase II
;	  0718	!
;	  0719	
;	  0720	else begin
;	  0721	    LINEb = $XPT_GET_LINE_DB(.OLINE);
;	  0722	    if ((.Nty eql PhTwo) or (.Nty eql TOPS20)) then begin
;	  0723		if .Nty eql PhTwo then			!Set output type to
;	  0724		    OTYPE = 1				!  "Phase II" or
;	  0725		else OTYPE = 2;				!  "Phase II+/Phase III"
;	  0726		RET =
;	  0727		(if (.Nid neq .DEST) then		!Destination isn't adjacent -
;	  0728		    SIGNAL_STOP (CE_ERR)		!  bomb
;	  0729		else BLDPH2(.CCB,0,.DEST,		!Otherwise, build a
;	  0730		    .SOURCE,.OLINE,0));			!  Phase II header
;	  0731		end
;	  0732	
;	  0733	!
;	  0734	!  Adjacent node is Phase III - build a Phase III header
;	  0735	!
;	  0736	
;	  0737	    else begin
;	  0738		OTYPE = 2;			!Set output type to "Phase II+/III"
;	  0739		RET = BLDPH3 (.CCB,0,.DEST,.Tid,0); 
;	  0740		end;
;	  0741	
;	  0742	!
;	  0743	!  Error in building the header - return an error
;	  0744	!
;	  0745	
;	  0746	    if .RET neq CS_SUC then return (CCBRT$(.CCB); .RET)
;	  0747	
;	  0748	!
;	  0749	!  Message is ready to be sent - give it to Forwarding
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  15
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (3)

;	  0750	!
;	  0751	
;	  0752	    else begin
;	  0753		if ((RET = FORWARDER(.CCB,.OLINE))
;	  0754		eql CS_SUC) then			! If Forwarding accepts packet,
;	  0755		    COUNTER_INCREMENT(LINEb,XPTend_xmt);!   update packets counter
;	  0756		.RET
;	  0757		end
;	  0758	    end);
;	  0759	
;	  0760	!
;	  0761	!  Forwarding rejected packet as "unreachable"
;	  0762	!
;	  0763	
;	  0764	if .RET eql CE_DIS then
;	  0765	    UNREACH (.CCB,.CALLER,.SOURCE,.DEST)
;	  0766	
;	  0767	!
;	  0768	!  Forwarding rejected packet for congestion reasons
;	  0769	!
;	  0770	
;	  0771	else if .RET eql CE_RTE then begin
;	  0772	    if .CCB [C_XPT_ALLOCATION] neq 0 then
;	  0773		$MCB_RETURN_CCB_AND_BUFFER(.CCB [C_XPT_ALLOCATION],.CCB)
;	  0774	    else $MCB_RETURN_CCB(.CCB);
;	  0775	    CE_RTE
;	  0776	    end
;	  0777	
;	  0778	!
;	  0779	!  Forwarding accepted packet - return "success"
;	  0780	!
;	  0781	
;	  0782	else begin
;	  0783	    if .OTYPE eql 1 then			!Going to a Phase II node -
;	P 0784		CALL$E(INTPH2,PD_XPE,.CCB_P,1,          !  do intercept
;	  0785		    DEST,SOURCE);			!  processing
;	  0786	    CS_SUC
;	  0787	    end
;	  0788	
;	  0789	end;				!End of RCVECL


						.GLOBL	GTNODE, $CCBGT, $CORGT, KISAR6
						.GLOBL	GTLINE, $CPTBF, $IC32, INTPH2
						.GLOBL	$CALLE


						.SBTTL	RCVECL
000000	004167  000000G			RCVECL::
					U.1:	JSR	R1,$SAVE5			;					0476
000004	162706  000014 				SUB	#14,SP
000010	016646  000032 				MOV	32(SP),-(SP)			; CCB.P,*				0637
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  16
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (3)

000014	011646 					MOV	(SP),-(SP)			; *,CCB
000016	011600 					MOV	(SP),R0				; CCB,*					0638
000020	016066  000026  000014 			MOV	26(R0),14(SP)			; *(CCB),DEST
000026	016666  000014  000010 			MOV	14(SP),10(SP)			; DEST,*				0639
000034	016600  000010 				MOV	10(SP),R0
000040	004767  000000G				JSR	PC,GTNODE
000044	010002 					MOV	R0,R2				; *,NODEB
000046	001003 					BNE	1$				;					0640
000050	012700  177760 				MOV	#-20,R0				;					0641
000054	000534 					BR	8$
000056	011600 				1$:	MOV	(SP),R0				; CCB,*					0642
000060	016066  000024  000016 			MOV	24(R0),16(SP)			; *(CCB),SOURCE
000066	005003 					CLR	R3				; OLINE					0643
000070	156003  000010 				BISB	10(R0),R3			; *(CCB),OLINE
000074	116066  000011  000012 			MOVB	11(R0),12(SP)			; *(CCB),CALLER				0644
000102	105066  000013 				CLRB	13(SP)				; CALLER
000106	005703 					TST	R3				; OLINE					0650
000110	001004 					BNE	2$
000112	032712  000400 				BIT	#400,(R2)			; *,NODEB				0651
000116	001001 					BNE	2$
000120	111203 					MOVB	(R2),R3				; NODEB,OLINE				0652
000122	004767  000000G			2$:	JSR	PC,$CCBGT			;					0658
000126	103563 					BCS	10$
000130	010416 					MOV	R4,(SP)				; $MCB$R4,CCB
000132	012700  000034 				MOV	#34,R0				;					0660
000136	060400 					ADD	R4,R0				; CCB,*
000140	010066  000006 				MOV	R0,6(SP)
000144	005010 					CLR	(R0)
000146	005066  000004 				CLR	4(SP)				;					0662
000152	005703 					TST	R3				; OLINE
000154	001033 					BNE	5$
000156	005266  000004 				INC	4(SP)
000162	016600  000002 				MOV	2(SP),R0			; *,TMPCCB				0665
000166	005001 					CLR	R1				; BUFSIZE				0666
000170	066001  000022 			3$:	ADD	22(R0),R1			; *(TMPCCB),BUFSIZE			0668
000174	016000  000002 				MOV	2(R0),R0			; *(TMPCCB),TMPCCB			0669
000200	001373 					BNE	3$
000202	004767  000000G				JSR	PC,$CORGT			;					0670
000206	103412 					BCS	4$
000210	011604 					MOV	(SP),R4				; CCB,*
000212	010064  000020 				MOV	R0,20(R4)			; $MCB$R0,*(CCB)
000216	010400 					MOV	R4,R0				; CCB,*
000220	016760  000000G 000016 			MOV	KISAR6,16(R0)			; *,*(CCB)
000226	010176  000006 				MOV	R1,@6(SP)			; BUFSIZE,*
000232	000404 					BR	5$
000234	011604 				4$:	MOV	(SP),R4				; CCB,*					0672
000236	004767  000000G				JSR	PC,$CCBRT
000242	000515 					BR	10$				;					0671
000244	005001 				5$:	CLR	R1				;					0677
000246	005703 					TST	R3				; OLINE
000250	001405 					BEQ	6$
000252	005201 					INC	R1
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  17
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (3)

000254	011600 					MOV	(SP),R0				; CCB,*					0678
000256	016660  000002  000004 			MOV	2(SP),4(R0)			; *,*(CCB)
000264	011600 				6$:	MOV	(SP),R0				; CCB,*					0679
000266	005060  000032 				CLR	32(R0)				; *(CCB)
000272	010300 					MOV	R3,R0				; OLINE,*				0685
000274	004767  000000G				JSR	PC,GTLINE
000300	010005 					MOV	R0,R5				; *,LINEB
000302	005712 					TST	(R2)				; NODEB					0686
000304	100005 					BPL	7$
000306	006001 					ROR	R1				;					0687
000310	103017 					BCC	9$
000312	121527  000010 				CMPB	(R5),#10			; LINEB,*
000316	001414 					BEQ	9$
000320	011646 				7$:	MOV	(SP),-(SP)			; CCB,*					0688
000322	016646  000014 				MOV	14(SP),-(SP)			; CALLER,*
000326	016646  000022 				MOV	22(SP),-(SP)			; SOURCE,*
000332	016646  000016 				MOV	16(SP),-(SP)
000336	004767  177266 				JSR	PC,U.11
000342	062706  000010 				ADD	#10,SP
000346	000455 				8$:	BR	11$
000350	032766  000001  000004 		9$:	BIT	#1,4(SP)			;					0697
000356	001500 					BEQ	14$
000360	032712  000400 				BIT	#400,(R2)			; *,NODEB				0698
000364	001465 					BEQ	13$
000366	005002 					CLR	R2				; OTYPE					0699
000370	011600 					MOV	(SP),R0				; CCB,*					0702
000372	016046  000016 				MOV	16(R0),-(SP)			; *(CCB),*
000376	016046  000020 				MOV	20(R0),-(SP)			; *(CCB),*
000402	016604  000006 				MOV	6(SP),R4
000406	004767  000000G				JSR	PC,$CPTBF
000412	016601  000004 				MOV	4(SP),R1			; CCB,*					0700
000416	010061  000022 				MOV	R0,22(R1)			; *,*(CCB)
000422	010100 					MOV	R1,R0				; CCB,*					0703
000424	105060  000010 				CLRB	10(R0)				; *(CCB)
000430	010116 					MOV	R1,(SP)				; CCB,*					0704
000432	016646  000022 				MOV	22(SP),-(SP)			; SOURCE,*
000436	016646  000016 				MOV	16(SP),-(SP)
000442	005046 					CLR	-(SP)
000444	004767  000000G				JSR	PC,ECLFWD
000450	062706  000006 				ADD	#6,SP
000454	005300 					DEC	R0
000456	001412 					BEQ	12$
000460	017601  000012 				MOV	@12(SP),R1			;					0707
000464	016604  000004 				MOV	4(SP),R4			; CCB,*
000470	004767  000000G				JSR	PC,$CBBRT
000474	022626 					CMP	(SP)+,(SP)+			;					0706
000476	012700  177730 			10$:	MOV	#-50,R0
000502	000536 				11$:	BR	23$
000504	016616  000006 			12$:	MOV	6(SP),(SP)			;					0709
000510	012746  000001 				MOV	#1,-(SP)
000514	004767  000000G				JSR	PC,TERMINATE
000520	016700  000002G				MOV	.CRDAT+2,R0
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  18
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (3)

000524	105360  000104 				DECB	104(R0)				;					0710
000530	005726 					TST	(SP)+				;					0708
000532	012701  000001 				MOV	#1,R1				; *,RET					0704
000536	000537 					BR	25$				;					0698
000540	012746  177760 			13$:	MOV	#-20,-(SP)			;					0714
000544	012746  000001 				MOV	#1,-(SP)
000550	004767  000000G				JSR	PC,$STOP
000554	010001 					MOV	R0,R1				; *,RET					0698
000556	000527 					BR	25$				;					0697
000560	010300 				14$:	MOV	R3,R0				; OLINE,*				0721
000562	004767  000000G				JSR	PC,GTLINE
000566	010005 					MOV	R0,R5				; *,LINEB
000570	005000 					CLR	R0				;					0722
000572	126527  000002  000004 			CMPB	2(R5),#4			; *(LINEB),*
000600	001002 					BNE	15$
000602	005200 					INC	R0
000604	000404 					BR	16$
000606	126527  000002  000005 		15$:	CMPB	2(R5),#5			; *(LINEB),*
000614	001040 					BNE	21$
000616	006000 				16$:	ROR	R0				;					0723
000620	103003 					BCC	17$
000622	012702  000001 				MOV	#1,R2				; *,OTYPE				0724
000626	000402 					BR	18$				;					0723
000630	012702  000002 			17$:	MOV	#2,R2				; *,OTYPE				0725
000634	026566  000004  000010 		18$:	CMP	4(R5),10(SP)			; *(LINEB),*				0727
000642	001407 					BEQ	19$
000644	012746  177760 				MOV	#-20,-(SP)			;					0728
000650	012746  000001 				MOV	#1,-(SP)
000654	004767  000000G				JSR	PC,$STOP
000660	000414 					BR	20$				;					0727
000662	011646 				19$:	MOV	(SP),-(SP)			; CCB,*					0729
000664	005046 					CLR	-(SP)
000666	016646  000014 				MOV	14(SP),-(SP)
000672	016646  000024 				MOV	24(SP),-(SP)			; SOURCE,*
000676	010346 					MOV	R3,-(SP)			; OLINE,*
000700	005046 					CLR	-(SP)
000702	004767  000000V				JSR	PC,U.4
000706	062706  000010 				ADD	#10,SP
000712	010001 				20$:	MOV	R0,R1				; *,RET					0727
000714	000420 					BR	22$				;					0722
000716	012702  000002 			21$:	MOV	#2,R2				; *,OTYPE				0738
000722	011646 					MOV	(SP),-(SP)			; CCB,*					0739
000724	005046 					CLR	-(SP)
000726	016646  000014 				MOV	14(SP),-(SP)
000732	016700  000002G				MOV	.CRDAT+2,R0
000736	016046  000056 				MOV	56(R0),-(SP)
000742	005046 					CLR	-(SP)
000744	004767  000000V				JSR	PC,U.5
000750	010001 					MOV	R0,R1				; *,RET
000752	062706  000006 				ADD	#6,SP				;					0737
000756	020127  000001 			22$:	CMP	R1,#1				; RET,*					0746
000762	001407 					BEQ	24$
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  19
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (3)

000764	016604  000004 				MOV	4(SP),R4			; CCB,*
000770	004767  000000G				JSR	PC,$CCBRT
000774	022626 					CMP	(SP)+,(SP)+
000776	010100 					MOV	R1,R0				; RET,*
001000	000516 				23$:	BR	32$
001002	016616  000004 			24$:	MOV	4(SP),(SP)			; CCB,*					0753
001006	010346 					MOV	R3,-(SP)			; OLINE,*
001010	004767  000000G				JSR	PC,FORWARDER
001014	005726 					TST	(SP)+
001016	010001 					MOV	R0,R1				; *,RET
001020	005300 					DEC	R0
001022	001005 					BNE	25$
001024	010500 					MOV	R5,R0				; LINEB,*				0755
001026	062700  000062 				ADD	#62,R0
001032	004767  000000G				JSR	PC,$IC32
001036	020127  177520 			25$:	CMP	R1,#-260			; RET,*					0764
001042	001015 					BNE	26$
001044	016616  000004 				MOV	4(SP),(SP)			; CCB,*					0765
001050	016646  000016 				MOV	16(SP),-(SP)			; CALLER,*
001054	016646  000024 				MOV	24(SP),-(SP)			; SOURCE,*
001060	016646  000020 				MOV	20(SP),-(SP)
001064	004767  176540 				JSR	PC,U.11
001070	062706  000006 				ADD	#6,SP
001074	000457 					BR	31$				;					0764
001076	020127  177730 			26$:	CMP	R1,#-50				; RET,*					0771
001102	001021 					BNE	29$
001104	005776  000012 				TST	@12(SP)				;					0772
001110	001407 					BEQ	27$
001112	017601  000012 				MOV	@12(SP),R1			;					0773
001116	016604  000004 				MOV	4(SP),R4			; CCB,*
001122	004767  000000G				JSR	PC,$CBBRT
001126	000404 					BR	28$				;					0772
001130	016604  000004 			27$:	MOV	4(SP),R4			; CCB,*					0774
001134	004767  000000G				JSR	PC,$CCBRT
001140	012700  177730 			28$:	MOV	#-50,R0				;					0771
001144	000433 					BR	31$
001146	005302 				29$:	DEC	R2				; OTYPE					0783
001150	001027 					BNE	30$
001152	012716  000022 				MOV	#22,(SP)			;					0785
001156	060616 					ADD	SP,(SP)				; SOURCE,*
001160	012746  000022 				MOV	#22,-(SP)
001164	060616 					ADD	SP,(SP)				; DEST,*
001166	012746  000001 				MOV	#1,-(SP)
001172	016646  000012 				MOV	12(SP),-(SP)
001176	012746  000004 				MOV	#4,-(SP)
001202	012746  000000G				MOV	#INTPH2,-(SP)
001206	016700  000002G				MOV	.CRDAT+2,R0
001212	005046 					CLR	-(SP)
001214	116016  000002 				MOVB	2(R0),(SP)
001220	004767  000000G				JSR	PC,$CALLE
001224	062706  000014 				ADD	#14,SP
001230	012700  000001 			30$:	MOV	#1,R0				;					0771
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  20
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (3)

001234	022626 				31$:	CMP	(SP)+,(SP)+			;					0520
001236	062706  000020 			32$:	ADD	#20,SP				;					0476
001242	000207 					RTS	PC

; Routine Size:  338 words,	Routine Base:  $CODE$ + 0150
; Maximum stack depth per invocation:  23 words
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  21
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (4)

;	  0790	
;	  0791	global
;	  0792	routine RCVDAT (CCB_P): novalue =
;	  0793	
;	  0794	!++
;	  0795	! FUNCTIONAL DESCRIPTION:
;	  0796	!
;	  0797	! This routine processes data packets received from the Data Link
;	  0798	! Link Layer which have Phase III routing headers. It determines
;	  0799	! the output line (or local Transport user) corresponding to the
;	  0800	! specified destination, and attempts to forward the packet to that
;	  0801	! destination.  If the destination is unreachable, the routine will
;	  0802	! try to return the packet to its source node. If the immediate
;	  0803	! destination (the adjacent node on the output line) is Phase II,
;	  0804	! BLDPH2 will be called to translate the routing header. If the
;	  0805	! destination is "standard" Phase II, the packet will not be thrown
;	  0806	! away on congestion or resource failure, but will be queued for
;	  0807	! eventual reprocessing.
;	  0808	!
;	  0809	! FORMAL PARAMETERS
;	  0810	!
;	  0811	!	CCB_P - CCB for the received packet - the "pass-through" CCB
;	  0812	!
;	  0813	! IMPLICIT INPUTS
;	  0814	!
;	  0815	!	Reach, OL, Nty, Nid, User
;	  0816	!
;	  0817	! ROUTINE VALUE: NONE
;	  0818	! COMPLETION CODES:
;	  0819	!
;	  0820	!	NONE.
;	  0821	!
;	  0822	! SIDE EFFECTS:
;	  0823	!
;	  0824	!	May modify the routing header in the pass-through buffer.
;	  0825	!
;	  0826	!--
;	  0827	
;	  0828	begin
;	  0829	
;	  0830	local NODEb,LINEb;
;	  0831	require 'XPTSYM';
;	  0868	local CCB: ref block field (C_XPT_fields);
;	  0869	map CCB_P: ref block field(C_fields);
;	  0870	local DEST,SOURCE,ILINE,OLINE,RET,RFLG,VISIT;
;	  0871	pointer PTR;
;	  0872	macro RTS = biton (.RFLG,RTSflg)%;
;	  0873	macro RQR = biton (.RFLG,RQRflg)%;
;	  0874	
;	  0875	
;	  0876	!-----------------------------------------------------!
;	  0877	!						      !
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  22
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (4)

;	  0878	!  Routine to either throw away a packet or queue it  !
;	  0879	!  for eventual reprocessing			      !
;	  0880	!						      !
;	  0881	!-----------------------------------------------------!
;	  0882	
;	  0883	routine TOSS (CCB,OLINE,ILINE,DEST): novalue =
;	  0884	begin
;	  0885	
;	  0886	local LINEb;
;	  0887	literal NO_NODEb = 0;	!This is to get around a BLISS glitch
;	  0888	require 'XPTSYM';
;	  0925	
;	  0926	LINEb = $XPT_GET_LINE_DB(.OLINE);       ! Address line data base entry
;	  0927	if ((.OLINE neq 0)			! If the destination isn't local,
;	  0928	and (.Nty eql PhTwo)			!   and it's standard Phase II
;	  0929	and (.Nid eql .DEST))			!   and it's the adjacent node
;	  0930	    then RE_QUEUE(.CCB)			!   then requeue CCB for later
;	  0931	else begin				!
;	  0932	    if .OLINE neq 0 then		! Transit congestion -
;	  0933		COUNTER_INCREMENT(LINEb,XPTxit_cng)!   log that
;	  0934	    else begin				! Path-end congestion -
;	  0935		LINEb = $XPT_GET_LINE_DB(.ILINE);	!   Log that (on
;	  0936		COUNTER_INCREMENT(LINEb,XPTend_cng);	!     the input line)
;	  0937		end;
;	  0938	    TERMINATE(.CCB,CE_RTE);		!Otherwise, throw buffer away
;	  0939	    end;
;	  0940	
;	  0941	end;


						.SBTTL	TOSS
000000	010146 				; TOSS
					U.19:	MOV	R1,-(SP)			;					0883
000002	016600  000010 				MOV	10(SP),R0			; OLINE,*				0926
000006	004767  000000G				JSR	PC,GTLINE
000012	010001 					MOV	R0,R1				; *,LINEB
000014	005000 					CLR	R0				;					0927
000016	005766  000010 				TST	10(SP)				; OLINE
000022	001416 					BEQ	1$
000024	005200 					INC	R0
000026	126127  000002  000004 			CMPB	2(R1),#4			; *(LINEB),*				0928
000034	001011 					BNE	1$
000036	026166  000004  000004 			CMP	4(R1),4(SP)			; *(LINEB),DEST				0929
000044	001005 					BNE	1$
000046	016646  000012 				MOV	12(SP),-(SP)			; CCB,*					0930
000052	004767  000000G				JSR	PC,RE.QUEUE
000056	000432 					BR	5$				;					0927
000060	006000 				1$:	ROR	R0				;					0932
000062	103006 					BCC	2$
000064	012700  000100 				MOV	#100,R0				;					0933
000070	060100 					ADD	R1,R0				; LINEB,*
000072	005210 					INC	(R0)
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  23
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (4)

000074	001014 					BNE	4$
000076	000412 					BR	3$
000100	016600  000006 			2$:	MOV	6(SP),R0			; ILINE,*				0935
000104	004767  000000G				JSR	PC,GTLINE
000110	010001 					MOV	R0,R1				; *,LINEB
000112	012700  000066 				MOV	#66,R0				;					0936
000116	060100 					ADD	R1,R0				; LINEB,*
000120	005210 					INC	(R0)
000122	001001 					BNE	4$
000124	005310 				3$:	DEC	(R0)
000126	016646  000012 			4$:	MOV	12(SP),-(SP)			; CCB,*					0938
000132	012746  177730 				MOV	#-50,-(SP)
000136	004767  000000G				JSR	PC,TERMINATE
000142	005726 					TST	(SP)+				;					0931
000144	005726 				5$:	TST	(SP)+				;					0884
000146	012601 					MOV	(SP)+,R1			;					0883
000150	000207 					RTS	PC

; Routine Size:  53 words,	Routine Base:  $CODE$ + 1414
; Maximum stack depth per invocation:  4 words


;	  0942	
;	  0943	
;	  0944	
;	  0945	!---------------------------------------------!
;	  0946	!					      !
;	  0947	!  Routine to do "unreachability" processing  !
;	  0948	!					      !
;	  0949	!---------------------------------------------!
;	  0950	
;	  0951	routine UNREACH (CCB,CCB_P,SOURCE,DEST,RFLG,CODE): novalue =
;	  0952	begin
;	  0953	
;	  0954	literal NO_NODEb = 0;		! To keep NODEb from being mapped
;	  0955	local LINEb;
;	  0956	require 'XPTSYM';
;	  0993	map CCB: ref block field(C_FIELDS);
;	  0994	map CCB_P: ref block field(C_FIELDS);
;	  0995	
;	  0996	pointer PTR;
;	  0997	
;	  0998	LINEb = $XPT_GET_LINE_DB(.CCB_P[C_LIX]);        ! Address input line data base
;	  0999	if .CODE eql $XPT$E_UNR then		! Increment
;	  1000	    COUNTER_INCREMENT(XPTDB,XPTunreach_loss)    !   appropriate
;	  1001	else COUNTER_INCREMENT(XPTDB,XPTrange_loss);    !   node counter
;	  1002	$NM_LOG_BEGIN();
;	  1003	CALL$E(PKTA_HDR,(PD_XPE),.CCB_P[C_ADDR]); ! Log an "unreachable node" or
;	  1004	$NM_LOG_END(4^6+.CODE,.NMXid);		!   "node out of range" event
;	  1005	if ((RQR) and (not (RTS))) then begin	! Valid "return to sender" -
;	  1006	    CCB[C_BIAS] = .CCB_P[C_BIAS];	!   Copy routing
;	  1007	    CCB[C_ADDR] = .CCB_P[C_ADDR];	!     header into
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  24
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (4)

;	  1008	    CCB[C_CNT] = .CCB_P[C_CNT];		!     the spawned CCB
;	  1009	    PTR = .CCB[C_ADDR];                 !   Address the routing header
;	  1010	    putb (.RFLG or RTSflg, PTR);	!   Set the RTS flag
;	  1011	    putw (.SOURCE,PTR);                 !   Exchange the source
;	  1012	    putw (.DEST,PTR);                   !     and destination addresses
;	  1013	    if FORWARDER(.CCB,.CCB_P[C_LIN])	!   Send back over input line
;	  1014	    neq CS_SUC then			! Rejected -
;	  1015		TERMINATE(.CCB,CE_DIS);		!   throw away
;	  1016	    end
;	  1017	else TERMINATE(.CCB,CE_DIS);		! No "return to sender" - throw away
;	  1018	return;
;	  1019	end;


						.GLOBL	$IC8, PKTA.HDR


						.SBTTL	UNREACH
000000	004167  000000G			; UNREACH
					U.22:	JSR	R1,$SAVE4			;					0951
000004	005746 					TST	-(SP)
000006	016603  000026 				MOV	26(SP),R3			; CCB.P,*				0998
000012	005000 					CLR	R0
000014	156300  000010 				BISB	10(R3),R0
000020	004767  000000G				JSR	PC,GTLINE
000024	010002 					MOV	R0,R2				; *,LINEB
000026	026627  000016  000001 			CMP	16(SP),#1			; CODE,*				0999
000034	001010 					BNE	1$
000036	016700  000002G				MOV	.CRDAT+2,R0			;					1000
000042	062700  000136 				ADD	#136,R0
000046	005210 					INC	(R0)
000050	001010 					BNE	2$
000052	005310 					DEC	(R0)
000054	000406 					BR	2$				;					0999
000056	016700  000002G			1$:	MOV	.CRDAT+2,R0			;					1001
000062	062700  000131 				ADD	#131,R0
000066	004767  000000G				JSR	PC,$IC8
000072	004767  000000G			2$:	JSR	PC,$NLBEG			;					1002
000076	016346  000020 				MOV	20(R3),-(SP)			;					1003
000102	012746  000001 				MOV	#1,-(SP)
000106	012746  000000G				MOV	#PKTA.HDR,-(SP)
000112	016700  000002G				MOV	.CRDAT+2,R0
000116	005046 					CLR	-(SP)
000120	116016  000002 				MOVB	2(R0),(SP)
000124	004767  000000G				JSR	PC,$CALLE
000130	016600  000026 				MOV	26(SP),R0			; CODE,*				1004
000134	062700  000400 				ADD	#400,R0
000140	016201  000034 				MOV	34(R2),R1			; *(LINEB),*
000144	004767  000000G				JSR	PC,$NLEND
000150	016602  000040 				MOV	40(SP),R2			; CCB,*					1006
000154	016601  000030 				MOV	30(SP),R1			; RFLG,*				1005
000160	032701  000010 				BIT	#10,R1
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  25
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (4)

000164	001451 					BEQ	3$
000166	032701  000020 				BIT	#20,R1
000172	001046 					BNE	3$
000174	016362  000016  000016 			MOV	16(R3),16(R2)			;					1006
000202	016362  000020  000020 			MOV	20(R3),20(R2)			;					1007
000210	016362  000022  000022 			MOV	22(R3),22(R2)			;					1008
000216	016200  000020 				MOV	20(R2),R0			; *,PTR					1009
000222	010104 					MOV	R1,R4				;					1010
000224	052704  000020 				BIS	#20,R4
000230	110420 					MOVB	R4,(R0)+			; *,PTR
000232	016666  000034  000010 			MOV	34(SP),10(SP)			; SOURCE,X				1011
000240	116620  000010 				MOVB	10(SP),(R0)+			; X,PTR
000244	116620  000011 				MOVB	11(SP),(R0)+			; X,PTR
000250	016666  000032  000010 			MOV	32(SP),10(SP)			; DEST,X				1012
000256	116620  000010 				MOVB	10(SP),(R0)+			; X,PTR
000262	116620  000011 				MOVB	11(SP),(R0)+			; X,PTR
000266	010216 					MOV	R2,(SP)				;					1013
000270	005046 					CLR	-(SP)
000272	116316  000010 				MOVB	10(R3),(SP)
000276	004767  000000G				JSR	PC,FORWARDER
000302	005726 					TST	(SP)+
000304	005300 					DEC	R0				;					1014
000306	001406 					BEQ	4$
000310	010216 				3$:	MOV	R2,(SP)				;					1017
000312	012746  177520 				MOV	#-260,-(SP)
000316	004767  000000G				JSR	PC,TERMINATE
000322	005726 					TST	(SP)+
000324	062706  000012 			4$:	ADD	#12,SP				;					0951
000330	000207 					RTS	PC

; Routine Size:  109 words,	Routine Base:  $CODE$ + 1566
; Maximum stack depth per invocation:  12 words


;	  1020	
;	  1021	
;	  1022	!******************** START OF ROUTINE MAINLINE *************************!
;	  1023	
;	  1024	!
;	  1025	!  Analyze the routing header
;	  1026	!
;	  1027	
;	  1028	MAPBUF (.CCB_P,PTR);			!Map in the buffer
;	  1029	RFLG = getb(PTR);			!Pick up the routing flags
;	  1030	DEST = getw(PTR);			!Pick up the destination address
;	  1031	SOURCE = getw(PTR);			!Pick up the source address
;	  1032	VISIT = ch$rchar(.PTR);			!Pick up the visits count
;	  1033	VISIT = .VISIT+1;
;	  1034	ch$wchar_a(.VISIT,PTR);
;	  1035	
;	  1036	!
;	  1037	!  Calculate the input and output lines
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  26
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (4)

;	  1038	!
;	  1039	
;	  1040	NODEb = $XPT_GET_NODE_DB(.DEST);        ! Get destination data base address
;	  1041	OLINE = 0;
;	  1042	if not .Local_node then OLINE = .OL;
;	  1043	ILINE = .CCB_P[C_LIN];
;	  1044	LINEb = $XPT_GET_LINE_DB(.ILINE);       ! Address input line data base entry
;	  1045	
;	  1046	!
;	  1047	!  Check the VISITS field in the routing header
;	  1048	!
;	  1049	
;	  1050	if ((.VISIT gtru .MAXV)				!Too many
;	  1051	or ((RTS) and (.VISIT gtru (2*.MAXV)))) then	!  visits -
;	  1052	    begin					!  throw the
;	  1053	    TERMINATE(.CCB_P,CE_ERR);			!  packet away,
;	  1054	    COUNTER_INCREMENT(XPTDB,XPTaged_loss);      !  bump "aged loss" and
;	  1055	    COUNTER_INCREMENT(LINEb,XPTxit_rcv);        !  "transit packet"
;	  1056	    $NM_LOG_BEGIN();				!  "aged packet loss"
;	  1057	    CALL$E(PKTA_HDR,(PD_XPE),.CCB_P[C_ADDR]);	!  event
;	  1058	    $NM_LOG_END(4^6+$XPT$E_AGE,-1);		! 
;	  1059	    return;
;	  1060	    end;
;	  1061	
;	  1062	!
;	  1063	!  Spawn a CCB for the packet
;	  1064	!
;	  1065	
;	  1066	if not CCBGT$(CCB) then begin		!Couldn't get
;	  1067	    TOSS(.CCB_P,.OLINE,.ILINE,.DEST);	! a CCB - get
;	  1068	    return;				! rid of packet
;	  1069	    end;
;	  1070	CCB[C_STK] = .CCB_P;			!Chain pass-through to spawned CCB
;	  1071	CCB[C_PRM4] = 0;
;	  1072	
;	  1073	!
;	  1074	!  Destination is unreachable
;	  1075	!
;	  1076	
;	  1077	LINEb = $XPT_GET_LINE_DB(.OLINE);
;	  1078	if not begin
;	  1079	    if .DEST gtru NN then (RET = $XPT$E_RNG; FALSE)
;	  1080	    else if (not .Reach
;	  1081	    or ((.OLINE neq 0) and (.LINEstate neq RU))) then
;	  1082		(RET = $XPT$E_UNR; FALSE)
;	  1083	    else TRUE
;	  1084	    end
;	  1085	then begin
;	  1086	    UNREACH(.CCB,.CCB_P,.SOURCE,.DEST,.RFLG,.RET);
;	  1087	    LINEb = $XPT_GET_LINE_DB(.ILINE);
;	  1088	    COUNTER_INCREMENT(LINEb,XPTxit_rcv);
;	  1089	    return
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  27
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (4)

;	  1090	    end;
;	  1091	
;	  1092	!
;	  1093	!  Destination is Self
;	  1094	!
;	  1095	
;	  1096	if .OLINE eql 0 then
;	  1097	if .Local_node then begin
;	  1098	    CCB[C_BIAS] = .CCB_P[C_BIAS];		!Copy buffer
;	  1099	    CCB[C_ADDR] = ch$plus(.CCB_P[C_ADDR],6);	! descriptor, incrementing
;	  1100	    CCB[C_CNT] = .CCB_P[C_CNT] - 6;		!  past the routing header
;	  1101	    CCB[C_LIN] = .CCB_P[C_LIN];			!Set the line number
;	  1102	    LINEb = $XPT_GET_LINE_DB(.ILINE);           ! Increment "arriving
;	  1103	    COUNTER_INCREMENT(LINEb,XPTend_rcv);        !  packets" ctr
;	  1104	    if ECLFWD(.CCB,.SOURCE,.DEST,0)		!Pass the buffer to Forwarding
;	  1105	    neq CS_SUC					!Rejected -
;	  1106		then TOSS(.CCB,.OLINE,.ILINE,.DEST);	!  throw it away
;	  1107	    end
;	  1108	else BPT(XPT$_DNS,.DEST)	!Destination is not Self, but output line is 0
;	  1109	
;	  1110	!
;	  1111	!  Next node in path is Phase III
;	  1112	!
;	  1113	
;	  1114	else if ((.Nty eql Full)
;	  1115	or (.Nty eql Small)) then begin
;	  1116	    CCB[C_BIAS] = .CCB_P[C_BIAS];	!Copy the
;	  1117	    CCB[C_ADDR] = .CCB_P[C_ADDR];	!  buffer descriptor
;	  1118	    CCB[C_CNT] = .CCB_P[C_CNT];		!  from the pass-through to the spawn
;	  1119	    LINEb = $XPT_GET_LINE_DB(.ILINE);	!Increment "transit packet
;	  1120	    COUNTER_INCREMENT(LINEb,XPTxit_rcv);!  received" counter
;	  1121	    LINEb = $XPT_GET_LINE_DB(.OLINE);	!Address output line data base again
;	  1122	    RET = FORWARDER(.CCB,.OLINE);	!Try to send the buffer out
;	  1123	    if .RET eql CE_DIS then		!Rejected for unreachability -
;	  1124		UNREACH(.CCB,.CCB_P,.SOURCE,	!  do unreachablility
;	  1125		    .DEST,.RFLG,$XPT$E_UNR)	!  processing
;	  1126	    else if .RET neq CS_SUC then	!Rejected for congestion -
;	  1127		TOSS(.CCB,.OLINE,.ILINE,.DEST)	!  throw buffer away
;	  1128	    else COUNTER_INCREMENT(LINEb,XPTxit_xmt) ! Accepted - update packet counter
;	  1129	    end
;	  1130	
;	  1131	!
;	  1132	!  Destination is Phase II
;	  1133	!
;	  1134	
;	  1135	else if ((.Nty eql PhTwo)
;	  1136	or (.Nty eql TOPS20)) then begin
;	  1137	    LINEb = $XPT_GET_LINE_DB(.ILINE);	!Increment "transit packet
;	  1138	    COUNTER_INCREMENT(LINEb,XPTxit_rcv);!  received" counter
;	  1139	    LINEb = $XPT_GET_LINE_DB(.OLINE);	!Address output line data base
;	  1140	    if .Nid neq .DEST then begin	!Destination is not adjacent -
;	  1141		TERMINATE(.CCB,CE_DIS);		!  throw buffer away
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  28
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (4)

;	  1142		return;
;	  1143		end;
;	  1144	    RET = BLDPH2(.CCB,6,.DEST,		!Translate routing header
;	  1145		.SOURCE,.OLINE,.ILINE);		!  to Phase II
;	  1146	    if .RET eql CE_RTE then begin	!Resource failure -
;	  1147		UNSPAWN(.CCB);			!  get rid
;	  1148		TOSS(.CCB_P,.OLINE,.ILINE,.DEST)!  of buffer
;	  1149		end
;	  1150	    else if .RET eql CE_DIS then	!Unmappability -
;	  1151		UNREACH(.CCB,.CCB_P,SOURCE,	!  treat like
;	  1152		    .DEST,.RFLG,$XPT$E_UNR)	!  unreachability
;	  1153	    else begin				!Header built -
;	  1154		RET = FORWARDER(.CCB,.OLINE);	!  Try to forward the packet
;	  1155		if .RET eql CE_DIS then		!  Unreachable
;	  1156		    UNREACH(.CCB,.CCB_P,SOURCE,
;	  1157			.DEST,.RFLG,$XPT$E_UNR)
;	  1158		else if .RET neq CS_SUC then begin !  Congestion
;	  1159		    UNSPAWN(.CCB);
;	  1160		    TOSS(.CCB_P,.OLINE,.ILINE,.DEST);
;	  1161		    end
;	  1162		else begin
;	  1163		    COUNTER_INCREMENT(LINEb,XPTxit_xmt);! Update packet counter
;	  1164		    if .Nty eql PhTwo then
;	  1165			CALL$E(INTPH2,PD_XPE,.CCB_P,1,DEST,SOURCE)
;	  1166		    end
;	  1167		end
;	  1168	    end
;	  1169	
;	  1170	!
;	  1171	!  Invalid adjacent node type
;	  1172	!
;	  1173	
;	  1174	else BPT(XPT$_IANT,.Nty);
;	  1175	return;
;	  1176	end;					!End of RCVDAT


						.SBTTL	RCVDAT
000000	004167  000000G			RCVDAT::
					U.2:	JSR	R1,$SAVE5			;					0792
000004	162706  000022 				SUB	#22,SP
000010	016666  000040  000010 			MOV	40(SP),10(SP)			; CCB.P,*				1028
000016	012700  000016 				MOV	#16,R0
000022	066600  000010 				ADD	10(SP),R0
000026	010066  000006 				MOV	R0,6(SP)
000032	011067  000000G				MOV	(R0),KISAR6
000036	012700  000020 				MOV	#20,R0
000042	066600  000010 				ADD	10(SP),R0
000046	010066  000004 				MOV	R0,4(SP)
000052	011000 					MOV	(R0),R0				; *,PTR
000054	112066  000002 				MOVB	(R0)+,2(SP)			; PTR,RFLG				1029
000060	105066  000003 				CLRB	3(SP)				; RFLG
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  29
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (4)

000064	112066  000020 				MOVB	(R0)+,20(SP)			; PTR,X					1030
000070	112066  000021 				MOVB	(R0)+,21(SP)			; PTR,X
000074	016666  000020  000014 			MOV	20(SP),14(SP)			; X,DEST
000102	112066  000020 				MOVB	(R0)+,20(SP)			; PTR,X					1031
000106	112066  000021 				MOVB	(R0)+,21(SP)			; PTR,X
000112	016666  000020  000016 			MOV	20(SP),16(SP)			; X,SOURCE
000120	005001 					CLR	R1				; VISIT					1032
000122	151001 					BISB	(R0),R1				; PTR,VISIT
000124	005201 					INC	R1				; VISIT					1033
000126	110110 					MOVB	R1,(R0)				; VISIT,PTR				1034
000130	016602  000014 				MOV	14(SP),R2			; DEST,*				1040
000134	010200 					MOV	R2,R0
000136	004767  000000G				JSR	PC,GTNODE
000142	010016 					MOV	R0,(SP)				; *,NODEB
000144	005003 					CLR	R3				; OLINE					1041
000146	032710  000400 				BIT	#400,(R0)			; *,NODEB				1042
000152	001001 					BNE	1$
000154	111003 					MOVB	(R0),R3				; NODEB,OLINE
000156	016600  000010 			1$:	MOV	10(SP),R0			;					1043
000162	116066  000010  000012 			MOVB	10(R0),12(SP)			; *,ILINE
000170	105066  000013 				CLRB	13(SP)				; ILINE
000174	016600  000012 				MOV	12(SP),R0			; ILINE,*				1044
000200	004767  000000G				JSR	PC,GTLINE
000204	010005 					MOV	R0,R5				; *,LINEB
000206	016700  000002G				MOV	.CRDAT+2,R0			;					1050
000212	020160  000050 				CMP	R1,50(R0)			; VISIT,*
000216	101011 					BHI	2$
000220	032766  000020  000002 			BIT	#20,2(SP)			; *,RFLG				1051
000226	001456 					BEQ	3$
000230	016000  000050 				MOV	50(R0),R0
000234	006300 					ASL	R0
000236	020100 					CMP	R1,R0				; VISIT,*
000240	101451 					BLOS	3$
000242	016646  000010 			2$:	MOV	10(SP),-(SP)			;					1053
000246	012746  177760 				MOV	#-20,-(SP)
000252	004767  000000G				JSR	PC,TERMINATE
000256	016700  000002G				MOV	.CRDAT+2,R0			;					1054
000262	062700  000130 				ADD	#130,R0
000266	004767  000000G				JSR	PC,$IC8
000272	010500 					MOV	R5,R0				; LINEB,*				1055
000274	062700  000070 				ADD	#70,R0
000300	004767  000000G				JSR	PC,$IC32
000304	004767  000000G				JSR	PC,$NLBEG			;					1056
000310	017616  000010 				MOV	@10(SP),(SP)			;					1057
000314	012746  000001 				MOV	#1,-(SP)
000320	012746  000000G				MOV	#PKTA.HDR,-(SP)
000324	016700  000002G				MOV	.CRDAT+2,R0
000330	005046 					CLR	-(SP)
000332	116016  000002 				MOVB	2(R0),(SP)
000336	004767  000000G				JSR	PC,$CALLE
000342	012700  000400 				MOV	#400,R0				;					1058
000346	012701  177777 				MOV	#-1,R1
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  30
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (4)

000352	004767  000000G				JSR	PC,$NLEND
000356	062706  000012 				ADD	#12,SP				;					1050
000362	000571 					BR	12$				;					1052
000364	004767  000000G			3$:	JSR	PC,$CCBGT			;					1066
000370	103003 					BHIS	4$
000372	016646  000010 				MOV	10(SP),-(SP)			;					1067
000376	000541 					BR	10$
000400	016664  000010  000004 		4$:	MOV	10(SP),4(R4)			; *,*(CCB)				1070
000406	005064  000032 				CLR	32(R4)				; *(CCB)				1071
000412	010300 					MOV	R3,R0				; OLINE,*				1077
000414	004767  000000G				JSR	PC,GTLINE
000420	010005 					MOV	R0,R5				; *,LINEB
000422	016700  000002G				MOV	.CRDAT+2,R0			;					1079
000426	020260  000016 				CMP	R2,16(R0)
000432	101403 					BLOS	5$
000434	012701  000002 				MOV	#2,R1				; *,RET
000440	000412 					BR	7$
000442	005776  000000 			5$:	TST	@0(SP)				; NODEB					1080
000446	100005 					BPL	6$
000450	005703 					TST	R3				; OLINE					1081
000452	001436 					BEQ	9$
000454	121527  000010 				CMPB	(R5),#10			; LINEB,*
000460	001431 					BEQ	8$
000462	012701  000001 			6$:	MOV	#1,R1				; *,RET					1082
000466	010446 				7$:	MOV	R4,-(SP)			; CCB,*					1086
000470	016646  000012 				MOV	12(SP),-(SP)
000474	016646  000022 				MOV	22(SP),-(SP)			; SOURCE,*
000500	010246 					MOV	R2,-(SP)
000502	016646  000012 				MOV	12(SP),-(SP)			; RFLG,*
000506	010146 					MOV	R1,-(SP)			; RET,*
000510	004767  176732 				JSR	PC,U.22
000514	016600  000026 				MOV	26(SP),R0			; ILINE,*				1087
000520	004767  000000G				JSR	PC,GTLINE
000524	010005 					MOV	R0,R5				; *,LINEB
000526	062700  000070 				ADD	#70,R0				;					1088
000532	004767  000000G				JSR	PC,$IC32
000536	062706  000014 				ADD	#14,SP				;					1078
000542	000501 					BR	12$				;					1085
000544	005703 				8$:	TST	R3				; OLINE					1096
000546	001101 					BNE	13$
000550	032776  000400  000000 		9$:	BIT	#400,@0(SP)			; *,NODEB				1097
000556	001462 					BEQ	11$
000560	017664  000006  000016 			MOV	@6(SP),16(R4)			; *,*(CCB)				1098
000566	017664  000004  000020 			MOV	@4(SP),20(R4)			; *,*(CCB)				1099
000574	062764  000006  000020 			ADD	#6,20(R4)			; *,*(CCB)
000602	016600  000010 				MOV	10(SP),R0			;					1100
000606	016064  000022  000022 			MOV	22(R0),22(R4)			; *,*(CCB)
000614	162764  000006  000022 			SUB	#6,22(R4)			; *,*(CCB)
000622	116064  000010  000010 			MOVB	10(R0),10(R4)			; *,*(CCB)				1101
000630	016600  000012 				MOV	12(SP),R0			; ILINE,*				1102
000634	004767  000000G				JSR	PC,GTLINE
000640	010005 					MOV	R0,R5				; *,LINEB
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  31
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (4)

000642	062700  000056 				ADD	#56,R0				;					1103
000646	004767  000000G				JSR	PC,$IC32
000652	010446 					MOV	R4,-(SP)			; CCB,*					1104
000654	016646  000020 				MOV	20(SP),-(SP)			; SOURCE,*
000660	010246 					MOV	R2,-(SP)
000662	005046 					CLR	-(SP)
000664	004767  000000G				JSR	PC,ECLFWD
000670	062706  000010 				ADD	#10,SP
000674	005300 					DEC	R0				;					1105
000676	001423 					BEQ	12$
000700	010446 					MOV	R4,-(SP)			; CCB,*					1106
000702	010346 				10$:	MOV	R3,-(SP)			; OLINE,*
000704	016646  000016 				MOV	16(SP),-(SP)			; ILINE,*
000710	010246 					MOV	R2,-(SP)
000712	004767  176356 				JSR	PC,U.19
000716	062706  000010 				ADD	#10,SP
000722	000411 					BR	12$				;					1097
000724	010246 				11$:	MOV	R2,-(SP)			;					1108
000726	012746  100032 				MOV	#-77746,-(SP)
000732	012746  000002 				MOV	#2,-(SP)
000736	004767  000000G				JSR	PC,$IGNAL
000742	062706  000006 				ADD	#6,SP
000746	000167  000730 			12$:	JMP	29$				;					1096
000752	116500  000002 			13$:	MOVB	2(R5),R0			; *(LINEB),*				1114
000756	020027  000002 				CMP	R0,#2
000762	001403 					BEQ	14$
000764	020027  000003 				CMP	R0,#3				;					1115
000770	001102 					BNE	17$
000772	017664  000006  000016 		14$:	MOV	@6(SP),16(R4)			; *,*(CCB)				1116
001000	017664  000004  000020 			MOV	@4(SP),20(R4)			; *,*(CCB)				1117
001006	016600  000010 				MOV	10(SP),R0			;					1118
001012	016064  000022  000022 			MOV	22(R0),22(R4)			; *,*(CCB)
001020	016600  000012 				MOV	12(SP),R0			; ILINE,*				1119
001024	004767  000000G				JSR	PC,GTLINE
001030	010005 					MOV	R0,R5				; *,LINEB
001032	062700  000070 				ADD	#70,R0				;					1120
001036	004767  000000G				JSR	PC,$IC32
001042	010300 					MOV	R3,R0				; OLINE,*				1121
001044	004767  000000G				JSR	PC,GTLINE
001050	010005 					MOV	R0,R5				; *,LINEB
001052	010446 					MOV	R4,-(SP)			; CCB,*					1122
001054	010346 					MOV	R3,-(SP)			; OLINE,*
001056	004767  000000G				JSR	PC,FORWARDER
001062	010001 					MOV	R0,R1				; *,RET
001064	020127  177520 				CMP	R1,#-260			; RET,*					1123
001070	001017 					BNE	15$
001072	010416 					MOV	R4,(SP)				; CCB,*					1124
001074	016646  000014 				MOV	14(SP),-(SP)
001100	016646  000024 				MOV	24(SP),-(SP)			; SOURCE,*
001104	010246 					MOV	R2,-(SP)
001106	016646  000014 				MOV	14(SP),-(SP)			; RFLG,*
001112	012746  000001 				MOV	#1,-(SP)
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  32
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (4)

001116	004767  176324 				JSR	PC,U.22
001122	062706  000012 				ADD	#12,SP
001126	000460 					BR	19$				;					1123
001130	020127  000001 			15$:	CMP	R1,#1				; RET,*					1126
001134	001412 					BEQ	16$
001136	010416 					MOV	R4,(SP)				; CCB,*					1127
001140	010346 					MOV	R3,-(SP)			; OLINE,*
001142	016646  000020 				MOV	20(SP),-(SP)			; ILINE,*
001146	010246 					MOV	R2,-(SP)
001150	004767  176120 				JSR	PC,U.19
001154	062706  000006 				ADD	#6,SP
001160	000443 					BR	19$				;					1126
001162	010500 				16$:	MOV	R5,R0				; LINEB,*				1128
001164	062700  000074 				ADD	#74,R0
001170	004767  000000G				JSR	PC,$IC32
001174	000435 					BR	19$				;					1114
001176	020027  000004 			17$:	CMP	R0,#4				;					1135
001202	001405 					BEQ	18$
001204	020027  000005 				CMP	R0,#5				;					1136
001210	001402 					BEQ	18$
001212	000167  000442 				JMP	26$
001216	016600  000012 			18$:	MOV	12(SP),R0			; ILINE,*				1137
001222	004767  000000G				JSR	PC,GTLINE
001226	010005 					MOV	R0,R5				; *,LINEB
001230	062700  000070 				ADD	#70,R0				;					1138
001234	004767  000000G				JSR	PC,$IC32
001240	010300 					MOV	R3,R0				; OLINE,*				1139
001242	004767  000000G				JSR	PC,GTLINE
001246	010005 					MOV	R0,R5				; *,LINEB
001250	026502  000004 				CMP	4(R5),R2			; *(LINEB),*				1140
001254	001407 					BEQ	20$
001256	010446 					MOV	R4,-(SP)			; CCB,*					1141
001260	012746  177520 				MOV	#-260,-(SP)
001264	004767  000000G				JSR	PC,TERMINATE
001270	000167  000404 			19$:	JMP	28$				;					1140
001274	010446 				20$:	MOV	R4,-(SP)			; CCB,*					1144
001276	012746  000006 				MOV	#6,-(SP)
001302	010246 					MOV	R2,-(SP)
001304	016646  000024 				MOV	24(SP),-(SP)			; SOURCE,*
001310	010346 					MOV	R3,-(SP)			; OLINE,*
001312	016646  000024 				MOV	24(SP),-(SP)			; ILINE,*
001316	004767  000000V				JSR	PC,U.4
001322	010001 					MOV	R0,R1				; *,RET
001324	020127  177730 				CMP	R1,#-50				; RET,*					1146
001330	001015 					BNE	21$
001332	010416 					MOV	R4,(SP)				; CCB,*					1147
001334	004767  000000G				JSR	PC,UNSPAWN
001340	016616  000024 				MOV	24(SP),(SP)			;					1148
001344	010346 					MOV	R3,-(SP)			; OLINE,*
001346	016646  000030 				MOV	30(SP),-(SP)			; ILINE,*
001352	010246 					MOV	R2,-(SP)
001354	004767  175714 				JSR	PC,U.19
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  33
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (4)

001360	022626 					CMP	(SP)+,(SP)+			;					1146
001362	000533 					BR	25$
001364	020127  177520 			21$:	CMP	R1,#-260			; RET,*					1150
001370	001020 					BNE	22$
001372	010416 					MOV	R4,(SP)				; CCB,*					1151
001374	016646  000024 				MOV	24(SP),-(SP)
001400	012746  000036 				MOV	#36,-(SP)
001404	060616 					ADD	SP,(SP)				; SOURCE,*
001406	010246 					MOV	R2,-(SP)
001410	016646  000024 				MOV	24(SP),-(SP)			; RFLG,*
001414	012746  000001 				MOV	#1,-(SP)
001420	004767  176022 				JSR	PC,U.22
001424	062706  000010 				ADD	#10,SP
001430	000510 					BR	25$				;					1150
001432	010416 				22$:	MOV	R4,(SP)				; CCB,*					1154
001434	010346 					MOV	R3,-(SP)			; OLINE,*
001436	004767  000000G				JSR	PC,FORWARDER
001442	010001 					MOV	R0,R1				; *,RET
001444	020127  177520 				CMP	R1,#-260			; RET,*					1155
001450	001020 					BNE	23$
001452	010416 					MOV	R4,(SP)				; CCB,*					1156
001454	016646  000026 				MOV	26(SP),-(SP)
001460	012746  000040 				MOV	#40,-(SP)
001464	060616 					ADD	SP,(SP)				; SOURCE,*
001466	010246 					MOV	R2,-(SP)
001470	016646  000026 				MOV	26(SP),-(SP)			; RFLG,*
001474	012746  000001 				MOV	#1,-(SP)
001500	004767  175742 				JSR	PC,U.22
001504	062706  000012 				ADD	#12,SP
001510	000460 					BR	25$				;					1155
001512	005301 				23$:	DEC	R1				; RET					1158
001514	001416 					BEQ	24$
001516	010416 					MOV	R4,(SP)				; CCB,*					1159
001520	004767  000000G				JSR	PC,UNSPAWN
001524	016616  000026 				MOV	26(SP),(SP)			;					1160
001530	010346 					MOV	R3,-(SP)			; OLINE,*
001532	016646  000032 				MOV	32(SP),-(SP)			; ILINE,*
001536	010246 					MOV	R2,-(SP)
001540	004767  175530 				JSR	PC,U.19
001544	062706  000006 				ADD	#6,SP				;					1158
001550	000440 					BR	25$
001552	010500 				24$:	MOV	R5,R0				; LINEB,*				1163
001554	062700  000074 				ADD	#74,R0
001560	004767  000000G				JSR	PC,$IC32
001564	126527  000002  000004 			CMPB	2(R5),#4			; *(LINEB),*				1164
001572	001027 					BNE	25$
001574	012716  000034 				MOV	#34,(SP)			;					1165
001600	060616 					ADD	SP,(SP)				; SOURCE,*
001602	012746  000034 				MOV	#34,-(SP)
001606	060616 					ADD	SP,(SP)				; DEST,*
001610	012746  000001 				MOV	#1,-(SP)
001614	016646  000032 				MOV	32(SP),-(SP)
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  34
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (4)

001620	012746  000004 				MOV	#4,-(SP)
001624	012746  000000G				MOV	#INTPH2,-(SP)
001630	016700  000002G				MOV	.CRDAT+2,R0
001634	005046 					CLR	-(SP)
001636	116016  000002 				MOVB	2(R0),(SP)
001642	004767  000000G				JSR	PC,$CALLE
001646	062706  000014 				ADD	#14,SP
001652	062706  000010 			25$:	ADD	#10,SP				;					1136
001656	000407 					BR	27$				;					1135
001660	010046 				26$:	MOV	R0,-(SP)			;					1174
001662	012746  100042 				MOV	#-77736,-(SP)
001666	012746  000002 				MOV	#2,-(SP)
001672	004767  000000G				JSR	PC,$IGNAL
001676	005726 				27$:	TST	(SP)+				;					1135
001700	022626 				28$:	CMP	(SP)+,(SP)+			;					1114
001702	062706  000022 			29$:	ADD	#22,SP				;					0792
001706	000207 					RTS	PC

; Routine Size:  484 words,	Routine Base:  $CODE$ + 2120
; Maximum stack depth per invocation:  29 words
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  35
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

;	  1177	
;	  1178	global
;	  1179	routine RCVPH2 (CCB_P): novalue =
;	  1180	
;	  1181	!++
;	  1182	! FUNCTIONAL DESCRIPTION:
;	  1183	!
;	  1184	!  This routine processes data packets received from the Data
;	  1185	! Link Layer which have Phase II routing headers.  It translates
;	  1186	! the routing header to determine the output line (or local
;	  1187	! Transport user) corresponding to the specified destination,
;	  1188	! and attempts to forward the packet to that destination.  If
;	  1189	! the destination is unreachable, the routine will return a DC to
;	  1190	! the caller.  If the packet is for Self  (a local Transport user),
;	  1191	! the spawned CCB is set up to point past the  routing header,
;	  1192	! and the packet is forwarded to the ECL.  If the destination node
;	  1193	! is also a Phase II node, the packet will be sent to the
;	  1194	! destination unchanged.  If the immediate next node over the
;	  1195	! output line is a Phase III node, routine BLDPH3 will be called
;	  1196	! to build a new routing header and point the spawned CCB to it.
;	  1197	! If the destination node address cannot be determined, the packet
;	  1198	! will always be discarded.  If, for congestion or resource reasons,
;	  1199	! the packet cannot be forwarded at the time, it will be queued for
;	  1200	! eventual reprocessing if either the source or destination is a
;	  1201	! standard Phase II node; otherwise, it will be discarded.
;	  1202	!
;	  1203	! FORMAL PARAMETERS
;	  1204	!
;	  1205	!	CCB_P - CCB for the received packet; the "pass-through" CCB
;	  1206	!
;	  1207	! IMPLICIT INPUTS
;	  1208	!
;	  1209	!	Reach, OL, Nty, Nid, User
;	  1210	!
;	  1211	! ROUTINE VALUE:
;	  1212	! COMPLETION CODES:
;	  1213	!
;	  1214	!	NONE.
;	  1215	!
;	  1216	! SIDE EFFECTS:
;	  1217	!
;	  1218	!	May temporarily modify the buffer descriptor for the pass-through CCB.
;	  1219	!
;	  1220	!--
;	  1221	
;	  1222	begin
;	  1223	
;	  1224	forward routine TOSS: novalue;
;	  1225	
;	  1226	
;	  1227	!***********************************************!
;	  1228	!						!
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  36
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

;	  1229	!  Routine to handle "unreachability" case	!
;	  1230	!						!
;	  1231	!***********************************************!
;	  1232	
;	  1233	routine UNREACH (CCB,CCB_P,ILINE,CODE): novalue =
;	  1234	begin
;	  1235	map CCB: ref block field (C_XPT_fields);
;	  1236	local LINEb;
;	  1237	require 'XPTSYM';
;	  1274	map CCB_P: ref block field(C_XPT_fields);
;	  1275	local LENS,LEND,LINKS,LINKD,RET;
;	  1276	local WORKD: vector[3], WORKS: vector[3];
;	  1277	pointer PTR;
;	  1278	
;	  1279	!
;	  1280	!  Map in the pass-through buffer; address input line data base
;	  1281	!
;	  1282	
;	  1283	MAPBUF(.CCB_P,PTR);
;	  1284	LINEb = $XPT_GET_LINE_DB(.ILINE);
;	  1285	
;	  1286	!
;	  1287	!  Update node counters and signal an event
;	  1288	!
;	  1289	
;	  1290	if .CODE eql $XPT$E_UNR then			! Update
;	  1291	    COUNTER_INCREMENT(XPTDB,XPTunreach_loss)    !   "unreachability"
;	  1292	else if .CODE eql $XPT$E_RNG then		!   or "node out of
;	  1293	    COUNTER_INCREMENT(XPTDB,XPTrange_loss)      !   range" or "header
;	  1294	else COUNTER_INCREMENT(XPTDB,XPTfmt_loss);      !   format error" counter
;	  1295	RET = getb(PTR);				! Pick up "routing flags"
;	  1296	if bitoff(.RET,2) then RET = 5			! No routing header
;	  1297	else begin					! Routing header -
;	  1298	    RET = getb(PTR);				!   pick up the first node lgth
;	  1299	    PTR = ch$plus(.PTR,.RET);			!   jump over the node name
;	  1300	    RET = .RET + getb(PTR) + 2 + 1 + 5;		!   add in second node lgth
;	  1301	    end;					!   and the rthdr & NSP hdr
;	  1302	RET = MINU(.RET,55);				!   (but don't overflow buffer)
;	  1303	MAPBUF(.CCB_P,PTR);
;	  1304	$NM_LOG_BEGIN();
;	P 1305	PARAMETER_HI((if .CODE eql $XPT$E_FMT then 1 else 0),
;	  1306	             .RET,.PTR);                        ! Move "packet beginning" into
;	  1307	$NM_LOG_END(4^6+.CODE,.NMXid);			! Log the event
;	  1308	
;	  1309	!
;	  1310	!  If the message came from a Phase II+ node, just toss it away
;	  1311	!
;	  1312	
;	  1313	if .Nty eql TOPS20 then begin
;	  1314	    TOSS(.CCB,0,0,.ILINE);
;	  1315	    return;
;	  1316	    end;
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  37
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

;	  1317	
;	  1318	!
;	  1319	!  If the incoming message had a routing header, build the DC routing header
;	  1320	!  by reversing the destination and source fields in the input routing header
;	  1321	!
;	  1322	
;	  1323	RET = getb(PTR);			!Pick up routing or message flags
;	  1324	if bitoff(.RET,2) then			!No routing header -
;	  1325	    LEND = 0				!  set "no header" indication
;	  1326	else begin				!  NOTE: source/dest names switched
;	  1327						!		***
;	  1328	    LENS = getb(PTR);			!Pick up destination node name length
;	  1329	    ch$move(MINU(.LENS,6),.PTR,		!Save destination
;	  1330		byt$ptr(WORKS,0));		!  name field
;	  1331	    PTR = ch$plus(.PTR,.LENS);		!Advance over name
;	  1332	    LEND = getb(PTR);			!Pick up source node name length
;	  1333	    ch$move(MINU(.LEND,6),.PTR,		!Save source
;	  1334		byt$ptr(WORKD,0));		!  name field
;	  1335	    PTR = ch$plus(.PTR,.LEND);		!Advance over name
;	  1336	    RET = getb(PTR);			!Pick up MSGFLGS
;	  1337	    end;
;	  1338	
;	  1339	LINKS = getw(PTR);			!Get destination and source link
;	  1340	LINKD = getw(PTR);			!  addresses, and switch them
;	  1341	
;	  1342	!
;	  1343	!  Build a DC message with the specified disconnect code
;	  1344	!
;	  1345	
;	  1346	if .RET eql DC_MSGflgs then begin	!If the message was a DC,
;	  1347	    TERMINATE(.CCB,CE_DIS);		!  ignore it
;	  1348	    return;
;	  1349	    end;
;	  1350	
;	  1351	if .CCB [C_XPT_ADJUST] neq 0 then begin	!Un-adjust the spawned CCB
;	  1352	    CCB_P[C_ADDR] = ch$plus(.CCB_P[C_ADDR],-.CCB[C_XPT_ADJUST]);
;	  1353	    CCB_P[C_CNT] = .CCB_P[C_CNT] + .CCB[C_XPT_ADJUST];
;	  1354	    end;
;	  1355	    
;	  1356	CCB[C_XPT_TYPE] = 0;
;	  1357	CCB[C_XPT_ADJUST] = 0;
;	  1358	CCB[C_BIAS] = .CCB_P[C_BIAS];		!Copy pass-through
;	  1359	CCB[C_ADDR] = .CCB_P[C_ADDR];		!  buffer descriptor into spawn
;	  1360	CCB[C_CHN] = 0;
;	  1361	
;	  1362	INPUTcount = .INPUTcount - 1;		!Finish up bookkeeping
;	  1363	DLLquota = .DLLquota + 1;		!  for the buffer
;	  1364	
;	P 1365	CALL$E(SEND_DC,(PD_XPE),.CCB,.LINEb,
;	P 1366	    .LEND,byt$ptr(WORKD,0),.LENS,byt$ptr(WORKS,0),.LINKD,.LINKS,
;	  1367	    (if .CODE eql $XPT$E_FMT then MISC_ERROR else NO_PATH_ERROR));
;	  1368	
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  38
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

;	  1369	end;


						.GLOBL	$DPHI, SEND.DC


						.SBTTL	UNREACH
000000	004167  000000G			; UNREACH
					U.28:	JSR	R1,$SAVE5			;					1233
000004	162706  000026 				SUB	#26,SP
000010	016605  000050 				MOV	50(SP),R5			; CCB.P,*				1283
000014	016567  000016  000000G			MOV	16(R5),KISAR6
000022	012766  000020  000002 			MOV	#20,2(SP)
000030	060566  000002 				ADD	R5,2(SP)
000034	017602  000002 				MOV	@2(SP),R2			; *,PTR
000040	016600  000046 				MOV	46(SP),R0			; ILINE,*				1284
000044	004767  000000G				JSR	PC,GTLINE
000050	010016 					MOV	R0,(SP)				; *,LINEB
000052	016700  000002G				MOV	.CRDAT+2,R0			;					1291
000056	016604  000044 				MOV	44(SP),R4			; CODE,*				1290
000062	020427  000001 				CMP	R4,#1
000066	001007 					BNE	1$
000070	012701  000136 				MOV	#136,R1				;					1291
000074	060001 					ADD	R0,R1
000076	005211 					INC	(R1)
000100	001014 					BNE	4$
000102	005311 					DEC	(R1)
000104	000412 					BR	4$				;					1290
000106	020427  000002 			1$:	CMP	R4,#2				;					1292
000112	001003 					BNE	2$
000114	062700  000131 				ADD	#131,R0				;					1293
000120	000402 					BR	3$
000122	062700  000133 			2$:	ADD	#133,R0				;					1294
000126	004767  000000G			3$:	JSR	PC,$IC8
000132	005003 				4$:	CLR	R3				; RET					1295
000134	152203 					BISB	(R2)+,R3			; PTR,RET
000136	032703  000002 				BIT	#2,R3				; *,RET					1296
000142	001003 					BNE	5$
000144	012703  000005 				MOV	#5,R3				; *,RET
000150	000411 					BR	6$
000152	005003 				5$:	CLR	R3				; RET					1298
000154	152203 					BISB	(R2)+,R3			; PTR,RET
000156	060302 					ADD	R3,R2				; RET,PTR				1299
000160	005000 					CLR	R0				;					1300
000162	152200 					BISB	(R2)+,R0			; PTR,*
000164	060300 					ADD	R3,R0				; RET,*
000166	010003 					MOV	R0,R3				; *,RET
000170	062703  000010 				ADD	#10,R3				; *,RET
000174	010300 				6$:	MOV	R3,R0				; RET,*					1302
000176	020027  000067 				CMP	R0,#67
000202	101402 					BLOS	7$
000204	012700  000067 				MOV	#67,R0
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  39
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

000210	010003 				7$:	MOV	R0,R3				; *,RET
000212	016567  000016  000000G			MOV	16(R5),KISAR6			;					1303
000220	017602  000002 				MOV	@2(SP),R2			; *,PTR
000224	004767  000000G				JSR	PC,$NLBEG			;					1304
000230	005066  000004 				CLR	4(SP)				;					1306
000234	020427  000004 				CMP	R4,#4
000240	001005 					BNE	8$
000242	005266  000004 				INC	4(SP)
000246	012746  000001 				MOV	#1,-(SP)
000252	000401 					BR	9$
000254	005046 				8$:	CLR	-(SP)
000256	010300 				9$:	MOV	R3,R0				; RET,*
000260	010201 					MOV	R2,R1				; PTR,*
000262	004767  000000G				JSR	PC,$DPHI
000266	062704  000400 				ADD	#400,R4				;					1307
000272	010400 					MOV	R4,R0
000274	016646  000002 				MOV	2(SP),-(SP)			; LINEB,*
000300	062716  000034 				ADD	#34,(SP)
000304	013601 					MOV	@(SP)+,R1
000306	004767  000000G				JSR	PC,$NLEND
000312	016600  000002 				MOV	2(SP),R0			; LINEB,*				1313
000316	126027  000002  000005 			CMPB	2(R0),#5			; *(LINEB),*
000324	001013 					BNE	10$
000326	016616  000054 				MOV	54(SP),(SP)			; CCB,*					1314
000332	005046 					CLR	-(SP)
000334	005046 					CLR	-(SP)
000336	016646  000054 				MOV	54(SP),-(SP)			; ILINE,*
000342	004767  000000V				JSR	PC,U.27
000346	062706  000010 				ADD	#10,SP				;					1313
000352	000500 					BR	15$
000354	005003 				10$:	CLR	R3				; RET					1323
000356	152203 					BISB	(R2)+,R3			; PTR,RET
000360	032703  000002 				BIT	#2,R3				; *,RET					1324
000364	001002 					BNE	11$
000366	005004 					CLR	R4				; LEND					1325
000370	000442 					BR	14$				;					1324
000372	005001 				11$:	CLR	R1				; LENS					1328
000374	152201 					BISB	(R2)+,R1			; PTR,LENS
000376	010116 					MOV	R1,(SP)				; LENS,*				1329
000400	020127  000006 				CMP	R1,#6
000404	101402 					BLOS	12$
000406	012716  000006 				MOV	#6,(SP)
000412	010246 				12$:	MOV	R2,-(SP)			; PTR,*					1330
000414	012746  000020 				MOV	#20,-(SP)
000420	060616 					ADD	SP,(SP)				; WORKS,*
000422	004767  000000G				JSR	PC,BL$MOV
000426	060102 					ADD	R1,R2				; LENS,PTR				1331
000430	005004 					CLR	R4				; LEND					1332
000432	152204 					BISB	(R2)+,R4			; PTR,LEND
000434	010416 					MOV	R4,(SP)				; LEND,*				1333
000436	020427  000006 				CMP	R4,#6
000442	101402 					BLOS	13$
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  40
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

000444	012716  000006 				MOV	#6,(SP)
000450	010246 				13$:	MOV	R2,-(SP)			; PTR,*					1334
000452	012746  000032 				MOV	#32,-(SP)
000456	060616 					ADD	SP,(SP)				; WORKD,*
000460	004767  000000G				JSR	PC,BL$MOV
000464	060402 					ADD	R4,R2				; LEND,PTR				1335
000466	005003 					CLR	R3				; RET					1336
000470	152203 					BISB	(R2)+,R3			; PTR,RET
000472	062706  000010 				ADD	#10,SP				;					1326
000476	112266  000012 			14$:	MOVB	(R2)+,12(SP)			; PTR,X					1339
000502	112266  000013 				MOVB	(R2)+,13(SP)			; PTR,X
000506	016666  000012  000010 			MOV	12(SP),10(SP)			; X,LINKS
000514	112266  000012 				MOVB	(R2)+,12(SP)			; PTR,X					1340
000520	112266  000013 				MOVB	(R2)+,13(SP)			; PTR,X
000524	016602  000012 				MOV	12(SP),R2			; X,LINKD
000530	020327  000110 				CMP	R3,#110				; RET,*					1346
000534	001010 					BNE	16$
000536	016616  000054 				MOV	54(SP),(SP)			; CCB,*					1347
000542	012746  177520 				MOV	#-260,-(SP)
000546	004767  000000G				JSR	PC,TERMINATE
000552	022626 					CMP	(SP)+,(SP)+			;					1346
000554	000522 				15$:	BR	20$
000556	016603  000054 			16$:	MOV	54(SP),R3			; CCB,*					1351
000562	012700  000032 				MOV	#32,R0
000566	060300 					ADD	R3,R0
000570	105760  000001 				TSTB	1(R0)
000574	001423 					BEQ	17$
000576	116046  000001 				MOVB	1(R0),-(SP)			;					1352
000602	105716 					TSTB	(SP)
000604	006746 					SXT	-(SP)
000606	116616  000002 				MOVB	2(SP),(SP)
000612	162676  000006 				SUB	(SP)+,@6(SP)
000616	116016  000001 				MOVB	1(R0),(SP)			;					1353
000622	105716 					TSTB	(SP)
000624	006746 					SXT	-(SP)
000626	116616  000002 				MOVB	2(SP),(SP)
000632	066516  000022 				ADD	22(R5),(SP)
000636	012665  000022 				MOV	(SP)+,22(R5)
000642	005726 					TST	(SP)+
000644	105010 				17$:	CLRB	(R0)				;					1356
000646	105060  000001 				CLRB	1(R0)				;					1357
000652	016563  000016  000016 			MOV	16(R5),16(R3)			;					1358
000660	017663  000004  000020 			MOV	@4(SP),20(R3)			;					1359
000666	005063  000002 				CLR	2(R3)				;					1360
000672	016605  000002 				MOV	2(SP),R5			; LINEB,*				1362
000676	105365  000043 				DECB	43(R5)				; *(LINEB)
000702	016705  000002G				MOV	.CRDAT+2,R5
000706	105265  000035 				INCB	35(R5)				;					1363
000712	032766  000001  000006 			BIT	#1,6(SP)			;					1367
000720	001403 					BEQ	18$
000722	012716  000007 				MOV	#7,(SP)
000726	000402 					BR	19$
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  41
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

000730	012716  000047 			18$:	MOV	#47,(SP)
000734	016646  000010 			19$:	MOV	10(SP),-(SP)			; LINKS,*
000740	010246 					MOV	R2,-(SP)			; LINKD,*
000742	012746  000022 				MOV	#22,-(SP)
000746	060616 					ADD	SP,(SP)				; WORKS,*
000750	010146 					MOV	R1,-(SP)			; LENS,*
000752	012746  000034 				MOV	#34,-(SP)
000756	060616 					ADD	SP,(SP)				; WORKD,*
000760	010446 					MOV	R4,-(SP)			; LEND,*
000762	016646  000016 				MOV	16(SP),-(SP)			; LINEB,*
000766	010346 					MOV	R3,-(SP)
000770	012746  000011 				MOV	#11,-(SP)
000774	012746  000000G				MOV	#SEND.DC,-(SP)
001000	016700  000002G				MOV	.CRDAT+2,R0
001004	005046 					CLR	-(SP)
001006	116016  000002 				MOVB	2(R0),(SP)
001012	004767  000000G				JSR	PC,$CALLE
001016	062706  000030 				ADD	#30,SP				;					1234
001022	062706  000026 			20$:	ADD	#26,SP				;					1233
001026	000207 					RTS	PC

; Routine Size:  268 words,	Routine Base:  $CODE$ + 4030
; Maximum stack depth per invocation:  30 words


;	  1370	
;	  1371	
;	  1372	
;	  1373	!*******************************************************!
;	  1374	!							!
;	  1375	!  Routine to either throw away a packet or queue it	!
;	  1376	!  for eventual reprocessing				!
;	  1377	!							!
;	  1378	!*******************************************************!
;	  1379	
;	  1380	routine TOSS (CCB,OLINE,DEST,ILINE): novalue =
;	  1381	begin
;	  1382	map CCB: ref block field (C_XPT_fields);
;	  1383	
;	  1384	local LINEb;
;	  1385	require 'XPTSYM';
;	  1422	local CCB_P;
;	  1423	
;	  1424	CCB_P = .CCB[C_STK];
;	  1425	
;	  1426	if
;	  1427	    (begin
;	  1428	    LINEb = $XPT_GET_LINE_DB(.OLINE);
;	  1429	    (.OLINE neq 0)
;	  1430	    and (.Nty eql PhTwo)
;	  1431	    and (.Nid eql .DEST)
;	  1432	    end
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  42
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

;	  1433	or
;	  1434	    begin
;	  1435	    LINEb = $XPT_GET_LINE_DB(.ILINE);
;	  1436	    (.ILINE neq 0)
;	  1437	    and (.Nty eql PhTwo)
;	  1438	    end)
;	  1439	then RE_QUEUE (if .CCB[C_OWN] eql PD_XPT then
;	  1440			(UNSPAWN(.CCB); .CCB_P)
;	  1441		      else .CCB)
;	  1442	else begin
;	  1443	    if .OLINE neq 0 then begin
;	  1444		LINEb = $XPT_GET_LINE_DB(.OLINE);
;	  1445		COUNTER_INCREMENT(LINEb,XPTxit_cng);
;	  1446		end
;	  1447	    else begin
;	  1448		LINEb = $XPT_GET_LINE_DB(.ILINE);
;	  1449		COUNTER_INCREMENT(LINEb,XPTend_cng);
;	  1450		end;
;	  1451	    TERMINATE(.CCB,CE_RTE);
;	  1452	    end;
;	  1453	end;


						.SBTTL	TOSS
000000	004167  000000G			; TOSS
					U.27:	JSR	R1,$SAVE5			;					1380
000004	016602  000024 				MOV	24(SP),R2			; CCB,*					1424
000010	016205  000004 				MOV	4(R2),R5			; *,CCB.P
000014	016604  000022 				MOV	22(SP),R4			; OLINE,*				1428
000020	010400 					MOV	R4,R0
000022	004767  000000G				JSR	PC,GTLINE
000026	010001 					MOV	R0,R1				; *,LINEB
000030	005003 					CLR	R3				;					1429
000032	005704 					TST	R4
000034	001411 					BEQ	1$
000036	005203 					INC	R3
000040	126127  000002  000004 			CMPB	2(R1),#4			; *(LINEB),*				1430
000046	001004 					BNE	1$
000050	026166  000004  000020 			CMP	4(R1),20(SP)			; *(LINEB),DEST				1431
000056	001414 					BEQ	2$
000060	016600  000016 			1$:	MOV	16(SP),R0			; ILINE,*				1435
000064	004767  000000G				JSR	PC,GTLINE
000070	010001 					MOV	R0,R1				; *,LINEB
000072	005766  000016 				TST	16(SP)				; ILINE					1436
000076	001423 					BEQ	5$
000100	126127  000002  000004 			CMPB	2(R1),#4			; *(LINEB),*				1437
000106	001017 					BNE	5$
000110	016700  000002G			2$:	MOV	.CRDAT+2,R0			;					1439
000114	126260  000006  000004 			CMPB	6(R2),4(R0)
000122	001005 					BNE	3$
000124	010246 					MOV	R2,-(SP)			;					1440
000126	004767  000000G				JSR	PC,UNSPAWN
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  43
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

000132	010516 					MOV	R5,(SP)				; CCB.P,*				1439
000134	000401 					BR	4$
000136	010246 				3$:	MOV	R2,-(SP)
000140	004767  000000G			4$:	JSR	PC,RE.QUEUE
000144	000435 					BR	9$				;					1426
000146	006003 				5$:	ROR	R3				;					1443
000150	103012 					BCC	6$
000152	010400 					MOV	R4,R0				;					1444
000154	004767  000000G				JSR	PC,GTLINE
000160	010001 					MOV	R0,R1				; *,LINEB
000162	012700  000100 				MOV	#100,R0				;					1445
000166	060100 					ADD	R1,R0				; LINEB,*
000170	005210 					INC	(R0)
000172	001014 					BNE	8$
000174	000412 					BR	7$
000176	016600  000016 			6$:	MOV	16(SP),R0			; ILINE,*				1448
000202	004767  000000G				JSR	PC,GTLINE
000206	010001 					MOV	R0,R1				; *,LINEB
000210	012700  000066 				MOV	#66,R0				;					1449
000214	060100 					ADD	R1,R0				; LINEB,*
000216	005210 					INC	(R0)
000220	001001 					BNE	8$
000222	005310 				7$:	DEC	(R0)
000224	010246 				8$:	MOV	R2,-(SP)			;					1451
000226	012746  177730 				MOV	#-50,-(SP)
000232	004767  000000G				JSR	PC,TERMINATE
000236	005726 					TST	(SP)+				;					1442
000240	005726 				9$:	TST	(SP)+				;					1381
000242	000207 					RTS	PC				;					1380

; Routine Size:  82 words,	Routine Base:  $CODE$ + 5060
; Maximum stack depth per invocation:  9 words


;	  1454	
;	  1455	!*********************** START OF MAIN ROUTINE ************************!
;	  1456	
;	  1457	
;	  1458	local NODEb,LINEb;
;	  1459	require 'XPTSYM';
;	  1496	local CCB: ref block field (C_XPT_fields);
;	  1497	map CCB_P: ref block field(C_FIELDS);
;	  1498	pointer PTR;
;	  1499	local BUFLEN,DEST,SOURCE,OLINE,ILINE,RET,ISHDR,ICPTD;
;	  1500	literal NO_PATH_ERROR = 39;		!"No path" disconnect code
;	  1501	literal BAD_ROUT_HDR = 7;		!Disconnect code for invalid/no RTHDR
;	  1502	
;	  1503	!
;	  1504	!  Determine and validate the input line
;	  1505	!
;	  1506	
;	  1507	ILINE = .CCB_P[C_LIN];
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  44
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

;	  1508	LINEb = $XPT_GET_LINE_DB(.ILINE);
;	  1509	if ((.Nty neq TOPS20)				!Input line is
;	  1510	and (.Nty neq PhTwo)) then begin		!  not Phase II:
;	  1511	    local RET;					!
;	  1512	    RET = MIN(19,.CCB_P[C_CNT]);		!
;	  1513	    $NM_LOG_BEGIN();				!
;	  1514	    PARAMETER_HI(1,.RET,.CCB_P[C_ADDR]);	!    log a "packet
;	  1515	    $NM_LOG_END(4^6+$XPT$E_FMT,.NMXid);		!    format error" event
;	  1516	    TERMINATE(.CCB_P,CE_ERR);			!    and toss
;	  1517	    return;					!    the packet
;	  1518	    end;
;	  1519	
;	  1520	ICPTD = 0;
;	  1521	if .Nty eql PhTwo then ICPTD = .ICPTD + 1;      ! Not Phase II+ - flag that
;	  1522	
;	  1523	!
;	  1524	!  Spawn a CCB
;	  1525	!
;	  1526	
;	  1527	if not CCBGT$(CCB) then			!No CCB available - get rid of packet
;	  1528	    (TOSS(.CCB_P,0,0,.ILINE); return);
;	  1529	CCB[C_STK] = .CCB_P;			!Chain pass-through to spawned CCB
;	  1530	CCB[C_XPT_TYPE] = 0;                    !Initialize type code
;	  1531	CCB[C_XPT_ADJUST] = 0;			!  and adjustment factor
;	  1532	
;	  1533	!
;	  1534	!  Parse the routing header
;	  1535	!
;	  1536	
;	  1537	MAPBUF(.CCB_P,PTR);			! Map in the packet buffer
;	  1538	if biton (getb(PTR),2) then begin	! Routing header is present -
;	  1539	    RET = PH2HDR (ch$plus(.PTR,-1),.ILINE, !  map to source and
;	  1540		SOURCE,DEST);			!  destination addresses
;	  1541	    ISHDR = TRUE;			!  and indicate header is present
;	  1542	    end
;	  1543	else begin				!No routing header -
;	P 1544	    RET = CALL$E(INTPH2,PD_XPE,         !  "intercept"
;	  1545		.CCB_P,0,DEST,SOURCE);		!  the packet
;	  1546	    ISHDR = FALSE;			!  and indicate no header
;	  1547	    ICPTD = 0;				!  and that packet's already interceptd
;	  1548	    end;
;	  1549	if .RET leq 0 then			!Could not get destination -
;	  1550	    (UNREACH(.CCB,.CCB_P,.ILINE,-.RET); return); !throw away packet
;	  1551	
;	  1552	NODEb = $XPT_GET_NODE_DB(.DEST);        ! Address destination data base entry
;	  1553	
;	  1554	!
;	  1555	!  Determine the output line
;	  1556	!
;	  1557	
;	  1558	OLINE = 0;
;	  1559	if not .Local_node then OLINE = .OL;
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  45
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

;	  1560	LINEb = $XPT_GET_LINE_DB(.OLINE);
;	  1561	
;	  1562	!
;	  1563	!  Destination is unreachable
;	  1564	!
;	  1565	
;	  1566	if (not .Reach
;	  1567	or ((.OLINE neq 0) and (.LINEstate neq RU))) then begin
;	  1568	    LINEb = $XPT_GET_LINE_DB(.ILINE);
;	  1569	    COUNTER_INCREMENT(LINEb,XPTxit_rcv);
;	  1570	    UNREACH(.CCB,.CCB_P,.ILINE,$XPT$E_UNR);
;	  1571	    return;
;	  1572	    end;
;	  1573	
;	  1574	!
;	  1575	!  Destination is Self
;	  1576	!
;	  1577	
;	  1578	if .OLINE eql 0 then
;	  1579	if .Local_node then begin
;	  1580	    CCB[C_BIAS] = .CCB_P[C_BIAS];	!Copy buffer
;	  1581	    CCB[C_ADDR] = .CCB_P[C_ADDR];	!  descriptor into
;	  1582	    CCB[C_CNT] = .CCB_P[C_CNT];		!  spawned CCB
;	  1583	    CCB[C_LIN] = .CCB_P[C_LIN];		!Put in line number
;	  1584	    if .ISHDR then begin		!If packet has a header,
;	  1585		RET = getb(PTR);		!  pick up the destination name length
;	  1586		BUFLEN = 1 + 1 + .RET;		!  add it into header length
;	  1587		PTR = ch$plus(.PTR,.RET);	!  bump pointer past node name field
;	  1588		BUFLEN = .BUFLEN + 1+getb(PTR);	!  add source name length
;	  1589		CCB[C_ADDR] = ch$plus(.CCB[C_ADDR],.BUFLEN);
;	  1590		CCB[C_CNT] = .CCB[C_CNT] - .BUFLEN;
;	  1591		end;
;	  1592	    LINEb = $XPT_GET_LINE_DB(.ILINE);	!Map to input line data base
;	  1593	    COUNTER_INCREMENT(LINEb,XPTend_rcv);! Increment packets counter
;	  1594	    if ECLFWD(.CCB,			!Try to pass the buffer
;	  1595		.SOURCE,.DEST,0)		!  to the user process
;	  1596	    neq CS_SUC then			!If Forwarding rejected the packet,
;	  1597		TOSS(.CCB,0,0,.ILINE)		!  get rid of it
;	  1598	    else if .ICPTD then			!Otherwise, if there was
;	P 1599		CALL$E(INTPH2,PD_XPE,.CCB_P,	!  a header, intercept
;	  1600		    1,DEST,SOURCE)		!  the packet
;	  1601	    end
;	  1602	
;	  1603	else BPT(XPT$_DNS,.DEST)		!Invalid "self" destination
;	  1604	
;	  1605	!
;	  1606	!  Next node in path is Phase III
;	  1607	!
;	  1608	
;	  1609	else if ((.Nty eql Full)
;	  1610	or (.Nty eql Small)) then begin
;	  1611	    LINEb = $XPT_GET_LINE_DB(.ILINE);		!Address input line DB entry
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  46
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

;	  1612	    RET = BLDPH3(.CCB,.ISHDR,.DEST,.SOURCE,0);	!Build a Phase III header
;	  1613	    COUNTER_INCREMENT(LINEb,XPTxit_rcv);        ! Increment packets counter
;	  1614	    LINEb = $XPT_GET_LINE_DB(.OLINE);		!Address output line DB entry
;	  1615	    RET = FORWARDER(.CCB,.OLINE);		!Try to forward packet
;	  1616	    if .RET eql CE_DIS then			!If destination is unreachable,
;	  1617		UNREACH(.CCB,.CCB_P,.ILINE,		!  perform unreachablilty code
;	  1618		    $XPT$E_UNR)				!
;	  1619	    else if .RET neq CS_SUC then		!Congestion problem -
;	  1620		TOSS(.CCB,.OLINE,.DEST,.ILINE)		!  get rid of packet
;	  1621	    else begin
;	  1622		COUNTER_INCREMENT(LINEb,XPTxit_xmt);    ! Success - increment pkts ctr
;	  1623		if .ICPTD then				!  Packet had Ph. 2 hdr:
;	P 1624		    CALL$E(INTPH2,PD_XPE,.CCB_P,1,	!    intercept
;	  1625			DEST,SOURCE)			!    packet
;	  1626		end
;	  1627	    end
;	  1628	
;	  1629	!
;	  1630	!  Next node in path is Phase II
;	  1631	!
;	  1632	
;	  1633	else if ((.Nty eql PhTwo)
;	  1634	or (.Nty eql TOPS20)) then begin
;	  1635	    COUNTER_INCREMENT(LINEb,XPTxit_rcv);        ! Increment packet counter
;	  1636	    if .RET eql 2 then begin			!Header is not useable:
;	  1637		RET = getb(PTR);			!  Calculate
;	  1638		BUFLEN = 1 + 1 + .RET;			!    the length
;	  1639		PTR = ch$plus(.PTR,.RET);		!    of the
;	  1640		BUFLEN = .BUFLEN + 1 + getb(PTR);	!    old header
;	  1641		RET = BLDPH2(.CCB,.BUFLEN,.DEST,.SOURCE,!  Build a
;	  1642		    .OLINE,.ILINE);			!    new one
;	  1643		if .RET eql CE_RTE then begin		!  Resource failure -
;	  1644		    TOSS(.CCB,.OLINE,.DEST,.ILINE);	!    reschedule
;	  1645		    return;				!    the CCB
;	  1646		    end
;	  1647		else if .RET neq CS_SUC then begin	!  Other failure -
;	  1648		    UNREACH(.CCB,.CCB_P,.ILINE,		!    terminate
;	  1649			$XPT$E_UNR);			!    the packet
;	  1650		    return;				!    as unreachable
;	  1651		    end
;	  1652		end
;	  1653	    else begin					!Header is useable:
;	  1654		CCB[C_BIAS] = .CCB_P[C_BIAS];		!  Copy buffer
;	  1655		CCB[C_ADDR] = .CCB_P[C_ADDR];		!    descriptor into
;	  1656		CCB[C_CNT] = .CCB_P[C_CNT];		!    spawned CCB
;	  1657		end;
;	  1658	    LINEb = $XPT_GET_LINE_DB(.OLINE);		!Address output line DB entry
;	  1659	    if .Nid neq .DEST then			!Destination not adjacent -
;	  1660		TOSS(.CCB,.OLINE,.DEST,.ILINE)		!  get rid of message
;	  1661	    else begin
;	  1662		RET = FORWARDER(.CCB,.OLINE);		!Try to send packet out
;	  1663		if .RET eql CE_DIS then			!Unreachable destination -
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  47
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

;	  1664		    UNREACH(.CCB,.CCB_P,.ILINE,		!  perform unreachability code
;	  1665			$XPT$E_UNR)			!
;	  1666		else if .RET neq CS_SUC then		!Congestion problem -
;	  1667		    TOSS(.CCB,.OLINE,.DEST,.ILINE)	!  get rid of packet
;	  1668		else begin				!Success -
;	  1669		    COUNTER_INCREMENT(LINEb,XPTxit_xmt);!  Increment packets counter
;	  1670		    if (.ICPTD or (.Nty eql PhTwo))	!  Packet had Ph. 2 hdr:
;	P 1671		        then CALL$E(INTPH2,PD_XPE,	!    intercept
;	  1672			    .CCB_P,1,DEST,SOURCE)	!    packet
;	  1673		    end
;	  1674		end
;	  1675	    end
;	  1676	
;	  1677	!
;	  1678	!  Invalid destination node type
;	  1679	!
;	  1680	
;	  1681	else BPT(XPT$_IANT,.Nty);
;	  1682	return;
;	  1683	end;				!End of RCVPH2


						.SBTTL	RCVPH2
000000	004167  000000G			RCVPH2::
					U.3:	JSR	R1,$SAVE5			;					1179
000004	162706  000024 				SUB	#24,SP
000010	016666  000042  000002 			MOV	42(SP),2(SP)			; CCB.P,*				1507
000016	016600  000002 				MOV	2(SP),R0
000022	116066  000010  000010 			MOVB	10(R0),10(SP)			; *,ILINE
000030	105066  000011 				CLRB	11(SP)				; ILINE
000034	016600  000010 				MOV	10(SP),R0			; ILINE,*				1508
000040	004767  000000G				JSR	PC,GTLINE
000044	010066  000006 				MOV	R0,6(SP)			; *,LINEB
000050	116002  000002 				MOVB	2(R0),R2			; *(LINEB),*				1509
000054	020227  000005 				CMP	R2,#5
000060	001451 					BEQ	2$
000062	020227  000004 				CMP	R2,#4				;					1510
000066	001446 					BEQ	2$
000070	016601  000002 				MOV	2(SP),R1			;					1512
000074	016100  000022 				MOV	22(R1),R0
000100	020027  000023 				CMP	R0,#23
000104	003402 					BLE	1$
000106	012700  000023 				MOV	#23,R0
000112	010003 				1$:	MOV	R0,R3				; *,RET
000114	004767  000000G				JSR	PC,$NLBEG			;					1513
000120	012746  000001 				MOV	#1,-(SP)			;					1514
000124	010300 					MOV	R3,R0				; RET,*
000126	016604  000004 				MOV	4(SP),R4
000132	016401  000020 				MOV	20(R4),R1
000136	004767  000000G				JSR	PC,$DPHI
000142	012700  000404 				MOV	#404,R0				;					1515
000146	016603  000010 				MOV	10(SP),R3			; LINEB,*
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  48
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

000152	016301  000034 				MOV	34(R3),R1			; *(LINEB),*
000156	004767  000000G				JSR	PC,$NLEND
000162	016616  000004 				MOV	4(SP),(SP)			;					1516
000166	012746  177760 				MOV	#-20,-(SP)
000172	004767  000000G				JSR	PC,TERMINATE
000176	022626 					CMP	(SP)+,(SP)+			;					1509
000200	000167  002146 				JMP	40$				;					1510
000204	005005 				2$:	CLR	R5				; ICPTD					1520
000206	020227  000004 				CMP	R2,#4				;					1521
000212	001001 					BNE	3$
000214	005205 					INC	R5				; ICPTD
000216	004767  000000G			3$:	JSR	PC,$CCBGT			;					1527
000222	103403 					BCS	4$
000224	010466  000004 				MOV	R4,4(SP)			; $MCB$R4,CCB
000230	000412 					BR	5$
000232	016646  000002 			4$:	MOV	2(SP),-(SP)			;					1528
000236	005046 					CLR	-(SP)
000240	005046 					CLR	-(SP)
000242	016646  000016 				MOV	16(SP),-(SP)			; ILINE,*
000246	004767  177262 				JSR	PC,U.27
000252	000167  002070 				JMP	39$				;					1527
000256	016600  000004 			5$:	MOV	4(SP),R0			; CCB,*					1529
000262	016660  000002  000004 			MOV	2(SP),4(R0)			; *,*(CCB)
000270	105060  000032 				CLRB	32(R0)				; *(CCB)				1530
000274	105060  000033 				CLRB	33(R0)				; *(CCB)				1531
000300	012700  000016 				MOV	#16,R0				;					1537
000304	066600  000002 				ADD	2(SP),R0
000310	010066  000016 				MOV	R0,16(SP)
000314	011067  000000G				MOV	(R0),KISAR6
000320	012700  000020 				MOV	#20,R0
000324	066600  000002 				ADD	2(SP),R0
000330	010066  000014 				MOV	R0,14(SP)
000334	011001 					MOV	(R0),R1				; *,PTR
000336	132721  000002 				BITB	#2,(R1)+			; *,PTR					1538
000342	001421 					BEQ	6$
000344	010146 					MOV	R1,-(SP)			; PTR,*					1539
000346	005316 					DEC	(SP)
000350	016646  000012 				MOV	12(SP),-(SP)			; ILINE,*
000354	012746  000030 				MOV	#30,-(SP)
000360	060616 					ADD	SP,(SP)				; SOURCE,*
000362	012746  000030 				MOV	#30,-(SP)
000366	060616 					ADD	SP,(SP)				; DEST,*
000370	004767  000000V				JSR	PC,U.6
000374	010003 					MOV	R0,R3				; *,RET
000376	012766  000001  000010 			MOV	#1,10(SP)			; *,ISHDR				1541
000404	000432 					BR	7$				;					1538
000406	012746  000024 			6$:	MOV	#24,-(SP)			;					1545
000412	060616 					ADD	SP,(SP)				; SOURCE,*
000414	012746  000024 				MOV	#24,-(SP)
000420	060616 					ADD	SP,(SP)				; DEST,*
000422	005046 					CLR	-(SP)
000424	016646  000010 				MOV	10(SP),-(SP)
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  49
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

000430	012746  000004 				MOV	#4,-(SP)
000434	012746  000000G				MOV	#INTPH2,-(SP)
000440	016700  000002G				MOV	.CRDAT+2,R0
000444	005046 					CLR	-(SP)
000446	116016  000002 				MOVB	2(R0),(SP)
000452	004767  000000G				JSR	PC,$CALLE
000456	010003 					MOV	R0,R3				; *,RET					1544
000460	005066  000016 				CLR	16(SP)				; ISHDR					1546
000464	005005 					CLR	R5				; ICPTD					1547
000466	062706  000006 				ADD	#6,SP				;					1543
000472	005703 				7$:	TST	R3				; RET					1549
000474	003011 					BGT	8$
000476	016616  000014 				MOV	14(SP),(SP)			; CCB,*					1550
000502	016646  000012 				MOV	12(SP),-(SP)
000506	016646  000022 				MOV	22(SP),-(SP)			; ILINE,*
000512	010346 					MOV	R3,-(SP)			; RET,*
000514	005416 					NEG	(SP)
000516	000453 					BR	11$
000520	016666  000030  000022 		8$:	MOV	30(SP),22(SP)			; DEST,*				1552
000526	016600  000022 				MOV	22(SP),R0
000532	004767  000000G				JSR	PC,GTNODE
000536	010002 					MOV	R0,R2				; *,NODEB
000540	005004 					CLR	R4				; OLINE					1558
000542	032712  000400 				BIT	#400,(R2)			; *,NODEB				1559
000546	001001 					BNE	9$
000550	111204 					MOVB	(R2),R4				; NODEB,OLINE
000552	010400 				9$:	MOV	R4,R0				; OLINE,*				1560
000554	004767  000000G				JSR	PC,GTLINE
000560	010066  000016 				MOV	R0,16(SP)			; *,LINEB
000564	005712 					TST	(R2)				; NODEB					1566
000566	100005 					BPL	10$
000570	005704 					TST	R4				; OLINE					1567
000572	001435 					BEQ	13$
000574	121027  000010 				CMPB	(R0),#10			; LINEB,*
000600	001430 					BEQ	12$
000602	016600  000020 			10$:	MOV	20(SP),R0			; ILINE,*				1568
000606	004767  000000G				JSR	PC,GTLINE
000612	010066  000016 				MOV	R0,16(SP)			; *,LINEB
000616	062700  000070 				ADD	#70,R0				;					1569
000622	004767  000000G				JSR	PC,$IC32
000626	016616  000014 				MOV	14(SP),(SP)			; CCB,*					1570
000632	016646  000012 				MOV	12(SP),-(SP)
000636	016646  000022 				MOV	22(SP),-(SP)			; ILINE,*
000642	012746  000001 				MOV	#1,-(SP)
000646	004767  175632 			11$:	JSR	PC,U.28
000652	062706  000016 				ADD	#16,SP				;					1566
000656	000167  001470 				JMP	40$				;					1567
000662	005704 				12$:	TST	R4				; OLINE					1578
000664	001160 					BNE	18$
000666	032712  000400 			13$:	BIT	#400,(R2)			; *,NODEB				1579
000672	001542 					BEQ	16$
000674	016600  000014 				MOV	14(SP),R0			; CCB,*					1580
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  50
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

000700	017660  000026  000016 			MOV	@26(SP),16(R0)			; *,*(CCB)
000706	017660  000024  000020 			MOV	@24(SP),20(R0)			; *,*(CCB)				1581
000714	016602  000012 				MOV	12(SP),R2			;					1582
000720	016260  000022  000022 			MOV	22(R2),22(R0)			; *,*(CCB)
000726	116260  000010  000010 			MOVB	10(R2),10(R0)			; *,*(CCB)				1583
000734	032766  000001  000010 			BIT	#1,10(SP)			; *,ISHDR				1584
000742	001421 					BEQ	14$
000744	005003 					CLR	R3				; RET					1585
000746	152103 					BISB	(R1)+,R3			; PTR,RET
000750	010302 					MOV	R3,R2				; RET,BUFLEN				1586
000752	062702  000002 				ADD	#2,R2				; *,BUFLEN
000756	060301 					ADD	R3,R1				; RET,PTR				1587
000760	005000 					CLR	R0				;					1584
000762	152100 					BISB	(R1)+,R0			; PTR,*
000764	060200 					ADD	R2,R0				; BUFLEN,*
000766	010002 					MOV	R0,R2				; *,BUFLEN				1588
000770	005202 					INC	R2				; BUFLEN
000772	016600  000014 				MOV	14(SP),R0			; CCB,*					1589
000776	060260  000020 				ADD	R2,20(R0)			; BUFLEN,*(CCB)
001002	160260  000022 				SUB	R2,22(R0)			; BUFLEN,*(CCB)				1590
001006	016600  000020 			14$:	MOV	20(SP),R0			; ILINE,*				1592
001012	004767  000000G				JSR	PC,GTLINE
001016	010066  000016 				MOV	R0,16(SP)			; *,LINEB
001022	062700  000056 				ADD	#56,R0				;					1593
001026	004767  000000G				JSR	PC,$IC32
001032	016616  000014 				MOV	14(SP),(SP)			; CCB,*					1594
001036	016646  000032 				MOV	32(SP),-(SP)			; SOURCE,*
001042	016646  000024 				MOV	24(SP),-(SP)
001046	005046 					CLR	-(SP)
001050	004767  000000G				JSR	PC,ECLFWD
001054	062706  000006 				ADD	#6,SP
001060	005300 					DEC	R0				;					1596
001062	001413 					BEQ	15$
001064	016616  000014 				MOV	14(SP),(SP)			; CCB,*					1597
001070	005046 					CLR	-(SP)
001072	005046 					CLR	-(SP)
001074	016646  000024 				MOV	24(SP),-(SP)			; ILINE,*
001100	004767  176430 				JSR	PC,U.27
001104	062706  000006 				ADD	#6,SP
001110	000444 					BR	17$				;					1594
001112	032705  000001 			15$:	BIT	#1,R5				; *,ICPTD				1598
001116	001441 					BEQ	17$
001120	012716  000032 				MOV	#32,(SP)			;					1600
001124	060616 					ADD	SP,(SP)				; SOURCE,*
001126	012746  000032 				MOV	#32,-(SP)
001132	060616 					ADD	SP,(SP)				; DEST,*
001134	012746  000001 				MOV	#1,-(SP)
001140	016646  000016 				MOV	16(SP),-(SP)
001144	012746  000004 				MOV	#4,-(SP)
001150	012746  000000G				MOV	#INTPH2,-(SP)
001154	016700  000002G				MOV	.CRDAT+2,R0
001160	005046 					CLR	-(SP)
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  51
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

001162	116016  000002 				MOVB	2(R0),(SP)
001166	004767  000000G				JSR	PC,$CALLE
001172	062706  000014 				ADD	#14,SP
001176	000411 					BR	17$				;					1579
001200	016616  000022 			16$:	MOV	22(SP),(SP)			;					1603
001204	012746  100032 				MOV	#-77746,-(SP)
001210	012746  000002 				MOV	#2,-(SP)
001214	004767  000000G				JSR	PC,$IGNAL
001220	022626 					CMP	(SP)+,(SP)+
001222	000167  001120 			17$:	JMP	39$				;					1578
001226	016600  000016 			18$:	MOV	16(SP),R0			; LINEB,*				1609
001232	116002  000002 				MOVB	2(R0),R2			; *(LINEB),*
001236	020227  000002 				CMP	R2,#2
001242	001403 					BEQ	19$
001244	020227  000003 				CMP	R2,#3				;					1610
001250	001143 					BNE	24$
001252	016600  000020 			19$:	MOV	20(SP),R0			; ILINE,*				1611
001256	004767  000000G				JSR	PC,GTLINE
001262	010066  000016 				MOV	R0,16(SP)			; *,LINEB
001266	016616  000014 				MOV	14(SP),(SP)			; CCB,*					1612
001272	016646  000010 				MOV	10(SP),-(SP)			; ISHDR,*
001276	016646  000024 				MOV	24(SP),-(SP)
001302	016646  000036 				MOV	36(SP),-(SP)			; SOURCE,*
001306	005046 					CLR	-(SP)
001310	004767  000000V				JSR	PC,U.5
001314	010003 					MOV	R0,R3				; *,RET
001316	016600  000026 				MOV	26(SP),R0			; LINEB,*				1613
001322	062700  000070 				ADD	#70,R0
001326	004767  000000G				JSR	PC,$IC32
001332	010400 					MOV	R4,R0				; OLINE,*				1614
001334	004767  000000G				JSR	PC,GTLINE
001340	010066  000026 				MOV	R0,26(SP)			; *,LINEB
001344	016616  000024 				MOV	24(SP),(SP)			; CCB,*					1615
001350	010446 					MOV	R4,-(SP)			; OLINE,*
001352	004767  000000G				JSR	PC,FORWARDER
001356	010003 					MOV	R0,R3				; *,RET
001360	020327  177520 				CMP	R3,#-260			; RET,*					1616
001364	001013 					BNE	20$
001366	016616  000026 				MOV	26(SP),(SP)			; CCB,*					1617
001372	016646  000024 				MOV	24(SP),-(SP)
001376	016646  000034 				MOV	34(SP),-(SP)			; ILINE,*
001402	012746  000001 				MOV	#1,-(SP)
001406	004767  175072 				JSR	PC,U.28
001412	000414 					BR	21$
001414	020327  000001 			20$:	CMP	R3,#1				; RET,*					1619
001420	001414 					BEQ	22$
001422	016616  000026 				MOV	26(SP),(SP)			; CCB,*					1620
001426	010446 					MOV	R4,-(SP)			; OLINE,*
001430	016646  000036 				MOV	36(SP),-(SP)
001434	016646  000036 				MOV	36(SP),-(SP)			; ILINE,*
001440	004767  176070 				JSR	PC,U.27
001444	062706  000006 			21$:	ADD	#6,SP
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  52
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

001450	000440 					BR	23$				;					1619
001452	016600  000030 			22$:	MOV	30(SP),R0			; LINEB,*				1622
001456	062700  000074 				ADD	#74,R0
001462	004767  000000G				JSR	PC,$IC32
001466	032705  000001 				BIT	#1,R5				; *,ICPTD				1623
001472	001427 					BEQ	23$
001474	012716  000044 				MOV	#44,(SP)			;					1625
001500	060616 					ADD	SP,(SP)				; SOURCE,*
001502	012746  000044 				MOV	#44,-(SP)
001506	060616 					ADD	SP,(SP)				; DEST,*
001510	012746  000001 				MOV	#1,-(SP)
001514	016646  000030 				MOV	30(SP),-(SP)
001520	012746  000004 				MOV	#4,-(SP)
001524	012746  000000G				MOV	#INTPH2,-(SP)
001530	016700  000002G				MOV	.CRDAT+2,R0
001534	005046 					CLR	-(SP)
001536	116016  000002 				MOVB	2(R0),(SP)
001542	004767  000000G				JSR	PC,$CALLE
001546	062706  000014 				ADD	#14,SP
001552	062706  000010 			23$:	ADD	#10,SP				;					1610
001556	000551 					BR	31$				;					1609
001560	020227  000004 			24$:	CMP	R2,#4				;					1633
001564	001405 					BEQ	25$
001566	020227  000005 				CMP	R2,#5				;					1634
001572	001402 					BEQ	25$
001574	000167  000524 				JMP	37$
001600	016600  000016 			25$:	MOV	16(SP),R0			; LINEB,*				1635
001604	062700  000070 				ADD	#70,R0
001610	004767  000000G				JSR	PC,$IC32
001614	020327  000002 				CMP	R3,#2				; RET,*					1636
001620	001070 					BNE	29$
001622	005003 					CLR	R3				; RET					1637
001624	152103 					BISB	(R1)+,R3			; PTR,RET
001626	010302 					MOV	R3,R2				; RET,BUFLEN				1638
001630	062702  000002 				ADD	#2,R2				; *,BUFLEN
001634	060301 					ADD	R3,R1				; RET,PTR				1639
001636	005000 					CLR	R0				;					1636
001640	152100 					BISB	(R1)+,R0			; PTR,*
001642	060200 					ADD	R2,R0				; BUFLEN,*
001644	010002 					MOV	R0,R2				; *,BUFLEN				1640
001646	005202 					INC	R2				; BUFLEN
001650	016616  000014 				MOV	14(SP),(SP)			; CCB,*					1641
001654	010246 					MOV	R2,-(SP)			; BUFLEN,*
001656	016646  000024 				MOV	24(SP),-(SP)
001662	016646  000036 				MOV	36(SP),-(SP)			; SOURCE,*
001666	010446 					MOV	R4,-(SP)			; OLINE,*
001670	016646  000030 				MOV	30(SP),-(SP)			; ILINE,*
001674	004767  000000V				JSR	PC,U.4
001700	010003 					MOV	R0,R3				; *,RET
001702	020327  177730 				CMP	R3,#-50				; RET,*					1643
001706	001012 					BNE	26$
001710	016616  000026 				MOV	26(SP),(SP)			; CCB,*					1644
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  53
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

001714	010446 					MOV	R4,-(SP)			; OLINE,*
001716	016646  000036 				MOV	36(SP),-(SP)
001722	016646  000036 				MOV	36(SP),-(SP)			; ILINE,*
001726	004767  175602 				JSR	PC,U.27
001732	000415 					BR	27$				;					1643
001734	020327  000001 			26$:	CMP	R3,#1				; RET,*					1647
001740	001415 					BEQ	28$
001742	016616  000026 				MOV	26(SP),(SP)			; CCB,*					1648
001746	016646  000024 				MOV	24(SP),-(SP)
001752	016646  000034 				MOV	34(SP),-(SP)			; ILINE,*
001756	012746  000001 				MOV	#1,-(SP)
001762	004767  174516 				JSR	PC,U.28
001766	062706  000030 			27$:	ADD	#30,SP				;					1647
001772	000567 					BR	40$
001774	062706  000012 			28$:	ADD	#12,SP				;					1636
002000	000415 					BR	30$
002002	016600  000014 			29$:	MOV	14(SP),R0			; CCB,*					1654
002006	017660  000026  000016 			MOV	@26(SP),16(R0)			; *,*(CCB)
002014	017660  000024  000020 			MOV	@24(SP),20(R0)			; *,*(CCB)				1655
002022	016601  000012 				MOV	12(SP),R1			;					1656
002026	016160  000022  000022 			MOV	22(R1),22(R0)			; *,*(CCB)
002034	010400 				30$:	MOV	R4,R0				; OLINE,*				1658
002036	004767  000000G				JSR	PC,GTLINE
002042	010066  000016 				MOV	R0,16(SP)			; *,LINEB
002046	026066  000004  000022 			CMP	4(R0),22(SP)			; *(LINEB),*				1659
002054	001413 					BEQ	32$
002056	016616  000014 				MOV	14(SP),(SP)			; CCB,*					1660
002062	010446 					MOV	R4,-(SP)			; OLINE,*
002064	016646  000024 				MOV	24(SP),-(SP)
002070	016646  000024 				MOV	24(SP),-(SP)			; ILINE,*
002074	004767  175434 				JSR	PC,U.27
002100	022626 					CMP	(SP)+,(SP)+
002102	000520 				31$:	BR	38$				;					1659
002104	016616  000014 			32$:	MOV	14(SP),(SP)			; CCB,*					1662
002110	010446 					MOV	R4,-(SP)			; OLINE,*
002112	004767  000000G				JSR	PC,FORWARDER
002116	010003 					MOV	R0,R3				; *,RET
002120	020327  177520 				CMP	R3,#-260			; RET,*					1663
002124	001013 					BNE	33$
002126	016616  000016 				MOV	16(SP),(SP)			; CCB,*					1664
002132	016646  000014 				MOV	14(SP),-(SP)
002136	016646  000024 				MOV	24(SP),-(SP)			; ILINE,*
002142	012746  000001 				MOV	#1,-(SP)
002146	004767  174332 				JSR	PC,U.28
002152	000413 					BR	34$
002154	005303 				33$:	DEC	R3				; RET					1666
002156	001414 					BEQ	35$
002160	016616  000016 				MOV	16(SP),(SP)			; CCB,*					1667
002164	010446 					MOV	R4,-(SP)			; OLINE,*
002166	016646  000026 				MOV	26(SP),-(SP)
002172	016646  000026 				MOV	26(SP),-(SP)			; ILINE,*
002176	004767  175332 				JSR	PC,U.27
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  54
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (5)

002202	062706  000006 			34$:	ADD	#6,SP
002206	000456 					BR	38$				;					1666
002210	016600  000020 			35$:	MOV	20(SP),R0			; LINEB,*				1669
002214	062700  000074 				ADD	#74,R0
002220	004767  000000G				JSR	PC,$IC32
002224	006005 					ROR	R5				; ICPTD					1670
002226	103406 					BLO	36$
002230	016600  000020 				MOV	20(SP),R0			; LINEB,*
002234	126027  000002  000004 			CMPB	2(R0),#4			; *(LINEB),*
002242	001040 					BNE	38$
002244	012716  000034 			36$:	MOV	#34,(SP)			;					1672
002250	060616 					ADD	SP,(SP)				; SOURCE,*
002252	012746  000034 				MOV	#34,-(SP)
002256	060616 					ADD	SP,(SP)				; DEST,*
002260	012746  000001 				MOV	#1,-(SP)
002264	016646  000020 				MOV	20(SP),-(SP)
002270	012746  000004 				MOV	#4,-(SP)
002274	012746  000000G				MOV	#INTPH2,-(SP)
002300	016700  000002G				MOV	.CRDAT+2,R0
002304	005046 					CLR	-(SP)
002306	116016  000002 				MOVB	2(R0),(SP)
002312	004767  000000G				JSR	PC,$CALLE
002316	062706  000014 				ADD	#14,SP
002322	000410 					BR	38$				;					1633
002324	010216 				37$:	MOV	R2,(SP)				;					1681
002326	012746  100042 				MOV	#-77736,-(SP)
002332	012746  000002 				MOV	#2,-(SP)
002336	004767  000000G				JSR	PC,$IGNAL
002342	005726 					TST	(SP)+
002344	005726 				38$:	TST	(SP)+				;					1609
002346	062706  000010 			39$:	ADD	#10,SP				;					1179
002352	062706  000024 			40$:	ADD	#24,SP
002356	000207 					RTS	PC

; Routine Size:  632 words,	Routine Base:  $CODE$ + 5324
; Maximum stack depth per invocation:  32 words
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  55
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (6)

;	  1684	
;	  1685	routine PH2HDR (BUFPTR,ILINE,SRCAD,DESTAD) =
;	  1686	
;	  1687	!++
;	  1688	! FUNCTIONAL DESCRIPTION:
;	  1689	!
;	  1690	! Analyzes a Phase II routing header and returns the source and
;	  1691	! destination node addresses.  It also makes sure that the source
;	  1692	! node name is the same as the adjacent node over the input line.
;	  1693	!
;	  1694	! FORMAL PARAMETERS
;	  1695	!
;	  1696	!	PTR - Character pointer to routing header to analyze
;	  1697	!	ILINE - Channel number of input line
;	  1698	!	SRCAD - Address of location to return source address
;	  1699	!	DESTAD - Address of location to return destination address
;	  1700	!
;	  1701	! IMPLICIT INPUTS
;	  1702	!
;	  1703	!	NONE.
;	  1704	!
;	  1705	! ROUTINE VALUE: "Success" or "failure"
;	  1706	! COMPLETION CODES:
;	  1707	!
;	  1708	!	1		Success; addresses returned.  Header is useable.
;	  1709	!	2		Success; addresses returned.  Header is not useable.
;	  1710	!     - $XPT$E_UNR	Failure; node is unreachable or unknown
;	  1711	!     - $XPT$E_RNG	Failure; numeric name is out of range
;	  1712	!     - $XPT$E_FMT	Failure; packet format error
;	  1713	!
;	  1714	! SIDE EFFECTS:
;	  1715	!
;	  1716	!	If "failure" is returned, the source and destination address
;	  1717	!	parameters will be set to 0.
;	  1718	!
;	  1719	!--
;	  1720	
;	  1721	begin
;	  1722	
;	  1723	local LINEb;
;	  1724	require 'XPTSYM';
;	  1761	
;	  1762	pointer PTR;
;	  1763	local RET,LEN;
;	  1764	!local NTT: ref block field(NTTfields);	!Addresses Node Translation Table entry
;	  1765	
;	  1766	!
;	  1767	!  Try to directly translate destination name into binary
;	  1768	!
;	  1769	
;	  1770	.DESTAD = .SRCAD = 0;			!Clear out address parameters
;	  1771	PTR = ch$plus(.BUFPTR,1);		!Address destination name in header
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  56
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (6)

;	  1772	LEN = getb(PTR);			!Pick up destination name length
;	  1773	if .LEN gtru 6 then			!Invalid dest. name length -
;	  1774	    return (-$XPT$E_FMT);		!  return an error
;	  1775	RET = CDTB(.PTR,.LEN);                  ! Call conversion routine
;	  1776	if .RET eql 0 or .RET gtr NN then	!Invalid node number -
;	  1777	    return (-$XPT$E_RNG)		!  return an error
;	  1778	else if .RET gtr 0 then begin		!Valid node number obtained -
;	  1779	    .DESTAD = .RET;			!  save it
;	  1780	    RET = 2				!  and continue
;	  1781	    end
;	  1782	
;	  1783	!
;	  1784	!  If the conversion didn't go, check our own node name
;	  1785	!
;	  1786	
;	  1787	else if not begin
;	  1788	    RET = 1;
;	  1789	    .DESTAD = .Tid;
;	  1790	    ((.LEN eql .NODEname_length) and
;	  1791	    ch$eql(.LEN,.PTR,.NODEname_length,byt$ptr(NODEname,0)))
;	  1792	    end
;	  1793	
;	  1794	!
;	  1795	!  If that didn't work, scan node ID blocks for destination name
;	  1796	!
;	  1797	
;	  1798	then begin
;	  1799	    RET = 0;				!Scan through
;	  1800	    (incr I from 1 to NLN do begin	!  all the lines
;	  1801		LINEb = $XPT_GET_LINE_DB(.I);	!  which have
;	  1802		if ((.Nty eql PhTwo)		!  adjacent Phase
;	  1803		or (.Nty eql TOPS20))		!  II nodes
;	  1804		then begin
;	  1805		    if ((.LEN eql .Nnml) and    ! Unequal name lengths disqualify
;	  1806		    ch$eql(.LEN,.PTR,.LEN,	!  Compare node names
;	  1807		    byt$ptr(Nnm)))
;	  1808		    then begin			!  Hit:
;	  1809			.DESTAD = .Nid;         !       map to node address
;	  1810			exitloop(RET=1)		!       and stop search
;	  1811			end
;	  1812		    end
;	  1813		end);
;	  1814	    end;
;	  1815	
;	C 1816	%(!
;	C 1817	!  If we didn't find anything, try the Node Translate Table
;	C 1818	!
;	C 1819	
;	C 1820	if .RET leq 0 then begin
;	C 1821	    NTT = VECTOR[NODExlate,1];			!Address first table entry
;	C 1822	    RET =					!Scan through each
;	C 1823	    (incr I from 1 to .NODExlate do		!  table entry
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  57
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (6)

;	C 1824		if ch$eql(.LEN,.PTR,.LEN,NTT[NTTname])
;	C 1825		then begin				!  Hit:
;	C 1826		    .DESTAD = .NTT[NTTaddr];		!	map to address
;	C 1827		    exitloop (1)			!	stop looking
;	C 1828		    end
;	C 1829		else NTT = NTT[NTTlen])			!  Otherwise, try next entry
;	C 1830	    end;
;	  1831	)%
;	  1832	
;	  1833	!
;	  1834	!  Node name not found anywhere - give up
;	  1835	!
;	  1836	
;	  1837	if .RET leq 0 then return -$XPT$E_UNR
;	  1838	
;	  1839	!
;	  1840	!  Validate source name and pick up source address
;	  1841	!
;	  1842	
;	  1843	else begin
;	  1844	    LINEb = $XPT_GET_LINE_DB(.ILINE);	!Address line data base entry
;	  1845	    PTR = ch$plus(.PTR,.LEN);		!Skip past destination name
;	  1846	    LEN = getb(PTR);			!Pick up source node name length
;	  1847	    if ((.LEN neq .Nnml)		!Name lengths don't
;	  1848	    or ch$neq(.LEN,.PTR,.LEN,		!  match or names
;	  1849		byt$ptr(Nnm)))                  !  don't compare -
;	  1850	    then begin				!  clear out
;	  1851		.DESTAD = 0;			!  destination address
;	  1852		return (-$XPT$E_FMT)		!  and return an error
;	  1853		end
;	  1854	    else begin				!Source name is OK -
;	  1855		.SRCAD = .Nid;                  !  pick up source address
;	  1856		return (.RET)			!  and return "success"
;	  1857		end
;	  1858	    end
;	  1859	
;	  1860	end;				!End of PH2HDR


						.SBTTL	PH2HDR
000000	004167  000000G			; PH2HDR
					U.6:	JSR	R1,$SAVE5			;					1685
000004	024646 					CMP	-(SP),-(SP)
000006	016666  000022  000002 			MOV	22(SP),2(SP)			; DESTAD,*				1770
000014	005076  000024 				CLR	@24(SP)				; SRCAD
000020	005076  000002 				CLR	@2(SP)
000024	016601  000030 				MOV	30(SP),R1			; BUFPTR,PTR				1771
000030	005201 					INC	R1				; PTR					1772
000032	005004 					CLR	R4				; LEN
000034	152104 					BISB	(R1)+,R4			; PTR,LEN
000036	020427  000006 				CMP	R4,#6				; LEN,*					1773
000042	101403 					BLOS	1$
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  58
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (6)

000044	012700  177774 				MOV	#-4,R0				;					1774
000050	000416 					BR	3$
000052	010146 				1$:	MOV	R1,-(SP)			; PTR,*					1775
000054	010446 					MOV	R4,-(SP)			; LEN,*
000056	004767  000000G				JSR	PC,CDTB
000062	010002 					MOV	R0,R2				; *,RET
000064	001405 					BEQ	2$				;					1776
000066	016700  000002G				MOV	.CRDAT+2,R0
000072	020260  000016 				CMP	R2,16(R0)			; RET,*
000076	003405 					BLE	4$
000100	022626 				2$:	CMP	(SP)+,(SP)+			;					1777
000102	012700  177776 				MOV	#-2,R0
000106	000167  000400 			3$:	JMP	16$
000112	005702 				4$:	TST	R2				; RET					1778
000114	003405 					BLE	5$
000116	010276  000006 				MOV	R2,@6(SP)			; RET,*					1779
000122	012702  000002 				MOV	#2,R2				; *,RET					1780
000126	000515 					BR	11$				;					1778
000130	012702  000001 			5$:	MOV	#1,R2				; *,RET					1788
000134	016700  000002G				MOV	.CRDAT+2,R0			;					1789
000140	016076  000056  000006 			MOV	56(R0),@6(SP)
000146	020460  000114 				CMP	R4,114(R0)			; LEN,*					1790
000152	001016 					BNE	6$
000154	010416 					MOV	R4,(SP)				; LEN,*					1791
000156	010146 					MOV	R1,-(SP)			; PTR,*
000160	016046  000114 				MOV	114(R0),-(SP)
000164	012746  000116 				MOV	#116,-(SP)
000170	060016 					ADD	R0,(SP)
000172	005046 					CLR	-(SP)
000174	004767  000000G				JSR	PC,BL$EQL
000200	062706  000010 				ADD	#10,SP
000204	006000 					ROR	R0
000206	103464 					BLO	10$
000210	005002 				6$:	CLR	R2				; RET					1799
000212	016700  000002G				MOV	.CRDAT+2,R0			;					1800
000216	016005  000022 				MOV	22(R0),R5
000222	005003 					CLR	R3				; I
000224	000452 					BR	9$
000226	010300 				7$:	MOV	R3,R0				; I,*					1801
000230	004767  000000G				JSR	PC,GTLINE
000234	010066  000004 				MOV	R0,4(SP)			; *,LINEB
000240	126027  000002  000004 			CMPB	2(R0),#4			; *(LINEB),*				1802
000246	001404 					BEQ	8$
000250	126027  000002  000005 			CMPB	2(R0),#5			; *(LINEB),*				1803
000256	001035 					BNE	9$
000260	016646  000004 			8$:	MOV	4(SP),-(SP)			; LINEB,*				1805
000264	062716  000007 				ADD	#7,(SP)
000270	113600 					MOVB	@(SP)+,R0
000272	020400 					CMP	R4,R0				; LEN,*
000274	001026 					BNE	9$
000276	010416 					MOV	R4,(SP)				; LEN,*					1807
000300	010146 					MOV	R1,-(SP)			; PTR,*
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  59
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (6)

000302	010446 					MOV	R4,-(SP)			; LEN,*
000304	016646  000010 				MOV	10(SP),-(SP)			; LINEB,*
000310	062716  000010 				ADD	#10,(SP)
000314	005046 					CLR	-(SP)
000316	004767  000000G				JSR	PC,BL$EQL
000322	062706  000010 				ADD	#10,SP
000326	006000 					ROR	R0
000330	103010 					BCC	9$
000332	016600  000004 				MOV	4(SP),R0			; LINEB,*				1809
000336	016076  000004  000006 			MOV	4(R0),@6(SP)			; *(LINEB),*
000344	012702  000001 				MOV	#1,R2				; *,RET					1810
000350	000404 					BR	11$
000352	005203 				9$:	INC	R3				; I					1800
000354	020305 					CMP	R3,R5				; I,*
000356	003723 					BLE	7$
000360	005702 				10$:	TST	R2				; RET					1837
000362	003003 				11$:	BGT	12$
000364	012700  177777 				MOV	#-1,R0
000370	000447 					BR	15$
000372	016600  000032 			12$:	MOV	32(SP),R0			; ILINE,*				1844
000376	004767  000000G				JSR	PC,GTLINE
000402	010066  000004 				MOV	R0,4(SP)			; *,LINEB
000406	060401 					ADD	R4,R1				; LEN,PTR				1845
000410	005004 					CLR	R4				; LEN					1846
000412	152104 					BISB	(R1)+,R4			; PTR,LEN
000414	010003 					MOV	R0,R3				; LINEB,*				1847
000416	116300  000007 				MOVB	7(R3),R0			; *(LINEB),*
000422	020400 					CMP	R4,R0				; LEN,*
000424	001016 					BNE	13$
000426	010416 					MOV	R4,(SP)				; LEN,*					1849
000430	010146 					MOV	R1,-(SP)			; PTR,*
000432	010446 					MOV	R4,-(SP)			; LEN,*
000434	016646  000010 				MOV	10(SP),-(SP)			; LINEB,*
000440	062716  000010 				ADD	#10,(SP)
000444	005046 					CLR	-(SP)
000446	004767  000000G				JSR	PC,BL$NEQ
000452	062706  000010 				ADD	#10,SP
000456	006000 					ROR	R0
000460	103005 					BCC	14$
000462	005076  000006 			13$:	CLR	@6(SP)				;					1851
000466	012700  177774 				MOV	#-4,R0				;					1847
000472	000406 					BR	15$
000474	016600  000004 			14$:	MOV	4(SP),R0			; LINEB,*				1855
000500	016076  000004  000030 			MOV	4(R0),@30(SP)			; *(LINEB),SRCAD
000506	010200 					MOV	R2,R0				; RET,*					1847
000510	022626 				15$:	CMP	(SP)+,(SP)+			;					1685
000512	022626 				16$:	CMP	(SP)+,(SP)+
000514	000207 					RTS	PC

; Routine Size:  167 words,	Routine Base:  $CODE$ + 7704
; Maximum stack depth per invocation:  15 words
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  60
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (7)

;	  1861	
;	  1862	routine BLDPH3 (CCB,HDRFLG,DEST,SOURCE,RQR) =
;	  1863	
;	  1864	!++
;	  1865	! FUNCTIONAL DESCRIPTION:
;	  1866	!
;	  1867	! This routine builds a Phase III routing header in the spawned CCB.
;	  1868	! All of the information for the header is passed as parameters.  If
;	  1869	! HDRFLG is on, the buffer descriptor for the pass-through CCB will be
;	  1870	! adjusted to point past the Phase II routing header in the buffer.
;	  1871	!
;	  1872	! FORMAL PARAMETERS
;	  1873	!
;	  1874	!	CCB - Spawned CCB for the packet for which a header is
;	  1875	!	      to be built.
;	  1876	!	HDRFLG - If this flag is 1, the pass-through CCB will be
;	  1877	!	         adjusted to point past the Phase II routing header.
;	  1878	!	DEST - The destination node address.
;	  1879	!	SOURCE - The source node address.
;	  1880	!	RQRFLG - The "Rqr" bit in the routing header flags will be set
;	  1881	!		 to this value.
;	  1882	!
;	  1883	! IMPLICIT INPUTS
;	  1884	!
;	  1885	!	C_STK in the spawned CCB points to the pass-through CCB.
;	  1886	!
;	  1887	! ROUTINE VALUE: "Success" only
;	  1888	! COMPLETION CODES:
;	  1889	!
;	  1890	!	CS_SUC - Success; routing header built.
;	  1891	!
;	  1892	! SIDE EFFECTS:
;	  1893	!
;	  1894	!	The pass-through buffer descriptor may be adjusted. If
;	  1895	!	it is, the high-order byte of C_PRM4 in the spawned CCB
;	  1896	!	will contain the "adjustment factor" for the descriptor.
;	  1897	!
;	  1898	!--
;	  1899	
;	  1900	begin
;	  1901	map CCB: ref block field (C_XPT_fields);
;	  1902	pointer PTR;
;	  1903	local BUFPTR,CCB_P,HDRLEN,LEN;
;	  1904	map CCB_P: ref block field(C_FIELDS);
;	  1905	
;	  1906	!
;	  1907	!  Set up the spawned CCB fields
;	  1908	!
;	  1909	
;	  1910	CCB_P = .CCB[C_STK];			!Address the pass-through CCB
;	  1911	PTR = byt$ptr(CCB[C_PRM1],0);		!Address data area in spawned CCB
;	  1912	CCB[C_BIAS] = 0;			!Set up the buffer
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  61
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (7)

;	  1913	CCB[C_ADDR] = .PTR;			!  descriptor to point
;	  1914	CCB[C_CNT] = 6;				!  to the data area
;	  1915	CCB[C_CHN] = .CCB_P;			!Chain pass-through off
;	  1916	
;	  1917	!
;	  1918	!  Build the routing header
;	  1919	!
;	  1920	
;	  1921	putb(if .RQR then 10 else 2,PTR);	!Put in the routing flags
;	  1922	putw(.DEST,PTR);			!  and the destination address
;	  1923	putw(.SOURCE,PTR);			!  and the source address
;	  1924	putb(1,PTR);				!  and the Visits field
;	  1925	
;	  1926	!
;	  1927	!  If specified, adjust the pass-through descriptor to
;	  1928	!  point past the old routing header
;	  1929	!
;	  1930	
;	  1931	if .HDRFLG then begin
;	  1932	    MAPBUF(.CCB_P,BUFPTR,LEN);		!Map in pass-through buffer
;	  1933	    PTR = ch$plus(.BUFPTR,1);		!Point to destination name field
;	  1934	    LEN = getb(PTR);			!Pick up name length
;	  1935	    PTR = ch$plus(.PTR,.LEN);		!Skip past field
;	  1936	    HDRLEN = 1 + 1 + .LEN;
;	  1937	    LEN = getb(PTR);			!Pick up source name length
;	  1938	    PTR = ch$plus(.PTR,.LEN);		!Skip past name field
;	  1939	    HDRLEN = .HDRLEN + 1 + .LEN;
;	  1940	    CCB[C_XPT_ADJUST] = .HDRLEN;	!Save "adjustment factor"
;	  1941	    CCB_P[C_ADDR] = .PTR;		!Adjust the buffer descriptor
;	  1942	    CCB_P[C_CNT] = .CCB_P[C_CNT] - .HDRLEN; !for the pass-through
;	  1943	    end;
;	  1944	
;	  1945	!
;	  1946	!  Return a "success" code
;	  1947	!
;	  1948	
;	  1949	return (CS_SUC)
;	  1950	end;				!End of BLDPH3


						.SBTTL	BLDPH3
000000	004167  000000G			; BLDPH3
					U.5:	JSR	R1,$SAVE5			;					1862
000004	005746 					TST	-(SP)
000006	016605  000030 				MOV	30(SP),R5			; CCB,*					1910
000012	016504  000004 				MOV	4(R5),R4			; *,CCB.P
000016	012700  000024 				MOV	#24,R0				; *,PTR					1911
000022	060500 					ADD	R5,R0				; *,PTR
000024	005065  000016 				CLR	16(R5)				;					1912
000030	010065  000020 				MOV	R0,20(R5)			; PTR,*					1913
000034	012765  000006  000022 			MOV	#6,22(R5)			;					1914
000042	010465  000002 				MOV	R4,2(R5)			; CCB.P,*				1915
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  62
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (7)

000046	032766  000001  000020 			BIT	#1,20(SP)			; *,RQR					1921
000054	001403 					BEQ	1$
000056	012701  000012 				MOV	#12,R1
000062	000402 					BR	2$
000064	012701  000002 			1$:	MOV	#2,R1
000070	110120 				2$:	MOVB	R1,(R0)+			; *,PTR
000072	016616  000024 				MOV	24(SP),(SP)			; DEST,X				1922
000076	111620 					MOVB	(SP),(R0)+			; X,PTR
000100	116620  000001 				MOVB	1(SP),(R0)+			; X,PTR
000104	016616  000022 				MOV	22(SP),(SP)			; SOURCE,X				1923
000110	111620 					MOVB	(SP),(R0)+			; X,PTR
000112	116620  000001 				MOVB	1(SP),(R0)+			; X,PTR
000116	112720  000001 				MOVB	#1,(R0)+			; *,PTR					1924
000122	032766  000001  000026 			BIT	#1,26(SP)			; *,HDRFLG				1931
000130	001432 					BEQ	3$
000132	016467  000016  000000G			MOV	16(R4),KISAR6			; *(CCB.P),*				1932
000140	016402  000020 				MOV	20(R4),R2			; *(CCB.P),BUFPTR
000144	010200 					MOV	R2,R0				; BUFPTR,PTR				1933
000146	005200 					INC	R0				; PTR					1934
000150	005001 					CLR	R1				; LEN
000152	152001 					BISB	(R0)+,R1			; PTR,LEN
000154	060100 					ADD	R1,R0				; LEN,PTR				1935
000156	010102 					MOV	R1,R2				; LEN,HDRLEN				1936
000160	062702  000002 				ADD	#2,R2				; *,HDRLEN
000164	005001 					CLR	R1				; LEN					1937
000166	152001 					BISB	(R0)+,R1			; PTR,LEN
000170	060100 					ADD	R1,R0				; LEN,PTR				1938
000172	010103 					MOV	R1,R3				; LEN,*					1931
000174	060203 					ADD	R2,R3				; HDRLEN,*
000176	010302 					MOV	R3,R2				; *,HDRLEN				1939
000200	005202 					INC	R2				; HDRLEN
000202	110265  000033 				MOVB	R2,33(R5)			; HDRLEN,*				1940
000206	010064  000020 				MOV	R0,20(R4)			; PTR,*(CCB.P)				1941
000212	160264  000022 				SUB	R2,22(R4)			; HDRLEN,*(CCB.P)			1942
000216	012700  000001 			3$:	MOV	#1,R0				;					1900
000222	005726 					TST	(SP)+				;					1862
000224	000207 					RTS	PC

; Routine Size:  75 words,	Routine Base:  $CODE$ + 10422
; Maximum stack depth per invocation:  8 words
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  63
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (8)

;	  1951	
;	  1952	routine BLDPH2 (CCB,PT_HDR,DEST,SOURCE,OLINE,ILINE) =
;	  1953	
;	  1954	!++
;	  1955	! FUNCTIONAL DESCRIPTION:
;	  1956	!
;	  1957	! This routine builds a Phase II routing header for a data packet.  The
;	  1958	! source node name will always be a decimal ASCII representation of the
;	  1959	! specified source node address.  The destination node name will be the
;	  1960	! adjacent node over the output line.
;	  1961	!
;	  1962	! FORMAL PARAMETERS
;	  1963	!
;	  1964	!	CCB	Spawned CCB for the packet for which a header is to be
;	  1965	!		built.
;	  1966	!	PT_HDR	Flag which, if non-zero, indicates that the pass-through
;	  1967	!		buffer contains a routing header which the descriptor
;	  1968	!		must be adjusted to point past.  The value of PT_HDR is
;	  1969	!		the number of bytes to skip over.
;	  1970	!	DEST	Destination node address
;	  1971	!	SOURCE	Source node address
;	  1972	!	OLINE	Channel number of output line
;	  1973	!	ILINE	Channel number of input line
;	  1974	!
;	  1975	! IMPLICIT INPUTS
;	  1976	!
;	  1977	!	Nty, Nid
;	  1978	!
;	  1979	! ROUTINE VALUE: "Success", "unreachable destination", or "resource failure"
;	  1980	! COMPLETION CODES:
;	  1981	!
;	  1982	!	CS_SUC	Success: header built and pointed to by spawned CCB
;	  1983	!	CE_DIS	Destination is unreachable (it is not the adjacent node)
;	  1984	!	CE_RTE	Resource failure: could not get an SDB
;	  1985	!
;	  1986	! SIDE EFFECTS:
;	  1987	!
;	  1988	!	The pass-through buffer descriptor may be adjusted. If it is,
;	  1989	!	the high-order byte of C_PRM4 in the spawned CCB will contain
;	  1990	!	the "adjustment factor" for the descriptor.
;	  1991	!
;	  1992	!--
;	  1993	
;	  1994	begin
;	  1995	
;	  1996	!-----------------------------------------------!
;	  1997	!						!
;	  1998	!	Routine to scan for a node as an	!
;	  1999	!	adjacent Phase II node and, if found,	!
;	  2000	!	convert it into a ASCII node name.	!
;	  2001	!						!
;	  2002	!-----------------------------------------------!
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  64
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (8)

;	  2003	
;	  2004	linkage CONVERT_LINKAGE = JSR (REGISTER=4,REGISTER=5);
;	  2005	routine CONVERT (NODE,LINE,PTRAD): CONVERT_LINKAGE =
;	  2006	begin
;	  2007	
;	  2008	local LINEb;
;	  2009	require 'XPTSYM';
;	  2046	
;	  2047	LINEb = $XPT_GET_LINE_DB(.LINE);        ! Address circuit data base
;	  2048	
;	  2049	if ((.Nty eql PhTwo) or (.Nty eql TOPS20))	! If adjacent node is Phase
;	  2050	then if .Nid eql .NODE then begin		!   2 and is the right one,
;	  2051	    putb(.Nnml,.PTRAD);                         !   adjacent node
;	  2052	    .PTRAD = ch$move(.Nnml,			!   name into the
;	  2053		byt$ptr(Nnm),..PTRAD);			!   specified area,
;	  2054	    return TRUE					!   and say we hit
;	  2055	    end;
;	  2056	
;	  2057	FALSE						! No hit - say so
;	  2058	
;	  2059	end;


						.SBTTL	CONVERT
000000	004167  000000G			; CONVERT
					U.44:	JSR	R1,$SAVE5			;					2005
000004	010500 					MOV	R5,R0				; LINE,*				2047
000006	004767  000000G				JSR	PC,GTLINE
000012	126027  000002  000004 			CMPB	2(R0),#4			; *(LINEB),*				2049
000020	001404 					BEQ	1$
000022	126027  000002  000005 			CMPB	2(R0),#5			; *(LINEB),*
000030	001030 					BNE	2$
000032	026004  000004 			1$:	CMP	4(R0),R4			; *(LINEB),NODE				2050
000036	001025 					BNE	2$
000040	016604  000016 				MOV	16(SP),R4			; PTRAD,*				2051
000044	116074  000007  000000 			MOVB	7(R0),@0(R4)			; *(LINEB),*
000052	005214 					INC	(R4)
000054	116005  000007 				MOVB	7(R0),R5			; *(LINEB),*				2053
000060	010546 					MOV	R5,-(SP)
000062	010046 					MOV	R0,-(SP)			; LINEB,*
000064	062716  000010 				ADD	#10,(SP)
000070	011446 					MOV	(R4),-(SP)
000072	004767  000000G				JSR	PC,BL$MOV
000076	010014 					MOV	R0,(R4)				;					2052
000100	062706  000006 				ADD	#6,SP				;					2050
000104	012700  000001 				MOV	#1,R0
000110	000207 					RTS	PC
000112	005000 				2$:	CLR	R0				;					2005
000114	000207 					RTS	PC

; Routine Size:  39 words,	Routine Base:  $CODE$ + 10650
; Maximum stack depth per invocation:  10 words
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  65
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (8)

;	  2060	map CCB: ref block field (C_XPT_fields);
;	  2061	local NODEb,LINEb;
;	  2062	require 'XPTSYM';
;	  2099	local RET,SDB_ADDR,LEN,PTRA;
;	  2100	local CCB_P: ref block field(C_XPT_fields);
;	  2101	pointer PTR;
;	  2102	
;	  2103	!
;	  2104	!  Check destination address for validity
;	  2105	!
;	  2106	
;	  2107	LINEb = $XPT_GET_LINE_DB(.OLINE);	!Address output line data base entry
;	  2108	if (.Nid neq .DEST) then		!Destination is not adjacent over
;	  2109	    return (CE_DIS);			!  output line - return "unreachable"
;	  2110	
;	  2111	!
;	  2112	!  Get an SDB
;	  2113	!
;	  2114	
;	  2115	if not GETBUF(15,CCB) then		 !Couldn't get one -
;	  2116	    return (CE_RTE);			 !  return "resource failure"
;	  2117	CCB[C_CHN] = CCB_P = .CCB[C_STK];	 !Chain the CCBs
;	  2118	
;	  2119	!
;	  2120	!  Build the header
;	  2121	!
;	  2122	
;	  2123	MAPBUF(.CCB,SDB_ADDR,LEN);		!Map in the SDB
;	  2124	PTR = .SDB_ADDR;
;	  2125	putb(PH2_RTflgs,PTR);			!Put in the RTFLGS
;	  2126	putb(.Nnml,PTR);			!Move in the destination name length
;	  2127	PTR = ch$move(.Nnml,			!Move in the destination
;	  2128	    byt$ptr(Nnm),.PTR);			!  node name from the ID block
;	  2129	PTRA = ch$plus(.PTR,1);			!Point to source name field
;	  2130	LINEb = $XPT_GET_LINE_DB(.ILINE);
;	  2131	NODEb = $XPT_GET_NODE_DB(.SOURCE);      ! Address source node data base entry
;	  2132	if .SOURCE eql .Tid                     ! Source is local node -
;	  2133	then begin
;	  2134	     putb(.NODEname_length,PTR);        !  move in
;	  2135	     PTRA = ch$move(.NODEname_length,	!  the local
;	  2136	         byt$ptr(NODEname,0),.PTRA);	!  node name
;	  2137	     end
;	  2138	else if not (.Phase2_node and
;	  2139	             begin
;	  2140	             PTRA = .PTR;
;	  2141	             if CONVERT(.SOURCE,.ILINE,PTRA) then TRUE
;	  2142	             else if (decr J from NLN to 1 do
;	  2143	                      (if CONVERT(.SOURCE,.J,PTRA) then exitloop(0))) eql 0
;	  2144	                  then TRUE
;	  2145	                  else FALSE
;	  2146	             end)
;	  2147	     then if  ((.ILINE neq 0)
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  66
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (8)

;	  2148	               and  ((.Nty eql PhTwo)   ! Source is
;	  2149	               or (.Nty eql TOPS20))    !  adjacent and
;	  2150	               and  (.Nid eql .SOURCE)) !  Phase II:
;	  2151	          then begin                    !      
;	  2152	               putb(.Nnml,PTR);         !    adjacent
;	  2153	               PTRA = ch$move(.Nnml,    !    node name
;	  2154	                   byt$ptr(Nnm),.PTRA); !    into the header
;	  2155	               end
;	  2156	          else begin                    ! Otherwise -
;	  2157	               RET = CBTD(PTRA,.SOURCE);!  translate the source address
;	  2158	               putb(.RET,PTR);          !  to ASCII and move in the
;	  2159	               end;                     !  translated name length
;	  2160	CCB[C_CNT] = ch$diff(.PTRA,.SDB_ADDR);	!Calculate length of header
;	  2161	
;	  2162	
;	  2163	!
;	  2164	!  If requested to do so, adjust the buffer descriptor of the
;	  2165	!  pass-through CCB to point past an old header
;	  2166	!
;	  2167	
;	  2168	if .PT_HDR neq 0 then begin
;	  2169	    CCB[C_XPT_ADJUST] = .PT_HDR;		!Set up adjustment factor
;	  2170	    CCB_P[C_ADDR] = ch$plus			!Bump buffer address
;	  2171		(.CCB_P[C_ADDR],.PT_HDR);		!  past Phase III header
;	  2172	    CCB_P[C_CNT] = .CCB_P[C_CNT] - .PT_HDR;	!Also adjust count
;	  2173	    end;
;	  2174	
;	  2175	!
;	  2176	!  Return "success"
;	  2177	!
;	  2178	
;	  2179	return (CS_SUC)
;	  2180	end;				!End of BLDPH2


						.SBTTL	BLDPH2
000000	004167  000000G			; BLDPH2
					U.4:	JSR	R1,$SAVE5			;					1952
000004	162706  000010 				SUB	#10,SP
000010	016600  000030 				MOV	30(SP),R0			; OLINE,*				2107
000014	004767  000000G				JSR	PC,GTLINE
000020	010066  000004 				MOV	R0,4(SP)			; *,LINEB
000024	026066  000004  000034 			CMP	4(R0),34(SP)			; *(LINEB),DEST				2108
000032	001403 					BEQ	1$
000034	012700  177520 				MOV	#-260,R0			;					2109
000040	000423 					BR	3$
000042	012701  000017 			1$:	MOV	#17,R1				;					2115
000046	004767  000000G				JSR	PC,$CORGT
000052	103414 					BCS	2$
000054	016601  000040 				MOV	40(SP),R1			; CCB,*
000060	010061  000020 				MOV	R0,20(R1)			; $MCB$R0,*
000064	010100 					MOV	R1,R0				; CCB,*
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  67
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (8)

000066	016760  000000G 000016 			MOV	KISAR6,16(R0)
000074	012760  000017  000034 			MOV	#17,34(R0)
000102	000404 					BR	4$
000104	012700  177730 			2$:	MOV	#-50,R0				;					2116
000110	000167  000512 			3$:	JMP	16$
000114	016666  000040  000002 		4$:	MOV	40(SP),2(SP)			; CCB,*					2117
000122	016600  000002 				MOV	2(SP),R0
000126	016003  000004 				MOV	4(R0),R3			; *,CCB.P
000132	010360  000002 				MOV	R3,2(R0)			; CCB.P,*
000136	016067  000016  000000G			MOV	16(R0),KISAR6			;					2123
000144	016016  000020 				MOV	20(R0),(SP)			; *,SDB.ADDR
000150	011601 					MOV	(SP),R1				; SDB.ADDR,PTR				2124
000152	112721  000106 				MOVB	#106,(R1)+			; *,PTR					2125
000156	016600  000004 				MOV	4(SP),R0			; LINEB,*				2126
000162	116021  000007 				MOVB	7(R0),(R1)+			; *(LINEB),PTR
000166	010002 					MOV	R0,R2				; LINEB,*				2128
000170	116200  000007 				MOVB	7(R2),R0			; *(LINEB),*
000174	010046 					MOV	R0,-(SP)
000176	016646  000006 				MOV	6(SP),-(SP)			; LINEB,*
000202	062716  000010 				ADD	#10,(SP)
000206	010146 					MOV	R1,-(SP)			; PTR,*
000210	004767  000000G				JSR	PC,BL$MOV
000214	010001 					MOV	R0,R1				; *,PTR					2127
000216	012766  000001  000014 			MOV	#1,14(SP)			; *,PTRA				2129
000224	060166  000014 				ADD	R1,14(SP)			; PTR,PTRA
000230	016602  000034 				MOV	34(SP),R2			; ILINE,*				2130
000234	010200 					MOV	R2,R0
000236	004767  000000G				JSR	PC,GTLINE
000242	010066  000012 				MOV	R0,12(SP)			; *,LINEB
000246	016604  000040 				MOV	40(SP),R4			; SOURCE,*				2131
000252	010400 					MOV	R4,R0
000254	004767  000000G				JSR	PC,GTNODE
000260	010005 					MOV	R0,R5				; *,NODEB
000262	016700  000002G				MOV	.CRDAT+2,R0			;					2132
000266	020460  000056 				CMP	R4,56(R0)
000272	001017 					BNE	5$
000274	116021  000114 				MOVB	114(R0),(R1)+			; *,PTR					2134
000300	016016  000114 				MOV	114(R0),(SP)			;					2136
000304	012746  000116 				MOV	#116,-(SP)
000310	060016 					ADD	R0,(SP)
000312	016646  000016 				MOV	16(SP),-(SP)			; PTRA,*
000316	004767  000000G				JSR	PC,BL$MOV
000322	010066  000020 				MOV	R0,20(SP)			; *,PTRA				2135
000326	022626 					CMP	(SP)+,(SP)+			;					2133
000330	000511 					BR	14$				;					2132
000332	032715  001000 			5$:	BIT	#1000,(R5)			; *,NODEB				2138
000336	001434 					BEQ	10$
000340	010166  000014 				MOV	R1,14(SP)			; PTR,PTRA				2140
000344	012716  000014 				MOV	#14,(SP)			;					2141
000350	060616 					ADD	SP,(SP)				; PTRA,*
000352	010205 					MOV	R2,R5
000354	004767  177302 				JSR	PC,U.44
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  68
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (8)

000360	006000 					ROR	R0
000362	103474 					BLO	14$
000364	016705  000002G				MOV	.CRDAT+2,R5			;					2142
000370	016505  000022 				MOV	22(R5),R5			; *,J
000374	003412 					BLE	8$
000376	012716  000014 			6$:	MOV	#14,(SP)			;					2143
000402	060616 					ADD	SP,(SP)				; PTRA,*
000404	004767  177252 				JSR	PC,U.44
000410	006000 					ROR	R0
000412	103002 					BCC	7$
000414	005000 					CLR	R0
000416	000403 					BR	9$
000420	077512 				7$:	SOB	R5,6$				; J,*					0000
000422	012700  177777 			8$:	MOV	#-1,R0				;					2142
000426	001452 				9$:	BEQ	14$
000430	005702 				10$:	TST	R2				;					2147
000432	001440 					BEQ	12$
000434	016600  000012 				MOV	12(SP),R0			; LINEB,*				2148
000440	126027  000002  000004 			CMPB	2(R0),#4			; *(LINEB),*
000446	001404 					BEQ	11$
000450	126027  000002  000005 			CMPB	2(R0),#5			; *(LINEB),*				2149
000456	001026 					BNE	12$
000460	016600  000012 			11$:	MOV	12(SP),R0			; LINEB,*				2150
000464	026004  000004 				CMP	4(R0),R4			; *(LINEB),*
000470	001021 					BNE	12$
000472	116011  000007 				MOVB	7(R0),(R1)			; *(LINEB),PTR				2152
000476	010002 					MOV	R0,R2				; LINEB,*				2154
000500	116200  000007 				MOVB	7(R2),R0			; *(LINEB),*
000504	010016 					MOV	R0,(SP)
000506	010246 					MOV	R2,-(SP)			; LINEB,*
000510	062716  000010 				ADD	#10,(SP)
000514	016646  000016 				MOV	16(SP),-(SP)			; PTRA,*
000520	004767  000000G				JSR	PC,BL$MOV
000524	010066  000020 				MOV	R0,20(SP)			; *,PTRA				2153
000530	005726 					TST	(SP)+				;					2151
000532	000407 					BR	13$				;					2147
000534	012716  000014 			12$:	MOV	#14,(SP)			;					2157
000540	060616 					ADD	SP,(SP)				; PTRA,*
000542	010446 					MOV	R4,-(SP)
000544	004767  000000G				JSR	PC,CBTD
000550	110011 					MOVB	R0,(R1)				; RET,PTR				2158
000552	005726 				13$:	TST	(SP)+				;					2147
000554	016600  000014 			14$:	MOV	14(SP),R0			; PTRA,*				2160
000560	166600  000006 				SUB	6(SP),R0			; SDB.ADDR,*
000564	016601  000010 				MOV	10(SP),R1
000570	010061  000022 				MOV	R0,22(R1)
000574	016600  000044 				MOV	44(SP),R0			; PT.HDR,*				2168
000600	001406 					BEQ	15$
000602	110061  000033 				MOVB	R0,33(R1)			;					2169
000606	060063  000020 				ADD	R0,20(R3)			; *,*(CCB.P)				2171
000612	160063  000022 				SUB	R0,22(R3)			; *,*(CCB.P)				2172
000616	062706  000006 			15$:	ADD	#6,SP				;					1952
XPTSEL								25-Jan-1983 09:50:47	TOPS-20 Bliss-16 2A(530)	    Page  69
X01710								30-Dec-1982 21:46:26	NETPKG:<XPT>XPTSEL.BLI.8 (8)

000622	012700  000001 				MOV	#1,R0				;					1994
000626	062706  000010 			16$:	ADD	#10,SP				;					1952
000632	000207 					RTS	PC

; Routine Size:  206 words,	Routine Base:  $CODE$ + 10766
; Maximum stack depth per invocation:  16 words


;	  2181	
;	  2182	end				!End of module XPTSEL
;	  2183	eludom



;					OTS external references
						.GLOBL	$SAVE5, $SAVE4, $STOP, $IGNAL
						.GLOBL	BL$NEQ, BL$EQL, BL$MOV


;					PSECT SUMMARY
;
;	Psect Name			Words	  Attributes
;	 $PLIT$				    2	    RO ,  D  ,  LCL,  REL,  CON
;	 $CODE$				 2505	    RO ,  I  ,  LCL,  REL,  CON




;				LIBRARY STATISTICS
;
;					     -------- Symbols --------    Blocks
;	File				     Total    Loaded   Percent      Read
;
;  NETPKG:<MCB>XPORTX.L16.15		       599         2         0         0
;  NETPKG:<MCB>MCBLIB.L16.15		       372        44        11         0
;  NETPKG:<MCB>NMXLIB.L16.13		       200        11         5         0
;  NETPKG:<XPT>XPTLIB.L16.3		       510       196        38         0





; Size:		2505 code + 2 data words
; Run Time:	00:41.6
; Elapsed Time:	02:46.8
; Memory Used:	94 pages
; Compilation Complete
ADDRESS				 392+	 394+	 395+	 397+	 398+	 400+	 401+	 407+	 408+	 411+	 412+	 413+
BAD_ROUT_HDR			1501#
BITOFF				1296	1324
BITON				 872	 873	1538
BLDPH2				 332	 729	1144	1641	1952*
BLDPH3				 333	 739	1612	1862*
BPT				 421+#	 433+#	1108	1174	1603	1681
BUFCHK				 425+	 426+#	 435+	 436+#
BUFLEN				1499	1586#	1588#	1589	1590	1638#	1640#	1641
BUFPTR				1685	1771	1903	1932	1933
BUFSIZE				 664	 666#	 668#	 670
BYT$PTR				1330	1334	1366	1791	1807	1849	1911	2053	2128	2136	2154
CALL$E				 784	1003	1057	1165	1365	1544	1599	1624	1671
CALLER				 562	 570	 644#	 688	 765
CB				 570	 612	 622	 623	 624
CBTD				 470	2157
CCB				 443	 445	 446	 447	 448#	 560	 637#	 638	 642	 643	 644	 658
				 660#	 670	 672	 678#	 679#	 688	 700#	 702	 703#	 704	 707	 729
				 739	 746	 753	 765	 772	 773	 774	 868	 883	 930	 938	 951
				 993	1006#	1007#	1008#	1009	1013	1015	1017	1066	1070#	1071#	1086
				1098#	1099#	1100#	1101#	1104	1106	1116#	1117#	1118#	1122	1124	1127
				1141	1144	1147	1151	1154	1156	1159	1233	1235	1314	1347	1351
				1352	1353	1356#	1357#	1358#	1359#	1360#	1365	1380	1382	1424	1439
				1440	1441	1451	1496	1527	1529#	1530#	1531#	1550	1570	1580#	1581#
				1582#	1583#	1589#	1590#	1594	1597	1612	1615	1617	1620	1641	1644
				1648	1654#	1655#	1656#	1660	1662	1664	1667	1862	1901	1910	1911
				1912#	1913#	1914#	1915#	1940#	1952	2060	2115	2117#	2123	2160#	2169#
CCBGT$				1066	1527
CCBRT$				 746
CCB_P				 476	 561	 637	 665	 678	 701	 709	 784	 792	 869	 951	 994
				 998	1003	1006	1007	1008	1013	1028	1043	1053	1057	1067	1070
				1086	1098	1099	1100	1101	1116	1117	1118	1124	1148	1151	1156
				1160	1165	1179	1233	1274	1283	1303	1352#	1353#	1358	1359	1422
				1424#	1440	1497	1507	1512	1514	1516	1528	1529	1537	1545	1550
				1570	1580	1581	1582	1583	1599	1617	1624	1648	1654	1655	1656
				1664	1672	1903	1904	1910#	1915	1932	1941#	1942#	2100	2117#	2170#
				2171	2172#
CDTB				 469	1775
CE_DIS				 625	 764	1015	1017	1123	1141	1150	1155	1347	1616	1663	2109
CE_ERR				 641	 714	 728	1053	1516
CE_RTE				 659	 673	 707	 771	 775	 938	1146	1451	1643	2116
CHKBUF				 428+*	 429+
CONVERT				2005*	2141	2143
CONVERT_LINKAGE			2004#	2005#
COUNTER_INCREMENT		 614	 755	 933	 936	1000	1001	1054	1055	1088	1103	1120	1128
				1138	1163	1291	1293	1294	1445	1449	1569	1593	1613	1622	1635
				1669
CS_SUC				 705	 709	 711	 746	 754	 786	1014	1105	1126	1158	1596	1619
				1647	1666	1949	2179
C_ADDR				 446	 702	1003	1007	1009	1057	1099	1117	1352	1359	1514	1581
				1589	1655	1913	1941	2170	2171
C_BIAS				 447	 702	1006	1098	1116	1358	1580	1654	1912
C_CHN				 669	1360	1915	2117
C_CNT				 668	 700	1008	1100	1118	1353	1512	1582	1590	1656	1914	1942
				2160	2172
C_FIELDS			 561	 664	 869	 993	 994	1497	1904
C_LIN				 643	1013	1043	1101	1507	1583
C_LIX				 703	 998
C_OWN				1439
C_PIX				 644
C_PRM1				 642	1911
C_PRM2				 638
C_PRM4				 679	1071
C_PRM5				 707
C_STK				 678	1070	1424	1529	1910	2117
C_XPT_ADJUST			1351	1352	1353	1357	1531	1940	2169
C_XPT_ALLOCATION		 448	 622	 623	 660	 772	 773
C_XPT_FIELDS			 445	 560	 612	 868	1235	1274	1382	1496	1901	2060	2100
C_XPT_TYPE			1356	1530
DC_MSGFLGS			1346
DEST				 562	 570	 618	 638#	 639	 689	 704	 727	 729	 739	 765	 785
				 870	 883	 929	 951	1012	1030#	1040	1067	1079	1086	1104	1106
				1108	1125	1127	1140	1144	1148	1152	1157	1160	1165	1380	1431
				1499	1540	1545	1552	1595	1600	1603	1612	1620	1625	1641	1644
				1659	1660	1667	1672	1862	1922	1952	2108
DESTAD				1685	1770#	1779#	1789#	1809#	1851#
DLLQUOTA			1363#
ECLFWD				 468	 704	1104	1594
FALSE				 451	1079	1082	1546	2057	2145
FORWARDER			 467*	 753	1013	1122	1154	1615	1662
FULL				1114	1609
GETB				1029	1295	1298	1300	1323	1328	1332	1336	1538	1585	1588	1637
				1640	1772	1846	1934	1937
GETBUF				 443#	 670	2115
GETQ				 392+#
GETW				 371+#	 394+	 395+	1030#	1031	1339	1340
HDRFLG				1862	1931
HDRLEN				1903	1936#	1939#	1940	1942
I				 416+	 418+	1800	1801
ICPTD				1499	1520#	1521#	1547#	1598	1623	1670
ILINE				 870	 883	 935	1043#	1044	1067	1087	1102	1106	1119	1127	1137
				1145	1148	1160	1233	1284	1314	1380	1435	1436	1448	1499	1507#
				1508	1528	1539	1550	1568	1570	1592	1597	1611	1617	1620	1642
				1644	1648	1660	1664	1667	1685	1844	1952	2130	2141	2147
INPUTCOUNT			1362#
INPUTQUOTA			 710#
INTPH2				 784	1165	1544	1599	1624	1671
ISHDR				1499	1541#	1546#	1584	1612
J				 416+	 418+	2142	2143
LEN				 443	 446	 448	1763	1772#	1773	1775	1790	1791	1805	1806	1845
				1846#	1847	1848	1903	1932	1934#	1935	1936	1937#	1938	1939	2099
				2123
LEND				1275	1325#	1332#	1333	1335	1366
LENS				1275	1328#	1329	1331	1366
LINE				2005	2047
LINEBLOCK			 550+	 602+	 858+	 915+	 983+	1264+	1412+	1486+	1751+	2036+	2089+
LINEB				 522	 548+	 550+	 600+	 602+	 685#	 721#	 755	 830	 856+	 858+	 886
				 913+	 915+	 926#	 933	 935#	 936	 955	 981+	 983+	 998#	1044#	1055
				1077#	1087#	1088	1102#	1103	1119#	1120	1121#	1128	1137#	1138	1139#
				1163	1236	1262+	1264+	1284#	1365	1384	1410+	1412+	1428#	1435#	1444#
				1445	1448#	1449	1458	1484+	1486+	1508#	1560#	1568#	1569	1592#	1593
				1611#	1613	1614#	1622	1635	1658#	1669	1723	1749+	1751+	1801#	1844#
				2008	2034+	2036+	2047#	2061	2087+	2089+	2107#	2130#
LINESTATE			 687	1081	1567
LINKD				1275	1340#	1366
LINKS				1275	1339#	1366
LOCAL_NODE			 651	 698	1042	1097	1559	1579
M				 416+	 417+
MAPBUF				1028	1283	1303	1537	1932	2123
MATRIX				 416+#	 418+
MAXV				1050	1051
MCB$GAW_PROCESS_DATA_BASE	 553+	 554+	 557+	 605+	 606+	 609+	 861+	 862+	 865+	 918+	 919+	 922+
				 986+	 987+	 990+	1267+	1268+	1271+	1415+	1416+	1419+	1489+	1490+	1493+
				1754+	1755+	1758+	2039+	2040+	2043+	2092+	2093+	2096+
MISC_ERROR			1367
N				 416+	 417+
NID				 727	 929	1140	1431	1659	1809	1855	2050	2108	2150
NL				 416+	 418+
NLN				1800	2142
NMXID				1004	1307	1515
NN				1079	1776
NNM				1807	1849	2053	2128	2154
NNML				1805	1847	2051	2052	2126	2127	2152	2153
NODE				2005	2050
NODEBLOCK			 545+	 597+	 853+	 910+	 978+	1259+	1407+	1481+	1746+	2031+	2084+
NODEB				 522	 543+	 545+	 595+	 597+	 639#	 640#	 830	 851+	 853+	 908+	 910+
				 976+	 978+	1040#	1257+	1259+	1405+	1407+	1458	1479+	1481+	1552#	1744+
				1746+	2029+	2031+	2061	2082+	2084+	2131#
NODENAME			1791	2136
NODENAME_LENGTH			1790	1791	2134	2135
NOP				 433+	 434+	 436+
NO_LINEB			 549+	 574#	 601+	 857+	 914+	 982+	1263+	1411+	1485+	1750+	2035+	2088+
NO_NODEB			 544+	 573#	 596+	 852+	 887#	 909+	 954#	 977+	1258+	1406+	1480+	1745+
				2030+	2083+
NO_PATH_ERROR			1367	1500#
NTY				 722	 723	 928	1114	1115	1135	1136	1164	1174	1313	1430	1437
				1509	1510	1521	1609	1610	1633	1634	1670	1681	1802	1803	2049
				2148	2149
OL				 652	1042	1559
OLINE				 562	 643#	 650	 652#	 662	 677	 685	 687	 697	 721	 730	 753
				 870	 883	 926	 927	 932	1041#	1042#	1067	1077	1081	1096	1106
				1121	1122	1127	1139	1145	1148	1154	1160	1380	1428	1429	1443
				1444	1499	1558#	1559#	1560	1567	1578	1614	1615	1620	1642	1644
				1658	1660	1662	1667	1952	2107
OTYPE				 562	 699#	 724#	 725#	 738#	 783
PARAMETER_CM			 616
PARAMETER_DU_2			 618	 619
PARAMETER_HI			1305	1514
PARAMETER_H_1			 617	 620
PD_XPE				 784	1003	1057	1165	1365	1544	1599	1624	1671
PD_XPT				1439
PH2HDR				 334	1539	1685*
PH2_RTFLGS			2125
PHASE2_NODE			2138
PHTWO				 722	 723	 928	1135	1164	1430	1437	1510	1521	1633	1670	1802
				2049	2148
PKTA_HDR			1003	1057
POINTER				 871	 996	1277	1498	1762	1902	2101
PTR				 371+	 374+	 375+	 378+	 381+	 382+	 388+	 389+	 392+	 394+	 395+	 397+
				 400+	 401+	 402+	 403+	 407+	 408+	 871	 996	1009#	1010	1011	1012
				1028	1029	1030	1031	1032	1034	1277	1283	1295	1298	1299#	1300
				1303	1306	1323	1328	1329	1331#	1332	1333	1335#	1336	1339	1340
				1498	1537	1538	1539	1585	1587#	1588	1637	1639#	1640	1762	1771#
				1772	1775	1791	1806	1845#	1846	1848	1902	1911#	1913	1921	1922
				1923	1924	1933#	1934	1935#	1937	1938#	1941	2101	2124#	2125	2126
				2127#	2128	2129	2134	2140	2152	2158
PTRA				2099	2129#	2135#	2136	2140#	2141	2143	2153#	2154	2157	2160
PTRAD				2005	2051	2052#	2053
PT_HDR				1952	2168	2169	2171	2172
PUTB				1010	1921	1924	2051	2125	2126	2134	2152	2158
PUTQ				 397+#
PUTW				 378+#	 407+	 408+	1011	1012	1922	1923
RCVDAT				 330	 792*
RCVECL				 329	 476*
RCVPH2				 331	1179*
REACH				 686	1080	1566
RET				 562	 695	 726#	 739#	 746	 753#	 756	 764	 771	 870	1079#	1082#
				1086	1122#	1123	1126	1144#	1146	1150	1154#	1155	1158	1275	1295#
				1296#	1298#	1299	1300#	1302#	1306	1323#	1324	1336#	1346	1499	1511
				1512#	1514	1539#	1544#	1549	1550	1585#	1586	1587	1612#	1615#	1616
				1619	1636	1637#	1638	1639	1641#	1643	1647	1662#	1663	1666	1763
				1775#	1776	1778	1779	1780#	1788#	1799#	1810#	1837	1856	2099	2157#
				2158
RE_QUEUE			 471	 930	1439
RFLG				 870	 872	 873	 951	1010	1029#	1086	1125	1152	1157
RQR				 873#	1005	1862	1921
RQRFLG				 873
RTS				 872#	1005	1051
RTSFLG				 872	1010
RU				 687	1081	1567
SDB_ADDR			2099	2123	2124	2160
SEND_DC				1365
SMALL				1115	1610
SMAP$				 447
SRCAD				1685	1770#	1855#
TERMINATE			 472	 709	 938	1015	1017	1053	1141	1347	1451	1516
TID				 739	1789	2132
TMPCCB				 664	 665#	 668	 669#
TOSS				 883*	1067	1106	1127	1148	1160	1224	1314	1380*	1528	1597	1620
				1644	1660	1667
TRUE				 449	1083	1541	2054	2141	2144
UNIT				 416+#	 417+	 418+
UNREACH				 570*	 688	 765	 951*	1086	1124	1151	1156	1233*	1550	1570	1617
				1648	1664
UNSPAWN				 473	1147	1159	1440
VALUE				 378+	 379+	 381+	 382+	 387+
VISIT				 870	1032#	1033#	1034	1050	1051
WORKD				1276	1334	1366
WORKS				1276	1330	1366
X				 373+	 374+#	 375+#	 376+	 386+	 387+#	 388+	 389+
XPT$_DNS			1108	1603
XPT$_IANT			1174	1681
XPTAGED_LOSS			1054
XPTDBBLOCK			 559+	 611+	 867+	 924+	 992+	1273+	1421+	1495+	1760+	2045+	2098+
XPTDB				 556+	 557+#	 558+	 608+	 609+#	 610+	 614	 864+	 865+#	 866+	 921+	 922+#
				 923+	 989+	 990+#	 991+	1000	1001	1054	1270+	1271+#	1272+	1291	1293
				1294	1418+	1419+#	1420+	1492+	1493+#	1494+	1757+	1758+#	1759+	2042+	2043+#
				2044+	2095+	2096+#	2097+
XPTEND_CNG			 936	1449
XPTEND_RCV			1103	1593
XPTEND_XMT			 755
XPTFMT_LOSS			1294
XPTRANGE_LOSS			1001	1293
XPTSEL				   1#
XPTUNREACH_LOSS			 614	1000	1291
XPTXIT_CNG			 933	1445
XPTXIT_RCV			1055	1088	1120	1138	1569	1613	1635
XPTXIT_XMT			1128	1163	1622	1669
ZEROQ				 411+#
$MCB_COPY_CHAIN_TO_BUFFER	 701
$MCB_GET_BUFFER			 446
$MCB_GET_CCB			 658
$MCB_RETURN_CCB_AND_BUFFER	 623	 706	 773
$MCB_RETURN_CCB			 624	 672	 774
$NM_LOG_BEGIN			 615	1002	1056	1304	1513
$NM_LOG_END			 621	1004	1058	1307	1515
$XPT$E_AGE			1058
$XPT$E_FMT			1305	1367	1515	1774	1852
$XPT$E_RNG			1079	1292	1777
$XPT$E_UNR			 621	 999	1082	1125	1152	1157	1290	1570	1618	1649	1665	1837
$XPT_GET_LINE_DB		 685	 721	 926	 935	 998	1044	1077	1087	1102	1119	1121	1137
				1139	1284	1428	1435	1444	1448	1508	1560	1568	1592	1611	1614
				1658	1801	1844	2047	2107	2130
$XPT_GET_NODE_DB		 639	1040	1552	2131
%CTCE				 379+	 398+
%REMAINING			 423+