Google
 

Trailing-Edge - PDP-10 Archives - BB-P363B-SM_1985 - mcb/nml/nmlctt.lst
There are no other files named nmlctt.lst in the archive.
								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page   1
								 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (1)

;	  0001	!NET:<BRANDT.DEVELOPMENT>NMLCTT.BLI.1  9-Dec-82 18:00:03, Edit by BRANDT
;	  0002	!
;	  0003	! Ident 04.
;	  0004	! Change COUNTER_BUFFER_SIZE to 200 and allocation call as suggested
;	  0005	! by VOBA and GROSSMAN.
;	  0006	!
;	  0007	! NET:<PECKHAM.DEVELOPMENT>NMLCTT.BLI.4  6-Mar-82 21:19:03, Edit by PECKHAM
;	  0008	!
;	  0009	! Ident 03.
;	  0010	! Change input parameters for $NML$SHOZC.
;	  0011	!
;	  0012	! NET:<PECKHAM.DEVELOPMENT>NMLCTT.BLI.2  5-Feb-82 16:38:08, Edit by PECKHAM
;	  0013	!
;	  0014	! Ident 02.
;	  0015	! Fix range checking for 16 bit machines in NML$COUNTER_TIMER_SET.
;	  0016	!
;	  0017	! NET:<GROSSMAN>NMLCTT.BLI.2 27-Jan-82 08:44:55, Edit by GROSSMAN
;	  0018	!
;	  0019	! Ident 1.
;	  0020	! Don't allow counter timers to be set with 0, negative, or values greater
;	  0021	! than 65536. The routine NML$COUNTER_TIMER_SET will return a $false value
;	  0022	! if there is an attempt to do so.
;	  0023	!
;	  0024	! NET:<GROSSMAN>NMLCTT.BLI.34 26-Jan-82 06:48:16, Edit by GROSSMAN
;	  0025	!
;	  0026	! Fix bug in NML$CTR_CHECK_TIME. This caused the counter block given in
;	  0027	! the call to NMU$QUEUE_SCAN to never be changed (and this caused the task to
;	  0028	! always schedule the first counter block that ever got set). Also fix bugs
;	  0029	! related to being woken up on multiple events. We can now successfully wake
;	  0030	! up on counter timer queue changes, and on timeouts!
;	  0031	!
;	  0032	! NET:<GROSSMAN>NMLCTT.BLI.10 23-Jan-82 02:25:06, Edit by GROSSMAN
;	  0033	!
;	  0034	! Fix bug(s) with routines called by NMU$QUEUE_SCAN. They were all declared
;	  0035	! novalue, but it turns out to be much more valuable to return values than
;	  0036	! not to, because a non-zero value (which the novalue attribute does not
;	  0037	! ensure) terminates queue scanning immediately. This screws me up.
;	  0038	!
;	  0039	! NET:<GROSSMAN>NMLCTT.BLI.8 22-Jan-82 14:46:13, Edit by GROSSMAN
;	  0040	!
;	  0041	! Fix routine NML$CTR_CHECK_TIME so that it returns the counter block with
;	  0042	! the least date/time.
;	  0043	!
;	  0044	! NET:<GROSSMAN>NMLCTT.BLI.6 22-Jan-82 02:17:43, Edit by GROSSMAN
;	  0045	!
;	  0046	! Fix NML$CTR_REMOVE_ENTITY so that it knows how to remove the first item
;	  0047	! on the counter blocks entity list.
;	  0048	!
;	  0049	! NET:<GROSSMAN>NMLCTT.BLI.17 21-Jan-82 10:35:42, Edit by GROSSMAN
;	  0050	!
;	  0051	! Add the SHOW and ZERO function and event logging interface...
;	  0052	!
								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page   2
								 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (2)

;	  0053	
;	  0054	module NMLCTT (					! Counter Timer Task
;	  0055			ident = 'X00.04'
;	  0056			) =
;	  0057	begin
;	  0058	!
;	  0059	!                    COPYRIGHT (c) 1980, 1981, 1982
;	  0060	!                    DIGITAL EQUIPMENT CORPORATION
;	  0061	!                        Maynard, Massachusetts
;	  0062	!
;	  0063	!     This software is furnished under a license and may  be  used
;	  0064	!     and copied only in accordance with the terms of such license
;	  0065	!     and with the inclusion of the above copyright notice.   This
;	  0066	!     software  or any other copies thereof may not be provided or
;	  0067	!     otherwise made available to any other person.  No  title  to
;	  0068	!     and ownership of the software is hereby transferred.
;	  0069	!
;	  0070	!     The information  in  this  software  is  subject  to  change
;	  0071	!     without  notice  and should not be construed as a commitment
;	  0072	!     by DIGITAL EQUIPMENT CORPORATION.
;	  0073	!
;	  0074	!     DIGITAL assumes no responsibility for the use or reliability
;	  0075	!     of  its  software  on  equipment  which  is  not supplied by
;	  0076	!     DIGITAL.
;	  0077	!
;	  0078	
;	  0079	!++
;	  0080	! Facility: LSG DECnet Network Management
;	  0081	!
;	  0082	! Abstract:
;	  0083	!
;	  0084	!	This module implements the Counter Timer functionality. This task wakes
;	  0085	!	up every time a Counter Timer goes off in order	to generate an
;	  0086	!	Automatic Counter event. The internal functioning of this module will
;	  0087	!	be to repeatedly do a Read-and-Zero function for each entity which has
;	  0088	!	a counter timer set. And then to sleep until the next counter timer
;	  0089	!	goes off. The actual counter timer event would seem to be an atomic
;	  0090	!	operation to the user.
;	  0091	!
;	  0092	! Environment: TOPS10 and TOPS20 user mode, MCB RSX task mode
;	  0093	!
;	  0094	! Author: Stu Grossman, Creation date: 6 January 1982
;	  0095	!
;	  0096	!--
;	  0097	
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page   3
X00.04								 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (3)

;	  0098	
;	  0099	!
;	  0100	! Include files
;	  0101	!
;	  0102	
;	  0103	library 'NMLLIB';			! NML definitions
;	  0104	
;	  0105	!
;	  0106	! External routines
;	  0107	!
;	  0108	
;	  0109	external routine
;	  0110	    NMU$TABLE_ROUTINES,			! Table manipulation stuff
;	  0111	    NMU$QUEUE_MANAGER,			! Queue management routines
;	  0112	    NMU$SCHED_MANAGER,			! Scheduler routines
;	  0113	    NMU$MEMORY_MANAGER,			! Memory management routines
;	  0114	    NML$DECLARE_EVENT;                  ! Interface to event generator
;	  0115	
;	  0116	!
;	  0117	! Debugging definitions
;	  0118	!
;	  0119	
;	  0120	external
;	  0121	    %debug_data_base;			! Debugging definitions
;	  0122	
;	  0123	!
;	  0124	! Forward references
;	  0125	!
;	  0126	
;	  0127	forward routine
;	  0128	    NML$CTR_CHECK_TIME,
;	  0129	    NML$CTR_COUNTER_TIMER_PREDICATE,
;	  0130	    NML$CTR_ENTITY_LIST_SCANNER,
;	  0131	    NML$CTR_REMOVE_ENTITY : novalue,
;	  0132	    NML$CTR_COUNTER_QUEUE_SCANNER;
;	  0133	
;	  0134	!
;	  0135	! Counter timer block definitions
;	  0136	!
;	  0137	
;	  0138	$field
;	  0139	    CTR_FIELDS =
;	  0140		set
;	  0141		    CTR_QUEUE = [$sub_block (Q_ENTRY_SIZE)],	! Queue of these blocks
;	  0142		    CTR_TIME = [$sub_block (TIME_BLOCK_SIZE)],	! Abs time of next period
;	  0143		    CTR_PERIOD = [$integer],			! Period in seconds
;	  0144		    CTR_ENTITY_LIST = [$address]		! Pointers to entities on this timer
;	  0145		tes;
;	  0146	
;	  0147	literal
;	  0148	    CTR_SIZE = $field_set_size,
;	  0149	    CTR_ALLOCATION = $field_set_units;
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page   4
X00.04								 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (3)

;	  0150	
;	  0151	macro
;	  0152	    CTR_BLOCK = block [CTR_SIZE] field (CTR_FIELDS) %;
;	  0153	
;	  0154	!
;	  0155	! Entity block, pointed to by CTR_BLOCKs
;	  0156	!
;	  0157	
;	  0158	$field
;	  0159	    ENTITY_FIELDS =
;	  0160		set
;	  0161		    ENTITY_NEXT = [$address],		! Points to next block
;	  0162		    ENTITY_TYPE = [$tiny_integer],	! Entity type
;	  0163		    ENTITY_ID_PTR = [$pointer]		! Pointer to string id
;	  0164		tes;
;	  0165	
;	  0166	literal
;	  0167	    ENTITY_SIZE = $field_set_size,
;	  0168	    ENTITY_ALLOCATION = $field_set_units;
;	  0169	
;	  0170	macro
;	  0171	    ENTITY_BLOCK = block [ENTITY_SIZE] field (ENTITY_FIELDS) %;
;	  0172	
;	  0173	!
;	  0174	! Storage
;	  0175	!
;	  0176	
;	  0177	own
;	  0178	    COUNTER_TIMER_QUEUE : SQ_HEADER,
;	  0179	    OLD_ENTITY_ID : ref ENTITY_BLOCK,
;	  0180	    OLD_COUNTER_TIMER_BLOCK : ref CTR_BLOCK,
;	  0181	    COUNTER_TIMER_QUEUE_WAS_CHANGED;
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page   5
X00.04		NML$COUNTER_TIMER_TASK as NL_CTT		 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (4)

;	  0182	%global_routine ('NML$COUNTER_TIMER_TASK') : novalue =
;	  0183	
;	  0184	!++
;	  0185	! Functional description:
;	  0186	!
;	  0187	!	This routine will initialize the counter timer data base and
;	  0188	!	then loop forever waiting for counter timers to be set or for
;	  0189	!	counter timers to go off.
;	  0190	!
;	  0191	! Formal parameters:
;	  0192	!
;	  0193	!	None.
;	  0194	!
;	  0195	! Routine value:
;	  0196	!
;	  0197	!	None.
;	  0198	!
;	  0199	! Side effects:
;	  0200	!
;	  0201	!	None.
;	  0202	!
;	  0203	!--
;	  0204	
;	  0205	begin
;	  0206	    local
;	  0207		CURRENT_TIME : TIME_BLOCK,
;	  0208		TEMP,
;	  0209		CURRENT_COUNTER : ref CTR_BLOCK,
;	  0210		COUNTER_BUFFER_PTR,			! Points to receiving buffer
;	  0211		COUNTER_BUFFER_SIZE,			! Contains size of buffer
;	  0212		EVENT : ref RAW_EVENT_BLOCK;	! Event block
;	  0213	!
;	  0214	! Reset the counter timer scheduler queue
;	  0215	!
;	  0216	
;	  0217	    NMU$SQUEUE_RESET (COUNTER_TIMER_QUEUE);
;	  0218	    COUNTER_TIMER_QUEUE_WAS_CHANGED = $false;
;	  0219	!
;	  0220	! Set up a buffer for reading the counters into and a raw event block for
;	  0221	! queueing up the event.
;	  0222	!
;	  0223	
;	  0224	    COUNTER_BUFFER_SIZE = 200;
;	  0225	
;	  0226	    COUNTER_BUFFER_PTR =
;	  0227	      ch$ptr (NMU$MEMORY_GET (ch$allocation (.COUNTER_BUFFER_SIZE)),,8);
;	  0228	
;	  0229	    EVENT = NMU$MEMORY_GET (RAW_EVENT_BLOCK_ALLOCATION);
;	  0230	
;	  0231	!
;	  0232	! Loop forever doing this tasks' work
;	  0233	!
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page   6
X00.04		NML$COUNTER_TIMER_TASK as NL_CTT		 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (4)

;	  0234	
;	  0235	    while $true do
;	  0236	    begin
;	  0237	
;	  0238	!
;	  0239	! Block, waiting for the counter timer queue to become non-empty.
;	  0240	! After receiving an item reinstall it on the queue, because we really don't
;	  0241	! want to remove anything from the queue.
;	  0242	!
;	  0243		CURRENT_COUNTER = NMU$SQUEUE_REMOVE (COUNTER_TIMER_QUEUE);
;	  0244		NMU$QUEUE_INSERT (COUNTER_TIMER_QUEUE [Q_QUEUE],
;	  0245				  CURRENT_COUNTER [CTR_QUEUE]);
;	  0246	
;	  0247		COUNTER_TIMER_QUEUE_WAS_CHANGED = $false;
;	  0248	!
;	  0249	! Scan through the queue looking for the counter timer block that has the
;	  0250	! nearest time to now (or one that should have occurred already).
;	  0251	!
;	  0252		TIME_CURRENT (0, CURRENT_TIME);
;	  0253		NMU$QUEUE_SCAN (COUNTER_TIMER_QUEUE,
;	  0254				CURRENT_COUNTER,
;	  0255				NML$CTR_CHECK_TIME);
;	  0256	!
;	  0257	! See if the time has already passed, if it has, don't go to sleep, else
;	  0258	! sleep until we wake up at the right time (or if the COUNTER_TIMER_QUEUE
;	  0259	! has changed (so that we can reschedule)).
;	  0260	!
;	  0261	
;	P 0262		TEMP = TIME_DIFFERENCE_SECONDS (CURRENT_COUNTER [CTR_TIME],
;	  0263						      CURRENT_TIME);
;	P 0264		%debug (CTT_TRACE,
;	P 0265			(TRACE_INFO ('%D second counter selected in %D seconds',
;	P 0266				     .CURRENT_COUNTER [CTR_PERIOD],
;	  0267				     .TEMP)));
;	  0268	
;	  0269	!
;	  0270	! Now we have to put ourself on our own event queue so that when
;	  0271	! NML$COUNTER_TIMER_SET changes the counter timer queue, we get woken up.
;	  0272	! First, clear the event block, then put the current task (me) into the
;	  0273	! event queue for myself. This is just like doing an NMU$SCHED_WAIT with
;	  0274	! no wait.
;	  0275	!
;	  0276		if .TEMP gtr 0 then
;	  0277		begin
;	  0278		    bind
;	  0279			EB = COUNTER_TIMER_QUEUE [Q_EVENT] : EVENT_BLOCK;
;	  0280	
;	  0281		    NMU$TABLE_INSERT (EB [EB_TASKS], CURRENT_TASK);
;	  0282		    NMU$SCHED_SLEEP (.TEMP);
;	  0283		    NMU$TABLE_DELETE (EB [EB_TASKS], 1);
;	  0284		end;
;	  0285	!
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page   7
X00.04		NML$COUNTER_TIMER_TASK as NL_CTT		 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (4)

;	  0286	! Now, its time to see if we woke up because we timed out, or because we
;	  0287	! have to reschedule. This is done by examining the event queue. If the queue
;	  0288	! is still full, then we got here because of we woke up from our sleep, else
;	  0289	! the queue has been changed, and we have to reschedule.
;	  0290	!
;	  0291		if not .COUNTER_TIMER_QUEUE_WAS_CHANGED then
;	  0292		begin
;	  0293		    local
;	  0294			ENTITY : ref ENTITY_BLOCK;
;	  0295	
;	  0296		    ENTITY = .CURRENT_COUNTER [CTR_ENTITY_LIST];
;	  0297		    while .ENTITY neq 0 do
;	  0298		    begin
;	P 0299			%debug (CTT_TRACE,
;	P 0300				(TRACE_INFO ('Counter timer for entity %#A going off',
;	P 0301					     ch$rchar(.ENTITY[ENTITY_ID_PTR]),
;	  0302					     ch$plus(.ENTITY[ENTITY_ID_PTR],1))));
;	  0303			EVENT [REB_EVENT_CODE] = 0 ^ 6 + 8; ! Automatic Counters
;	  0304			EVENT [REB_ENTITY_TYPE] = .ENTITY [ENTITY_TYPE];
;	  0305			EVENT [REB_ENTITY_POINTER] = .ENTITY [ENTITY_ID_PTR];
;	  0306			EVENT [REB_DATA_POINTER] = .COUNTER_BUFFER_PTR;
;	  0307			EVENT [REB_DATA_LENGTH] = .COUNTER_BUFFER_SIZE;
;	  0308			EVENT [REB_TIME_BLOCK] = 0;
;	  0309	
;	P 0310			$NML$SHOZC(.ENTITY [ENTITY_TYPE],
;	P 0311				   .ENTITY [ENTITY_ID_PTR],
;	P 0312	                           , %(no qualifier)%
;	P 0313				   EVENT [REB_DATA_LENGTH],
;	  0314				   .COUNTER_BUFFER_PTR);
;	  0315	
;	  0316			NML$DECLARE_EVENT (.EVENT);
;	  0317			ENTITY = .ENTITY [ENTITY_NEXT];
;	  0318		    end;
;	P 0319		    TIME_PLUS (CURRENT_COUNTER [CTR_TIME],
;	  0320			       .CURRENT_COUNTER [CTR_PERIOD]);
;	  0321		end;
;	  0322	
;	  0323	
;	  0324	    end; ! End of task loop
;	  0325	end; ! End of NML$COUNTER_TIMER_TASK


						.TITLE	NMLCTT
						.IDENT	/X00.04/


000000						.PSECT	$OWN$,  D  
000000					COUNTER.TIMER.QUEUE:
						.BLKW	6
000014					OLD.ENTITY.ID:
						.BLKW	1
000016					OLD.COUNTER.TIMER.BLOCK:
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page   8
X00.04		NML$COUNTER_TIMER_TASK as NL_CTT		 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (4)

						.BLKW	1
000020					COUNTER.TIMER.QUEUE.WAS.CHANGED:
						.BLKW	1


						.GLOBL	UT.CLEAR, UT.INSERT, UT.FETCH
						.GLOBL	UT.DELETE, UT.CHANGE, UT.MAX, UQ.RESET
						.GLOBL	UQ.INSERT, UQ.REMOVE, UQ.EXTRACT
						.GLOBL	UQ.LENGTH, UQ.SCAN, UQ.SEXTRACT
						.GLOBL	US.CREATE, US.ABORT, US.FINI, US.COMPLETE
						.GLOBL	US.ERROR, US.INSERT, US.REMOVE
						.GLOBL	US.QRESET, US.QQINS, US.QQREM
						.GLOBL	US.QQSET, US.QQEXT, US.EVENT, US.WAIT
						.GLOBL	US.FLAG, US.SLEEP, US.CURRENT
						.GLOBL	US.DESCHEDULE, UM.RESET, UM.INITIALIZE
						.GLOBL	UM.GET, UM.RELEASE, EV.DEC, DEBUG
						.GLOBL	SS$GTM, SS$TDF, CURTSK, LUN$NM
						.GLOBL	EFN$NM


	000006'				EB=		    COUNTER.TIMER.QUEUE+6


						.SBTTL	NL.CTT NML$COUNTER_TIMER_TASK as NL_CTT
000000						.PSECT	$CODE$,  RO 

000000	004167  000000G			NL.CTT::JSR	R1,$SAVE5			;					0182
000004	162706  000024 				SUB	#24,SP
000010	012746  000000'				MOV	#COUNTER.TIMER.QUEUE,-(SP)	;					0217
000014	004767  000000G				JSR	PC,US.QRESET
000020	005067  000020'				CLR	COUNTER.TIMER.QUEUE.WAS.CHANGED ;					0218
000024	012766  000310  000006 			MOV	#310,6(SP)			; *,COUNTER.BUFFER.			0224
000032	012701  000310 				MOV	#310,R1				;					0227
000036	005201 					INC	R1
000040	006700 					SXT	R0
000042	071027  000002 				DIV	#2,R0
000046	010016 					MOV	R0,(SP)
000050	004767  000000G				JSR	PC,UM.GET
000054	010066  000004 				MOV	R0,4(SP)			; *,COUNTER.BUFFER.			0226
000060	012716  000020 				MOV	#20,(SP)			;					0229
000064	004767  000000G				JSR	PC,UM.GET
000070	010003 					MOV	R0,R3				; *,EVENT
000072	012716  000000'			1$:	MOV	#COUNTER.TIMER.QUEUE,(SP)	;					0243
000076	004767  000000G				JSR	PC,US.REMOVE
000102	010066  000012 				MOV	R0,12(SP)			; *,CURRENT.COUNTER
000106	012716  000000'				MOV	#COUNTER.TIMER.QUEUE,(SP)	;					0244
000112	010046 					MOV	R0,-(SP)			; CURRENT.COUNTER,*
000114	004767  000000G				JSR	PC,UQ.INSERT
000120	005067  000020'				CLR	COUNTER.TIMER.QUEUE.WAS.CHANGED ;					0247
000124	005016 					CLR	(SP)				;					0252
000126	012746  000024 				MOV	#24,-(SP)
000132	060616 					ADD	SP,(SP)				; CURRENT.TIME,*
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page   9
X00.04		NML$COUNTER_TIMER_TASK as NL_CTT		 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (4)

000134	004767  000000G				JSR	PC,SS$GTM
000140	012716  000000'				MOV	#COUNTER.TIMER.QUEUE,(SP)	;					0253
000144	012746  000020 				MOV	#20,-(SP)
000150	060616 					ADD	SP,(SP)				; CURRENT.COUNTER,*
000152	012746  000000V				MOV	#NML$CTR.CHECK.TIME,-(SP)
000156	004767  000000G				JSR	PC,UQ.SCAN
000162	016602  000022 				MOV	22(SP),R2			; CURRENT.COUNTER,*			0263
000166	010205 					MOV	R2,R5
000170	062705  000006 				ADD	#6,R5
000174	010516 					MOV	R5,(SP)
000176	012746  000032 				MOV	#32,-(SP)
000202	060616 					ADD	SP,(SP)				; CURRENT.TIME,*
000204	012746  000024 				MOV	#24,-(SP)
000210	060616 					ADD	SP,(SP)				; $NMU$SECS,*
000212	004767  000000G				JSR	PC,SS$TDF
000216	016666  000024  000016 			MOV	24(SP),16(SP)			; $NMU$SECS,TEMP			0262
000224	003421 					BLE	2$				;					0276
000226	012716  000006'				MOV	#EB,(SP)			;					0281
000232	016746  000000G				MOV	CURTSK,-(SP)
000236	004767  000000G				JSR	PC,UT.INSERT
000242	016616  000020 				MOV	20(SP),(SP)			; TEMP,*				0282
000246	004767  000000G				JSR	PC,US.SLEEP
000252	012716  000006'				MOV	#EB,(SP)			;					0283
000256	012746  000001 				MOV	#1,-(SP)
000262	004767  000000G				JSR	PC,UT.DELETE
000266	022626 					CMP	(SP)+,(SP)+			;					0277
000270	032767  000001  000020'		2$:	BIT	#1,COUNTER.TIMER.QUEUE.WAS.CHANGED ; 					0291
000276	001113 					BNE	8$
000300	016201  000016 				MOV	16(R2),R1			; *,ENTITY				0296
000304	012704  000006 				MOV	#6,R4				;					0307
000310	060304 					ADD	R3,R4				; EVENT,*
000312	005701 				3$:	TST	R1				; ENTITY				0297
000314	001472 					BEQ	6$
000316	011763  000010 				MOV	(PC),10(R3)			; *,*(EVENT)				0303
000322	116100  000002 				MOVB	2(R1),R0			; *(ENTITY),*				0304
000326	010063  000014 				MOV	R0,14(R3)			; *,*(EVENT)
000332	016113  000004 				MOV	4(R1),(R3)			; *(ENTITY),EVENT			0305
000336	016663  000020  000004 			MOV	20(SP),4(R3)			; COUNTER.BUFFER.,*(EVENT)		0306
000344	016614  000022 				MOV	22(SP),(R4)			; COUNTER.BUFFER.,*			0307
000350	005063  000016 				CLR	16(R3)				; *(EVENT)				0308
000354	005046 					CLR	-(SP)				;					0314
000356	005046 					CLR	-(SP)
000360	011346 					MOV	(R3),-(SP)
000362	110000 					MOVB	R0,R0
000364	005200 					INC	R0
000366	072027  000010 				ASH	#10,R0
000372	010046 					MOV	R0,-(SP)
000374	052716  000012 				BIS	#12,(SP)
000400	011446 					MOV	(R4),-(SP)
000402	005716 					TST	(SP)
000404	001002 					BNE	4$
000406	005046 					CLR	-(SP)
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page  10
X00.04		NML$COUNTER_TIMER_TASK as NL_CTT		 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (4)

000410	000402 					BR	5$
000412	016646  000032 			4$:	MOV	32(SP),-(SP)			; COUNTER.BUFFER.,*
000416	005046 				5$:	CLR	-(SP)
000420	012746  000050 				MOV	#50,-(SP)
000424	060616 					ADD	SP,(SP)				; IOSB,*
000426	012746  000000G				MOV	#EFN$NM,-(SP)
000432	012746  000000G				MOV	#LUN$NM,-(SP)
000436	012746  016400 				MOV	#16400,-(SP)
000442	012746  006003 				MOV	#6003,-(SP)
000446	104377 					EMT	377
000450	062706  000014 				ADD	#14,SP
000454	016614  000016 				MOV	16(SP),(R4)			; IOSB+2,*
000460	116600  000014 				MOVB	14(SP),R0			; IOSB,*
000464	010316 					MOV	R3,(SP)				; EVENT,*				0316
000466	004767  000000G				JSR	PC,EV.DEC
000472	011101 					MOV	(R1),R1				; ENTITY,ENTITY				0317
000474	162706  000014 				SUB	#14,SP				;					0298
000500	000704 					BR	3$				;					0297
000502	016200  000014 			6$:	MOV	14(R2),R0			; *,$NMU$SECS				0320
000506	020027  124300 				CMP	R0,#124300			; $NMU$SECS,*
000512	103403 					BLO	7$
000514	005215 					INC	(R5)
000516	062700  053500 				ADD	#53500,R0			; *,$NMU$SECS
000522	060065  000002 			7$:	ADD	R0,2(R5)			; $NMU$SECS,*
000526	062706  000014 			8$:	ADD	#14,SP				;					0236
000532	000167  177334 				JMP	1$				;					0235
; Routine Size:  175 words,	Routine Base:  $CODE$ + 0000
; Maximum stack depth per invocation:  37 words
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page  11
X00.04		NML$COUNTER_TIMER_SET as NL_SCT			 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (5)

;	  0326	%global_routine ('NML$COUNTER_TIMER_SET', PARM_NO, TYPE, EID_ADR, PARM_VAL_PTR) =
;	  0327	
;	  0328	!++
;	  0329	! Functional description:
;	  0330	!
;	  0331	!	This routine is called by the Volatile Data Base manager each time a
;	  0332	!	parameter is set.  If the parameter is a counter timer, then it will
;	  0333	!	either create a new counter timer block or just	string the entity onto
;	  0334	!	an already existing counter timer block of the same period. It will
;	  0335	!	also notify the counter timer task if a new counter timer block has
;	  0336	!	been created.
;	  0337	!
;	  0338	! Formal parameters:
;	  0339	!
;	  0340	!	PARM_NO			The Network Management parameter number
;	  0341	!	TYPE			The entity type
;	  0342	!	EID_ADR			Address of entity id string
;	  0343	!	PARM_VAL_PTR		Character pointer to byte swapped parameter value
;	  0344	!
;	  0345	! Routine value:
;	  0346	!
;	  0347	!	$true			The value of the counter is between 1 and 65536
;	  0348	!	$false			Counter timer value is out of range
;	  0349	!
;	  0350	!--
;	  0351	
;	  0352	begin
;	  0353	    local
;	  0354		ENTITY_ID : ref ENTITY_BLOCK,
;	  0355		PERIOD;
;	  0356	
;	  0357	!
;	  0358	! First check to see if a counter timer is being set. If not, just return.
;	  0359	!
;	  0360	
;	  0361	    if not NML$CTR_COUNTER_TIMER_PREDICATE (.PARM_NO, .TYPE) then return $true;
;	  0362	
;	  0363	!
;	  0364	! Ok, we got a counter timer, now lets see if it has been set already.
;	  0365	! First set up an entity id block
;	  0366	!
;	  0367	
;	  0368	    PERIOD = GETW (PARM_VAL_PTR);
;	  0369	
;	  0370	    if .PERIOD eqlu 0 or (%bpval gtr 16 and .PERIOD gtr 65535) then return $false;
;	  0371	
;	  0372	    ENTITY_ID = NMU$MEMORY_GET (ENTITY_ALLOCATION);
;	  0373	
;	  0374	    ENTITY_ID [ENTITY_TYPE] = .TYPE;
;	  0375	    ENTITY_ID [ENTITY_ID_PTR] = ch$ptr(.EID_ADR,,8);
;	  0376	    ENTITY_ID [ENTITY_NEXT] = 0;
;	  0377	
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page  12
X00.04		NML$COUNTER_TIMER_SET as NL_SCT			 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (5)

;	  0378	!
;	  0379	! Now scan through the data base looking for another block similar to the one
;	  0380	! we now have.
;	  0381	!
;	  0382	
;	  0383	    OLD_ENTITY_ID = OLD_COUNTER_TIMER_BLOCK = 0;
;	  0384	    NMU$QUEUE_SCAN (COUNTER_TIMER_QUEUE,
;	  0385			    .ENTITY_ID,
;	  0386			    NML$CTR_ENTITY_LIST_SCANNER);
;	  0387	
;	  0388	!
;	  0389	! If a counter timer has already been set for this entity, clear it, otherwise
;	  0390	! just proceed.
;	  0391	!
;	  0392	
;	  0393	    if .OLD_ENTITY_ID neq 0
;	  0394	     then NML$CTR_REMOVE_ENTITY (.OLD_COUNTER_TIMER_BLOCK, .OLD_ENTITY_ID);
;	  0395	
;	  0396	!
;	  0397	! Now see if there is an existing counter block with the same period as that of
;	  0398	! the counter we want to set.
;	  0399	!
;	  0400	
;	  0401	    OLD_COUNTER_TIMER_BLOCK = 0;
;	  0402	    NMU$QUEUE_SCAN (COUNTER_TIMER_QUEUE,
;	  0403			    .PERIOD,
;	  0404			    NML$CTR_COUNTER_QUEUE_SCANNER);
;	  0405	
;	  0406	!
;	  0407	! If there is no counter block with that period, create one, insert it into
;	  0408	! the queue of counter blocks (and wake up the counter timer task), and set
;	  0409	! its time and period.
;	  0410	!
;	  0411	
;	  0412	    if .OLD_COUNTER_TIMER_BLOCK eql 0 then
;	  0413	    begin
;	  0414		OLD_COUNTER_TIMER_BLOCK = NMU$MEMORY_GET (CTR_ALLOCATION);
;	  0415		NMU$SQUEUE_INSERT (COUNTER_TIMER_QUEUE, .OLD_COUNTER_TIMER_BLOCK);
;	  0416		COUNTER_TIMER_QUEUE_WAS_CHANGED = $true;
;	  0417		OLD_COUNTER_TIMER_BLOCK [CTR_PERIOD] = .PERIOD;
;	  0418		TIME_CURRENT (0, OLD_COUNTER_TIMER_BLOCK [CTR_TIME]);
;	  0419		OLD_COUNTER_TIMER_BLOCK [CTR_ENTITY_LIST] = .ENTITY_ID;
;	  0420		return $true
;	  0421	    end;
;	  0422	
;	  0423	    OLD_ENTITY_ID = .OLD_COUNTER_TIMER_BLOCK [CTR_ENTITY_LIST];
;	  0424	    while .OLD_ENTITY_ID [ENTITY_NEXT] neq 0 do
;	  0425	     OLD_ENTITY_ID = .OLD_ENTITY_ID [ENTITY_NEXT];
;	  0426	
;	  0427	    OLD_ENTITY_ID [ENTITY_NEXT] = .ENTITY_ID;
;	  0428	    $true
;	  0429	end; ! End of NML$COUNTER_TIMER_SET
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page  13
X00.04		NML$COUNTER_TIMER_SET as NL_SCT			 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (5)



						.SBTTL	NL.SCT NML$COUNTER_TIMER_SET as NL_SCT
000000	004167  000000G			NL.SCT::JSR	R1,$SAVE2			;					0326
000004	005746 					TST	-(SP)
000006	016646  000020 				MOV	20(SP),-(SP)			; PARM.NO,*				0361
000012	016646  000020 				MOV	20(SP),-(SP)			; TYPE,*
000016	004767  000000V				JSR	PC,NML$CTR.COUNTER.TIMER.PREDICATE ; 
000022	022626 					CMP	(SP)+,(SP)+
000024	006000 					ROR	R0
000026	103153 					BHIS	6$
000030	005266  000012 				INC	12(SP)				; PARM.VAL.PTR				0368
000034	016600  000012 				MOV	12(SP),R0			; PARM.VAL.PTR,*
000040	116016  177777 				MOVB	-1(R0),(SP)			; *,$$GETB.X
000044	005266  000012 				INC	12(SP)				; PARM.VAL.PTR
000050	016600  000012 				MOV	12(SP),R0			; PARM.VAL.PTR,*
000054	116066  177777  000001 			MOVB	-1(R0),1(SP)			; *,$$GETB.X
000062	011601 					MOV	(SP),R1				; $$GETB.X,PERIOD
000064	001002 					BNE	1$				;					0370
000066	005000 					CLR	R0
000070	000534 					BR	7$
000072	012746  000006 			1$:	MOV	#6,-(SP)			;					0372
000076	004767  000000G				JSR	PC,UM.GET
000102	010002 					MOV	R0,R2				; *,ENTITY.ID
000104	116662  000020  000002 			MOVB	20(SP),2(R2)			; TYPE,*(ENTITY.ID)			0374
000112	016662  000016  000004 			MOV	16(SP),4(R2)			; EID.ADR,*(ENTITY.ID)			0375
000120	005012 					CLR	(R2)				; ENTITY.ID				0376
000122	005067  000016'				CLR	OLD.COUNTER.TIMER.BLOCK		;					0383
000126	005067  000014'				CLR	OLD.ENTITY.ID
000132	012716  000000'				MOV	#COUNTER.TIMER.QUEUE,(SP)	;					0384
000136	010246 					MOV	R2,-(SP)			; ENTITY.ID,*
000140	012746  000000V				MOV	#NML$CTR.ENTITY.LIST.SCANNER,-(SP) ; 
000144	004767  000000G				JSR	PC,UQ.SCAN
000150	016700  000014'				MOV	OLD.ENTITY.ID,R0		;					0393
000154	001406 					BEQ	2$
000156	016716  000016'				MOV	OLD.COUNTER.TIMER.BLOCK,(SP)	;					0394
000162	010046 					MOV	R0,-(SP)
000164	004767  000000V				JSR	PC,NML$CTR.REMOVE.ENTITY
000170	005726 					TST	(SP)+
000172	005067  000016'			2$:	CLR	OLD.COUNTER.TIMER.BLOCK		;					0401
000176	012716  000000'				MOV	#COUNTER.TIMER.QUEUE,(SP)	;					0402
000202	010146 					MOV	R1,-(SP)			; PERIOD,*
000204	012746  000000V				MOV	#NML$CTR.COUNTER.QUEUE.SCANNER,-(SP) ; 
000210	004767  000000G				JSR	PC,UQ.SCAN
000214	005767  000016'				TST	OLD.COUNTER.TIMER.BLOCK		;					0412
000220	001037 					BNE	3$
000222	012716  000020 				MOV	#20,(SP)			;					0414
000226	004767  000000G				JSR	PC,UM.GET
000232	010067  000016'				MOV	R0,OLD.COUNTER.TIMER.BLOCK
000236	012716  000000'				MOV	#COUNTER.TIMER.QUEUE,(SP)	;					0415
000242	010046 					MOV	R0,-(SP)			; OLD.COUNTER.TIM,*
000244	004767  000000G				JSR	PC,US.INSERT
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page  14
X00.04		NML$COUNTER_TIMER_SET as NL_SCT			 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (5)

000250	012767  000001  000020'			MOV	#1,COUNTER.TIMER.QUEUE.WAS.CHANGED ; 					0416
000256	016700  000016'				MOV	OLD.COUNTER.TIMER.BLOCK,R0	;					0417
000262	010160  000014 				MOV	R1,14(R0)			; PERIOD,*
000266	005016 					CLR	(SP)				;					0418
000270	010046 					MOV	R0,-(SP)			; OLD.COUNTER.TIM,*
000272	062716  000006 				ADD	#6,(SP)
000276	004767  000000G				JSR	PC,SS$GTM
000302	016700  000016'				MOV	OLD.COUNTER.TIMER.BLOCK,R0	;					0419
000306	010260  000016 				MOV	R2,16(R0)			; ENTITY.ID,*
000312	062706  000016 				ADD	#16,SP				;					0412
000316	000417 					BR	6$				;					0413
000320	016700  000016'			3$:	MOV	OLD.COUNTER.TIMER.BLOCK,R0	;					0423
000324	016067  000016  000014'			MOV	16(R0),OLD.ENTITY.ID
000332	017700  000014'			4$:	MOV	@OLD.ENTITY.ID,R0		;					0424
000336	001403 					BEQ	5$
000340	010067  000014'				MOV	R0,OLD.ENTITY.ID		;					0425
000344	000772 					BR	4$				;					0424
000346	010277  000014'			5$:	MOV	R2,@OLD.ENTITY.ID		; ENTITY.ID,*				0427
000352	062706  000012 				ADD	#12,SP				;					0352
000356	012700  000001 			6$:	MOV	#1,R0				;					0326
000362	005726 				7$:	TST	(SP)+
000364	000207 					RTS	PC
; Routine Size:  123 words,	Routine Base:  $CODE$ + 0536
; Maximum stack depth per invocation:  12 words
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page  15
X00.04		NML$COUNTER_TIMER_CLEAR as NL_CCT		 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (6)

;	  0430	%global_routine ('NML$COUNTER_TIMER_CLEAR', PARM_NO, TYPE, EID_ADR) : novalue =
;	  0431	
;	  0432	!++
;	  0433	! Functional description:
;	  0434	!
;	  0435	!	This routine is called by the Volatile Data Base manager each time a
;	  0436	!	parameter is cleared.  If the parameter is a counter timer, then it
;	  0437	!	will remove that counter timer from the data base.
;	  0438	!
;	  0439	! Formal parameters:
;	  0440	!
;	  0441	!	PARM_NO			The Network Management parameter number
;	  0442	!	TYPE			The entity type
;	  0443	!	EID_ADR			Address of entity id string
;	  0444	!
;	  0445	!--
;	  0446	
;	  0447	begin
;	  0448	    local
;	  0449		ENTITY_ID : ref ENTITY_BLOCK;
;	  0450	
;	  0451	!
;	  0452	! First check to see if a counter timer is being set. If not, just return.
;	  0453	!
;	  0454	
;	  0455	    if not NML$CTR_COUNTER_TIMER_PREDICATE (.PARM_NO, .TYPE) then return ;
;	  0456	
;	  0457	!
;	  0458	! Ok, we got a counter timer, now lets see if it has been set already.
;	  0459	! First set up an entity id block
;	  0460	!
;	  0461	
;	  0462	    ENTITY_ID = NMU$MEMORY_GET (ENTITY_ALLOCATION);
;	  0463	
;	  0464	    ENTITY_ID [ENTITY_TYPE] = .TYPE;
;	  0465	    ENTITY_ID [ENTITY_ID_PTR] = ch$ptr(.EID_ADR,,8);
;	  0466	    ENTITY_ID [ENTITY_NEXT] = 0;
;	  0467	
;	  0468	!
;	  0469	! Now scan through the data base looking for another block similar to the one
;	  0470	! we now have.
;	  0471	!
;	  0472	
;	  0473	    OLD_ENTITY_ID = OLD_COUNTER_TIMER_BLOCK = 0;
;	  0474	    NMU$QUEUE_SCAN (COUNTER_TIMER_QUEUE,
;	  0475			    .ENTITY_ID,
;	  0476			    NML$CTR_ENTITY_LIST_SCANNER);
;	  0477	
;	  0478	!
;	  0479	! If a counter timer has already been set for this entity, clear it, otherwise
;	  0480	! just return.
;	  0481	!
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page  16
X00.04		NML$COUNTER_TIMER_CLEAR as NL_CCT		 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (6)

;	  0482	
;	  0483	    if .OLD_ENTITY_ID neq 0 then
;	  0484	    begin
;	  0485		NML$CTR_REMOVE_ENTITY (.OLD_COUNTER_TIMER_BLOCK, .OLD_ENTITY_ID);
;	  0486		return
;	  0487	    end;
;	  0488	
;	  0489	    NMU$MEMORY_RELEASE (.ENTITY_ID, ENTITY_ALLOCATION);
;	  0490	
;	  0491	end; ! End of NML$COUNTER_TIMER_CLEAR


						.SBTTL	NL.CCT NML$COUNTER_TIMER_CLEAR as NL_CCT
000000	010146 				NL.CCT::MOV	R1,-(SP)			;					0430
000002	016646  000010 				MOV	10(SP),-(SP)			; PARM.NO,*				0455
000006	016646  000010 				MOV	10(SP),-(SP)			; TYPE,*
000012	004767  000000V				JSR	PC,NML$CTR.COUNTER.TIMER.PREDICATE ; 
000016	022626 					CMP	(SP)+,(SP)+
000020	006000 					ROR	R0
000022	103047 					BHIS	3$
000024	012746  000006 				MOV	#6,-(SP)			;					0462
000030	004767  000000G				JSR	PC,UM.GET
000034	010001 					MOV	R0,R1				; *,ENTITY.ID
000036	116661  000010  000002 			MOVB	10(SP),2(R1)			; TYPE,*(ENTITY.ID)			0464
000044	016661  000006  000004 			MOV	6(SP),4(R1)			; EID.ADR,*(ENTITY.ID)			0465
000052	005011 					CLR	(R1)				; ENTITY.ID				0466
000054	005067  000016'				CLR	OLD.COUNTER.TIMER.BLOCK		;					0473
000060	005067  000014'				CLR	OLD.ENTITY.ID
000064	012716  000000'				MOV	#COUNTER.TIMER.QUEUE,(SP)	;					0474
000070	010146 					MOV	R1,-(SP)			; ENTITY.ID,*
000072	012746  000000V				MOV	#NML$CTR.ENTITY.LIST.SCANNER,-(SP) ; 
000076	004767  000000G				JSR	PC,UQ.SCAN
000102	016700  000014'				MOV	OLD.ENTITY.ID,R0		;					0483
000106	001406 					BEQ	1$
000110	016716  000016'				MOV	OLD.COUNTER.TIMER.BLOCK,(SP)	;					0485
000114	010046 					MOV	R0,-(SP)
000116	004767  000000V				JSR	PC,NML$CTR.REMOVE.ENTITY
000122	000405 					BR	2$				;					0483
000124	010116 				1$:	MOV	R1,(SP)				; ENTITY.ID,*				0489
000126	012746  000006 				MOV	#6,-(SP)
000132	004767  000000G				JSR	PC,UM.RELEASE
000136	062706  000010 			2$:	ADD	#10,SP				;					0447
000142	012601 				3$:	MOV	(SP)+,R1			;					0430
000144	000207 					RTS	PC
; Routine Size:  51 words,	Routine Base:  $CODE$ + 1124
; Maximum stack depth per invocation:  6 words
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page  17
X00.04		NML$CTR_CHECK_TIME				 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (7)

;	  0492	%routine ('NML$CTR_CHECK_TIME', COUNTER_BLOCK : ref CTR_BLOCK, CURRENT_COUNTER) =
;	  0493	
;	  0494	!++
;	  0495	! Functional description:
;	  0496	!
;	  0497	!	This routine is called from NML$QUEUE_SCAN with the address of a
;	  0498	!	CTR_BLOCK and a time block. It will update CURRENT_COUNTER to reflect
;	  0499	!	the counter block found thus far that has the smallest time.
;	  0500	!
;	  0501	! Inputs:
;	  0502	!
;	  0503	!	COUNTER_BLOCK		The address of a counter block
;	  0504	!	CURRENT_COUNTER		The address of the address of a counter block
;	  0505	!				used as an initial comparison for this routine.
;	  0506	!
;	  0507	! Outputs:
;	  0508	!
;	  0509	!	.CURRENT_COUNTER	The address of the latest (thus far) CTR_BLOCK
;	  0510	!
;	  0511	!--
;	  0512	
;	  0513	begin
;	  0514	    bind
;	  0515		TEMP = .CURRENT_COUNTER : ref CTR_BLOCK;
;	  0516	
;	  0517	    if TIME_TEST (COUNTER_BLOCK [CTR_TIME], lss, TEMP [CTR_TIME])
;	  0518	    then TEMP = .COUNTER_BLOCK;
;	  0519	    0  ! Ensure that NMU$QUEUE_SCAN does not terminate prematurely
;	  0520	end; ! End of NML$CTR_CHECK_TIME


						.SBTTL	NML$CTR.CHECK.TIME NML$CTR_CHECK_TIME
000000	010146 				NML$CTR.CHECK.TIME:
						MOV	R1,-(SP)			;					0492
000002	005746 					TST	-(SP)
000004	016601  000010 				MOV	10(SP),R1			; COUNTER.BLOCK,*			0517
000010	062701  000006 				ADD	#6,R1
000014	017600  000006 				MOV	@6(SP),R0			; CURRENT.COUNTER,*
000020	062700  000006 				ADD	#6,R0
000024	010146 					MOV	R1,-(SP)
000026	010046 					MOV	R0,-(SP)
000030	012746  000006 				MOV	#6,-(SP)
000034	060616 					ADD	SP,(SP)				; ABTIME,*
000036	004767  000000G				JSR	PC,SS$TDF
000042	062706  000006 				ADD	#6,SP
000046	005700 					TST	R0
000050	002003 					BGE	1$
000052	016676  000010  000006 			MOV	10(SP),@6(SP)			; COUNTER.BLOCK,CURRENT.COUNTER		0518
000060	005000 				1$:	CLR	R0				;					0492
000062	005726 					TST	(SP)+
000064	012601 					MOV	(SP)+,R1
000066	000207 					RTS	PC
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page  18
X00.04		NML$CTR_CHECK_TIME				 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (7)

; Routine Size:  28 words,	Routine Base:  $CODE$ + 1272
; Maximum stack depth per invocation:  6 words
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page  19
X00.04		NML$CTR_ENTITY_LIST_SCANNER			 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (8)

;	  0521	%routine ('NML$CTR_ENTITY_LIST_SCANNER', COUNTER_BLOCK : ref CTR_BLOCK, ENTITY_ID : ref ENTITY_BLOCK) =
;	  0522	
;	  0523	!++
;	  0524	! Functional description:
;	  0525	!
;	  0526	!	This routine will facilitate the search for an entity in the counter
;	  0527	!	timer data base. It is called for each counter timer block, and will
;	  0528	!	scan through that blocks entity list looking for the desired entity.
;	  0529	!	When it finds a match, it will set up OLD_ENTITY_ID and
;	  0530	!	OLD_COUNTER_TIMER_BLOCK.
;	  0531	!
;	  0532	! Formal parameters:
;	  0533	!
;	  0534	!	COUNTER_BLOCK		The address of the current counter block
;	  0535	!	ENTITY_ID		The address of the entity being sought after.
;	  0536	!
;	  0537	! Implicit outputs:
;	  0538	!
;	  0539	!	OLD_ENTITY_ID		The address of the found entity or 0
;	  0540	!	OLD_COUNTER_TIMER_BLOCK	 "     "    "   "    "   counter " "
;	  0541	!
;	  0542	! Routine value:
;	  0543	!
;	  0544	!	none
;	  0545	!--
;	  0546	
;	  0547	begin
;	  0548	    local
;	  0549		TEMP : ref ENTITY_BLOCK;
;	  0550	
;	  0551	    TEMP = .COUNTER_BLOCK [CTR_ENTITY_LIST];
;	  0552	    while .TEMP neq 0 do
;	  0553	    begin
;	  0554		if .TEMP [ENTITY_ID_PTR] eql .ENTITY_ID [ENTITY_ID_PTR] then
;	  0555		begin
;	  0556		    OLD_ENTITY_ID = .TEMP;
;	  0557		    OLD_COUNTER_TIMER_BLOCK = .COUNTER_BLOCK;
;	  0558		    return 1		! Tell NMU$QUEUE_SCAN to stop scanning
;	  0559		end;
;	  0560		TEMP = .TEMP [ENTITY_NEXT];
;	  0561	    end;
;	  0562	    0				! Tell NMU$QUEUE_SCAN to keep on scanning
;	  0563	end; ! End of NML$CTR_ENTITY_LIST_SCANNER


						.SBTTL	NML$CTR.ENTITY.LIST.SCANNER NML$CTR_ENTITY_LIST_SCANNER
000000	010146 				NML$CTR.ENTITY.LIST.SCANNER:
						MOV	R1,-(SP)			;					0521
000002	016600  000006 				MOV	6(SP),R0			; COUNTER.BLOCK,*			0551
000006	016000  000016 				MOV	16(R0),R0			; *,TEMP
000012	016601  000004 				MOV	4(SP),R1			; ENTITY.ID,*				0554
000016	005700 					TST	R0				; TEMP					0552
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page  20
X00.04		NML$CTR_ENTITY_LIST_SCANNER			 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (8)

000020	001416 				1$:	BEQ	3$
000022	026061  000004  000004 			CMP	4(R0),4(R1)			; *(TEMP),*				0554
000030	001010 					BNE	2$
000032	010067  000014'				MOV	R0,OLD.ENTITY.ID		; TEMP,*				0556
000036	016667  000006  000016'			MOV	6(SP),OLD.COUNTER.TIMER.BLOCK	; COUNTER.BLOCK,*			0557
000044	012700  000001 				MOV	#1,R0				;					0555
000050	000403 					BR	4$
000052	011000 				2$:	MOV	(R0),R0				; TEMP,TEMP				0560
000054	000761 					BR	1$				;					0552
000056	005000 				3$:	CLR	R0				;					0521
000060	012601 				4$:	MOV	(SP)+,R1
000062	000207 					RTS	PC
; Routine Size:  26 words,	Routine Base:  $CODE$ + 1362
; Maximum stack depth per invocation:  2 words
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page  21
X00.04		NML$CTR_COUNTER_QUEUE_SCANNER			 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (9)

;	  0564	%routine ('NML$CTR_COUNTER_QUEUE_SCANNER', COUNTER_BLOCK : ref CTR_BLOCK, PERIOD) =
;	  0565	
;	  0566	!++
;	  0567	! Functional description:
;	  0568	!
;	  0569	!	This routine will facilitate the search for a counter block with a
;	  0570	!	certain period. If such a block is not found a zero will be returned.
;	  0571	!
;	  0572	! Formal parameters:
;	  0573	!
;	  0574	!	COUNTER_BLOCK		The address of the current counter block
;	  0575	!	PERIOD			The period be being searched for.
;	  0576	!
;	  0577	! Implicit outputs:
;	  0578	!
;	  0579	!	OLD_COUNTER_TIMER_BLOCK	The address of a counter block that has the
;	  0580	!				proper period.
;	  0581	!
;	  0582	! Routine value:
;	  0583	!
;	  0584	!	none
;	  0585	!--
;	  0586	
;	  0587	begin
;	  0588	    if .COUNTER_BLOCK [CTR_PERIOD] neq .PERIOD then return 0
;	  0589	     else OLD_COUNTER_TIMER_BLOCK = .COUNTER_BLOCK
;	  0590	
;	  0591	end; ! End of NML$CTR_COUNTER_QUEUE_SCANNER


						.SBTTL	NML$CTR.COUNTER.QUEUE.SCANNER NML$CTR_COUNTER_QUEUE_SCANNER
000000	016600  000004 			NML$CTR.COUNTER.QUEUE.SCANNER:
						MOV	4(SP),R0			; COUNTER.BLOCK,*			0588
000004	026066  000014  000002 			CMP	14(R0),2(SP)			; *,PERIOD
000012	001402 					BEQ	1$
000014	005000 					CLR	R0
000016	000207 					RTS	PC
000020	016600  000004 			1$:	MOV	4(SP),R0			; COUNTER.BLOCK,*			0589
000024	010067  000016'				MOV	R0,OLD.COUNTER.TIMER.BLOCK
000030	000207 					RTS	PC				;					0564
; Routine Size:  13 words,	Routine Base:  $CODE$ + 1446
; Maximum stack depth per invocation:  0 words
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page  22
X00.04		NML$CTR_COUNTER_TIMER_PREDICATE			 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (10)

;	  0592	%routine ('NML$CTR_COUNTER_TIMER_PREDICATE', PARM_NO, TYPE) =
;	  0593	
;	  0594	!++
;	  0595	! Functional description:
;	  0596	!
;	  0597	!	This routine will determine whether or not the entity type and
;	  0598	!	parameter number constitute a counter timer parameter for that entity
;	  0599	!	type. This routine is needed because the fucking NML specification is
;	  0600	!	so inane.
;	  0601	!
;	  0602	! Formal parameters:
;	  0603	!
;	  0604	!	PARM_NO			Parameter number
;	  0605	!	TYPE			Network management type number
;	  0606	!
;	  0607	! Routine value:
;	  0608	!
;	  0609	!	$false			The parameter is not a counter timer
;	  0610	!	$true			The parameter is a counter timer
;	  0611	!--
;	  0612	
;	  0613	begin
;	  0614	    if	(  .TYPE eql NODE_E   and .PARM_NO eql 160
;	  0615		or .TYPE eql LINE_    and .PARM_NO eql 110
;	  0616		or .TYPE eql CIRCUIT_ and .PARM_NO eql 110
;	  0617		or .TYPE eql MODULE_  and .PARM_NO eql 100)
;	  0618	
;	  0619		then $true else $false
;	  0620	
;	  0621	end; ! End of NML$CTR_COUNTER_TIMER_PREDICATE


						.SBTTL	NML$CTR.COUNTER.TIMER.PREDICATE NML$CTR_COUNTER_TIMER_PREDICATE
000000	016600  000002 			NML$CTR.COUNTER.TIMER.PREDICATE:
						MOV	2(SP),R0			; TYPE,*				0614
000004	001004 					BNE	1$
000006	026627  000004  000240 			CMP	4(SP),#240			; PARM.NO,*
000014	001425 					BEQ	4$
000016	020027  000001 			1$:	CMP	R0,#1				;					0615
000022	001004 					BNE	2$
000024	026627  000004  000156 			CMP	4(SP),#156			; PARM.NO,*
000032	001416 					BEQ	4$
000034	020027  000003 			2$:	CMP	R0,#3				;					0616
000040	001004 					BNE	3$
000042	026627  000004  000156 			CMP	4(SP),#156			; PARM.NO,*
000050	001407 					BEQ	4$
000052	020027  000004 			3$:	CMP	R0,#4				;					0617
000056	001007 					BNE	5$
000060	026627  000004  000144 			CMP	4(SP),#144			; PARM.NO,*
000066	001003 					BNE	5$
000070	012700  000001 			4$:	MOV	#1,R0				;					0613
000074	000207 					RTS	PC
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page  23
X00.04		NML$CTR_COUNTER_TIMER_PREDICATE			 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (10)

000076	005000 				5$:	CLR	R0
000100	000207 					RTS	PC				;					0592
; Routine Size:  33 words,	Routine Base:  $CODE$ + 1500
; Maximum stack depth per invocation:  0 words
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page  24
X00.04		NML$CTR_REMOVE_ENTITY				 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (11)

;	  0622	%routine ('NML$CTR_REMOVE_ENTITY') : novalue =
;	  0623	
;	  0624	!++
;	  0625	! Functional description:
;	  0626	!
;	  0627	!	This routine will remove an entity from the counter timer data base.
;	  0628	!	It will unlink and deallocate its entity block. It will also unlink
;	  0629	!	and deallocate empty counter timer blocks (and wake up the counter
;	  0630	!	timer task if so).
;	  0631	!
;	  0632	! Implicit inputs:
;	  0633	!
;	  0634	!	OLD_ENTITY_ID		The address of the entity to be killed
;	  0635	!	OLD_COUNTER_TIMER_BLOCK	The address of the counter block that contains
;	  0636	!				the aforementioned entity.
;	  0637	!
;	  0638	! Side effects:
;	  0639	!
;	  0640	!	The counter timer task may be invoked if a counter timer block gets
;	  0641	!	destroyed.  If all the counter timer blocks get destroyed, the
;	  0642	!	counter timer task will sleep forever.
;	  0643	!
;	  0644	! Routine value:
;	  0645	!
;	  0646	!	none
;	  0647	!
;	  0648	!--
;	  0649	begin
;	  0650	    local
;	  0651		TEMP : ref ENTITY_BLOCK;
;	  0652	
;	  0653	!
;	  0654	! First see if the entity is hooked up directly to the counter block (ie: is
;	  0655	! it the first item?). If so, update the pointer in the counter block, else
;	  0656	! update the pointer in the appropriate entity block in the counters entity
;	  0657	! block list.
;	  0658	!
;	  0659	
;	  0660	    if .OLD_COUNTER_TIMER_BLOCK [CTR_ENTITY_LIST] eql .OLD_ENTITY_ID
;	  0661	    then
;	  0662	    OLD_COUNTER_TIMER_BLOCK [CTR_ENTITY_LIST] = .OLD_ENTITY_ID [ENTITY_NEXT]
;	  0663	    else
;	  0664	    begin
;	  0665		TEMP = .OLD_COUNTER_TIMER_BLOCK [CTR_ENTITY_LIST];
;	  0666		while (.TEMP [ENTITY_NEXT] neq .OLD_ENTITY_ID) do
;	  0667		TEMP = .TEMP [ENTITY_NEXT];
;	  0668	
;	  0669		TEMP [ENTITY_NEXT] = .OLD_ENTITY_ID [ENTITY_NEXT];
;	  0670	    end;
;	  0671	
;	  0672	    NMU$MEMORY_RELEASE (.OLD_ENTITY_ID, ENTITY_ALLOCATION);
;	  0673	
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page  25
X00.04		NML$CTR_REMOVE_ENTITY				 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (11)

;	  0674	    if .OLD_COUNTER_TIMER_BLOCK [CTR_ENTITY_LIST] eql 0 then
;	  0675	    begin
;	  0676		NMU$QUEUE_EXTRACT (COUNTER_TIMER_QUEUE [Q_QUEUE],
;	  0677				   OLD_COUNTER_TIMER_BLOCK [CTR_QUEUE]);
;	  0678		COUNTER_TIMER_QUEUE_WAS_CHANGED = $true;
;	  0679		NMU$MEMORY_RELEASE (.OLD_COUNTER_TIMER_BLOCK, CTR_ALLOCATION);
;	  0680		NMU$SCHED_FLAG (COUNTER_TIMER_QUEUE [Q_EVENT]);
;	  0681	    end;
;	  0682	
;	  0683	end; ! NML$CTR_REMOVE_ENTITY


						.SBTTL	NML$CTR.REMOVE.ENTITY NML$CTR_REMOVE_ENTITY
000000	010146 				NML$CTR.REMOVE.ENTITY:
						MOV	R1,-(SP)			;					0622
000002	016700  000016'				MOV	OLD.COUNTER.TIMER.BLOCK,R0	;					0660
000006	016701  000014'				MOV	OLD.ENTITY.ID,R1
000012	026001  000016 				CMP	16(R0),R1
000016	001003 					BNE	1$
000020	011160  000016 				MOV	(R1),16(R0)			;					0662
000024	000407 					BR	4$				;					0660
000026	016000  000016 			1$:	MOV	16(R0),R0			; *,TEMP				0665
000032	021001 				2$:	CMP	(R0),R1				; TEMP,*				0666
000034	001402 					BEQ	3$
000036	011000 					MOV	(R0),R0				; TEMP,TEMP				0667
000040	000774 					BR	2$				;					0666
000042	011110 				3$:	MOV	(R1),(R0)			; *,TEMP				0669
000044	010146 				4$:	MOV	R1,-(SP)			;					0672
000046	012746  000006 				MOV	#6,-(SP)
000052	004767  000000G				JSR	PC,UM.RELEASE
000056	016700  000016'				MOV	OLD.COUNTER.TIMER.BLOCK,R0	;					0674
000062	005760  000016 				TST	16(R0)
000066	001023 					BNE	5$
000070	012716  000000'				MOV	#COUNTER.TIMER.QUEUE,(SP)	;					0676
000074	010046 					MOV	R0,-(SP)			; OLD.COUNTER.TIM,*
000076	004767  000000G				JSR	PC,UQ.EXTRACT
000102	012767  000001  000020'			MOV	#1,COUNTER.TIMER.QUEUE.WAS.CHANGED ; 					0678
000110	016716  000016'				MOV	OLD.COUNTER.TIMER.BLOCK,(SP)	;					0679
000114	012746  000020 				MOV	#20,-(SP)
000120	004767  000000G				JSR	PC,UM.RELEASE
000124	012716  000006'				MOV	#COUNTER.TIMER.QUEUE+6,(SP)	;					0680
000130	004767  000000G				JSR	PC,US.FLAG
000134	022626 					CMP	(SP)+,(SP)+			;					0675
000136	022626 				5$:	CMP	(SP)+,(SP)+			;					0649
000140	012601 					MOV	(SP)+,R1			;					0622
000142	000207 					RTS	PC
; Routine Size:  50 words,	Routine Base:  $CODE$ + 1602
; Maximum stack depth per invocation:  6 words


;	  0684	
;	  0685	end ! End of NMLCTT
NMLCTT								24-May-1985 13:26:49	TOPS-20 Bliss-16 2A(530)	    Page  26
X00.04		NML$CTR_REMOVE_ENTITY				 3-Jan-1983 00:58:34	DNET61:<MCB.NML>NMLCTT.BLI.1 (11)

;	  0686	eludom



;					OTS external references
						.GLOBL	$SAVE5, $SAVE2


;					PSECT SUMMARY
;
;	Psect Name			Words	  Attributes
;	 $OWN$				    9	    RW ,  D  ,  LCL,  REL,  CON
;	 $CODE$				  499	    RO ,  I  ,  LCL,  REL,  CON




;				LIBRARY STATISTICS
;
;					     -------- Symbols --------    Blocks
;	File				     Total    Loaded   Percent      Read
;
;  DNET61:<MCB.NML>NMLLIB.L16.2		      2718       157         5         0





; Size:		499 code + 9 data words
; Run Time:	00:10.0
; Elapsed Time:	00:14.3
; Memory Used:	54 pages
; Compilation Complete
CIRCUIT_			 616
COUNTER_BLOCK			 492	 517	 518	 521	 551	 557	 564	 588	 589
COUNTER_BUFFER_PTR		 210	 226#	 306	 314
COUNTER_BUFFER_SIZE		 211	 224#	 227	 307
COUNTER_TIMER_QUEUE		 178	 217	 243	 244	 253	 279	 384	 402	 415	 474	 676	 680
COUNTER_TIMER_QUEUE_WAS_CHANGED	 181	 218#	 247#	 291	 416#	 678#
CTR_ALLOCATION			 149#	 414	 679
CTR_BLOCK			 152#	 180	 209	 492	 515	 521	 564
CTR_ENTITY_LIST			 144#	 296	 419	 423	 551	 660	 662	 665	 674
CTR_FIELDS			 139#	 152
CTR_PERIOD			 143#	 266	 320	 417	 588
CTR_QUEUE			 141#	 245	 677
CTR_SIZE			 148#	 152
CTR_TIME			 142#	 262	 319	 418	 517
CTT_TRACE			 264	 299
CURRENT_COUNTER			 209	 243#	 245	 254	 262	 266	 296	 319	 320	 492	 515
CURRENT_TASK			 281
CURRENT_TIME			 207	 252	 263
EB				 279#	 281	 283
EB_TASKS			 281	 283
EID_ADR				 326	 375	 430	 465
ENTITY				 294	 296#	 297	 301	 302	 304	 305	 310	 311	 317#
ENTITY_ALLOCATION		 168#	 372	 462	 489	 672
ENTITY_BLOCK			 171#	 179	 294	 354	 449	 521	 549	 651
ENTITY_FIELDS			 159#	 171
ENTITY_ID			 354	 372#	 374#	 375#	 376#	 385	 419	 427	 449	 462#	 464#	 465#
				 466#	 475	 489	 521	 554
ENTITY_ID_PTR			 163#	 301	 302	 305	 311	 375	 465	 554
ENTITY_NEXT			 161#	 317	 376	 424	 425	 427	 466	 560	 662	 666	 667	 669
ENTITY_SIZE			 167#	 171
ENTITY_TYPE			 162#	 304	 310	 374	 464
EQLU				 370
EVENT_BLOCK			 279
EVENT				 212	 229#	 303#	 304#	 305#	 306#	 307#	 308#	 313	 316
GETW				 368
LINE_				 615
MODULE_				 617
NML$CTR_CHECK_TIME		 128	 255
NML$CTR_COUNTER_QUEUE_SCANNER	 132	 404
NML$CTR_COUNTER_TIMER_PREDICATE	 129	 361	 455
NML$CTR_ENTITY_LIST_SCANNER	 130	 386	 476
NML$CTR_REMOVE_ENTITY		 131	 394	 485
NML$DECLARE_EVENT		 114	 316
NMLCTT				  54#
NMU$MEMORY_GET			 227	 229	 372	 414	 462
NMU$MEMORY_MANAGER		 113
NMU$MEMORY_RELEASE		 489	 672	 679
NMU$QUEUE_EXTRACT		 676
NMU$QUEUE_INSERT		 244
NMU$QUEUE_MANAGER		 111
NMU$QUEUE_SCAN			 253	 384	 402	 474
NMU$SCHED_FLAG			 680
NMU$SCHED_MANAGER		 112
NMU$SCHED_SLEEP			 282
NMU$SQUEUE_INSERT		 415
NMU$SQUEUE_REMOVE		 243
NMU$SQUEUE_RESET		 217
NMU$TABLE_DELETE		 283
NMU$TABLE_INSERT		 281
NMU$TABLE_ROUTINES		 110*
NODE_E				 614
OLD_COUNTER_TIMER_BLOCK		 180	 383#	 394	 401#	 412	 414#	 415	 417#	 418	 419#	 423	 473#
				 485	 557#	 589#	 660	 662#	 665	 674	 677	 679
OLD_ENTITY_ID			 179	 383#	 393	 394	 423#	 424	 425#	 427#	 473#	 483	 485	 556#
				 660	 662	 666	 669	 672
PARM_NO				 326	 361	 430	 455	 592	 614	 615	 616	 617
PARM_VAL_PTR			 326	 368
PERIOD				 355	 368#	 370	 403	 417	 564	 588
Q_ENTRY_SIZE			 141
Q_EVENT				 279	 680
Q_QUEUE				 244	 676
RAW_EVENT_BLOCK_ALLOCATION	 229
RAW_EVENT_BLOCK			 212
REB_DATA_LENGTH			 307	 313
REB_DATA_POINTER		 306
REB_ENTITY_POINTER		 305
REB_ENTITY_TYPE			 304
REB_EVENT_CODE			 303
REB_TIME_BLOCK			 308
SQ_HEADER			 178
TEMP				 208	 262#	 267	 276	 282	 515#	 517	 518#	 549	 551#	 552	 554
				 556	 560#	 651	 665#	 666	 667#	 669#
TIME_BLOCK_SIZE			 142
TIME_BLOCK			 207
TIME_CURRENT			 252	 418
TIME_DIFFERENCE_SECONDS		 262
TIME_PLUS			 319
TIME_TEST			 517
TRACE_INFO			 265	 300
TYPE				 326	 361	 374	 430	 455	 464	 592	 614	 615	 616	 617
$ADDRESS			 144	 161
$FALSE				 218	 247	 370	 619
$FIELD				 138	 158
$FIELD_SET_SIZE			 148	 167
$FIELD_SET_UNITS		 149	 168
$INTEGER			 143
$NML$SHOZC			 310
$POINTER			 163
$SUB_BLOCK			 141	 142
$TINY_INTEGER			 162
$TRUE				 235	 361	 416	 420	 428	 619	 678
%DEBUG				 264	 299
%DEBUG_DATA_BASE		 121
%GLOBAL_ROUTINE			 182#	 326#	 430#
%ROUTINE			 492#	 521#	 564#	 592#	 622#