Trailing-Edge
-
PDP-10 Archives
-
BB-P363B-SM_1985
-
mcb/nml/nmuque.lst
There are no other files named nmuque.lst in the archive.
24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 1
3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (1)
; 0001 ! NET:<VOBA.NML.DEVELOPMENT>NMUQUE.BLI.3 25-Mar-82 17:59:35, Edit by VOBA
; 0002 !
; 0003 ! Ident 3.
; 0004 ! Add routine NMU$QUEUE_LENGTH to return the length (number of entries) of
; 0005 ! a queue.
; 0006 !
; 0007 ! NET:<VOBA.NML.DEVELOPMENT>NMUQUE.BLI.5 4-Mar-82 14:19:09, Edit by VOBA
; 0008 !
; 0009 ! Ident 2.
; 0010 ! Clean up code and update copyright date.
; 0011 !
; 0012 !NET:<DECNET20-V3P1.BASELEVEL-2.SOURCES>NMUQUE.BLI.4 12-Aug-81 10:47:34, Edit by JENNESS
; 0013 !
; 0014 ! Update copyright notice.
; 0015 ! Clean up code, update to current coding conventions.
NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 2
3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (2)
; 0016 %title 'NMUQUE -- General Queue Management'
; 0017 module NMUQUE (
; 0018 ident = 'X00.03'
; 0019 ) =
; 0020 begin
; 0021
; 0022 ! COPYRIGHT (c) 1980, 1981, 1982
; 0023 ! DIGITAL EQUIPMENT CORPORATION
; 0024 ! Maynard, Massachusetts
; 0025 !
; 0026 ! This software is furnished under a license and may be used
; 0027 ! and copied only in accordance with the terms of such license
; 0028 ! and with the inclusion of the above copyright notice. This
; 0029 ! software or any other copies thereof may not be provided or
; 0030 ! otherwise made available to any other person. No title to
; 0031 ! and ownership of the software is hereby transferred.
; 0032 !
; 0033 ! The information in this software is subject to change
; 0034 ! without notice and should not be construed as a commitment
; 0035 ! by DIGITAL EQUIPMENT CORPORATION.
; 0036 !
; 0037 ! DIGITAL assumes no responsibility for the use or reliability
; 0038 ! of its software on equipment which is not supplied by
; 0039 ! DIGITAL.
; 0040 !
; 0041
; 0042 !++
; 0043 ! Facility: LSG DECnet Network Management
; 0044 !
; 0045 ! Abstract:
; 0046 !
; 0047 ! This set of routines provides a primitives for
; 0048 ! manipulating queues. The only requirement for
; 0049 ! using this set of routines is that the queue overhead
; 0050 ! information must be defined at the very beginning
; 0051 ! of any entry made to a queue.
; 0052 !
; 0053 ! Environment: TOPS10 and TOPS20 user mode, MCB RSX task level
; 0054 !
; 0055 ! Author: Steven M. Jenness, Creation date: 19 August 1980
; 0056 !
; 0057 !--
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 3
X00.03 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (3)
; 0058
; 0059 !
; 0060 ! INCLUDE FILES
; 0061 !
; 0062
; 0063 library 'NMULIB'; ! All needed definitions
; 0064
; 0065 !
; 0066 ! TABLE OF CONTENTS
; 0067 !
; 0068
; 0069 forward routine
; 0070 NMU$QUEUE_MANAGER; ! Global entry definitions
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 4
X00.03 NMU$QUEUE_RESET as UQ_RESET 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (4)
; 0071 %global_routine ('NMU$QUEUE_RESET', QUEUE: ref Q_HEADER) : novalue =
; 0072
; 0073 !++
; 0074 ! Functional description:
; 0075 !
; 0076 ! This routine resets a queue header to the null
; 0077 ! state.
; 0078 !
; 0079 ! Formal parameters:
; 0080 !
; 0081 ! .QUEUE Address of queue header
; 0082 !
; 0083 ! Routine value: none
; 0084 ! Side effects:
; 0085 !
; 0086 ! All pointers in the queue header point to
; 0087 ! the header itself (empty queue).
; 0088 !
; 0089 !--
; 0090
; 0091 begin
; 0092
; 0093 QUEUE[Q_FORWARD] = .QUEUE;
; 0094 QUEUE[Q_REVERSE] = .QUEUE;
; 0095 UNLOCK (QUEUE[Q_SEMAPHORE]);
; 0096
; 0097 end; ! End of NMU$QUEUE_RESET
.TITLE NMUQUE NMUQUE -- General Queue Management
.IDENT /X00.03/
.SBTTL UQ.RESET NMU$QUEUE_RESET as UQ_RESET
000000 .PSECT $CODE$, RO
000000 016600 000002 UQ.RESET::
MOV 2(SP),R0 ; QUEUE,* 0093
000004 010010 MOV R0,(R0)
000006 010060 000002 MOV R0,2(R0) ; 0094
000012 005060 000004 CLR 4(R0) ; 0095
000016 000207 RTS PC ; 0071
; Routine Size: 8 words, Routine Base: $CODE$ + 0000
; Maximum stack depth per invocation: 0 words
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 5
X00.03 NMU$QUEUE_INSERT as UQ_INSERT 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (5)
; 0098 %global_routine ('NMU$QUEUE_INSERT', QUEUE: ref Q_HEADER, ENTRY: ref Q_ENTRY) =
; 0099
; 0100 !++
; 0101 ! Functional description:
; 0102 !
; 0103 ! This routine inserts an entry to the end of
; 0104 ! a queue.
; 0105 !
; 0106 ! Formal parameters:
; 0107 !
; 0108 ! .QUEUE Address of queue header
; 0109 ! .ENTRY Address of entry data. The queueing information
; 0110 ! is stored starting at this address. A block
; 0111 ! of length Q_ENTRY_SIZE must be reserved.
; 0112 !
; 0113 ! Routine value:
; 0114 !
; 0115 ! $true if queue becomes non-empty with this insert
; 0116 ! $false if queue was previously non-empty
; 0117 !
; 0118 ! Side effects:
; 0119 !
; 0120 ! The forward pointer of the last item on the queue and
; 0121 ! the reverse pointer of the queue header are changed to
; 0122 ! point to the new entry.
; 0123 !
; 0124 !--
; 0125
; 0126 begin
; 0127
; 0128 local
; 0129 LAST_ENTRY : ref Q_ENTRY,
; 0130 RET_VAL;
; 0131
; 0132 !
; 0133 ! Lock the queue from concurrently running processes.
; 0134 !
; 0135
; 0136 while not LOCK (QUEUE[Q_SEMAPHORE])
; 0137 do 1;
; 0138
; 0139 !
; 0140 ! If the queue header is zero ... queue is empty.
; 0141 ! Initialize the queue header.
; 0142 !
; 0143
; 0144 if .(.QUEUE) eql 0
; 0145 then begin
; 0146 QUEUE[Q_FORWARD] = .QUEUE;
; 0147 QUEUE[Q_REVERSE] = .QUEUE;
; 0148 end;
; 0149
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 6
X00.03 NMU$QUEUE_INSERT as UQ_INSERT 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (5)
; 0150 !
; 0151 ! Check for queue empty and set empty transition
; 0152 ! flag.
; 0153 !
; 0154
; 0155 RET_VAL = (.QUEUE eql .QUEUE[Q_REVERSE]); ! Check for non-empty
; 0156
; 0157 !
; 0158 ! Insert entry onto end of queue and
; 0159 ! update pointers.
; 0160 !
; 0161
; 0162 LAST_ENTRY = .QUEUE[Q_REVERSE];
; 0163 ENTRY[Q_REVERSE] = .LAST_ENTRY;
; 0164 ENTRY[Q_FORWARD] = .QUEUE;
; 0165 QUEUE[Q_REVERSE] = .ENTRY;
; 0166 LAST_ENTRY[Q_FORWARD] = .ENTRY;
; 0167
; 0168 !
; 0169 ! Unlock the queue.
; 0170 !
; 0171
; 0172 UNLOCK (QUEUE[Q_SEMAPHORE]);
; 0173
; 0174 !
; 0175 ! Return empty to non-empty transition flag.
; 0176 !
; 0177
; 0178 return .RET_VAL;
; 0179 end; ! End of NMU$QUEUE_INSERT
.SBTTL UQ.INSERT NMU$QUEUE_INSERT as UQ_INSERT
000000 004167 000000G UQ.INSERT::
JSR R1,$SAVE4 ; 0098
000004 016602 000016 MOV 16(SP),R2 ; QUEUE,* 0136
000010 012704 000004 MOV #4,R4
000014 060204 ADD R2,R4
000016 005714 1$: TST (R4)
000020 001376 BNE 1$
000022 012714 000001 2$: MOV #1,(R4)
000026 001775 BEQ 2$
000030 005712 TST (R2) ; 0144
000032 001003 BNE 3$
000034 010212 MOV R2,(R2) ; 0146
000036 010262 000002 MOV R2,2(R2) ; 0147
000042 005000 3$: CLR R0 ; 0155
000044 020262 000002 CMP R2,2(R2)
000050 001001 BNE 4$
000052 005200 INC R0
000054 010003 4$: MOV R0,R3 ; *,RET.VAL
000056 016201 000002 MOV 2(R2),R1 ; *,LAST.ENTRY 0162
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 7
X00.03 NMU$QUEUE_INSERT as UQ_INSERT 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (5)
000062 016600 000014 MOV 14(SP),R0 ; ENTRY,* 0163
000066 010160 000002 MOV R1,2(R0) ; LAST.ENTRY,*
000072 010210 MOV R2,(R0) ; 0164
000074 010062 000002 MOV R0,2(R2) ; 0165
000100 010011 MOV R0,(R1) ; *,LAST.ENTRY 0166
000102 005014 CLR (R4) ; 0172
000104 010300 MOV R3,R0 ; RET.VAL,* 0126
000106 000207 RTS PC ; 0098
; Routine Size: 36 words, Routine Base: $CODE$ + 0020
; Maximum stack depth per invocation: 6 words
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 8
X00.03 NMU$QUEUE_REMOVE as UQ_REMOVE 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (6)
; 0180 %global_routine ('NMU$QUEUE_REMOVE', QUEUE: ref Q_HEADER) =
; 0181
; 0182 !++
; 0183 ! Functional description:
; 0184 !
; 0185 ! This routine removes the first entry on a queue.
; 0186 ! If the queue is empty a zero (0) value is returned.
; 0187 !
; 0188 ! Formal parameters:
; 0189 !
; 0190 ! .QUEUE Address of queue header
; 0191 !
; 0192 ! Routine value:
; 0193 !
; 0194 ! Non-empty queue Address of entry (after queue information)
; 0195 ! Empty queue Zero (0)
; 0196 !
; 0197 ! Side effects:
; 0198 !
; 0199 ! The forward pointer of the queue header and the
; 0200 ! reverse pointer of the second entry (if any) are
; 0201 ! changed to point to each other.
; 0202 !--
; 0203
; 0204 begin
; 0205
; 0206 local
; 0207 ENTRY : ref Q_ENTRY,
; 0208 NEXT_ENTRY : ref Q_ENTRY;
; 0209
; 0210 !
; 0211 ! Lock the queue from concurrently running processes.
; 0212 !
; 0213
; 0214 while not LOCK (QUEUE[Q_SEMAPHORE])
; 0215 do 1;
; 0216
; 0217 !
; 0218 ! If the queue header is zero ... queue is empty.
; 0219 ! Initialize the queue header.
; 0220 !
; 0221
; 0222 if .(.QUEUE) eql 0
; 0223 then begin
; 0224 QUEUE[Q_FORWARD] = .QUEUE;
; 0225 QUEUE[Q_REVERSE] = .QUEUE;
; 0226 end;
; 0227
; 0228 !
; 0229 ! Get address of first entry on the queue.
; 0230 !
; 0231
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 9
X00.03 NMU$QUEUE_REMOVE as UQ_REMOVE 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (6)
; 0232 ENTRY = .QUEUE[Q_FORWARD];
; 0233
; 0234 !
; 0235 ! Check for empty queue, return zero if empty.
; 0236 ! If entry found...
; 0237 ! unlink from queue
; 0238 ! fixup queue around hole made by removal
; 0239 ! clear queue linkage in removed entry.
; 0240 !
; 0241
; 0242 if .ENTRY eql .QUEUE
; 0243 then ENTRY = 0
; 0244 else begin
; 0245 NEXT_ENTRY = .ENTRY[Q_FORWARD];
; 0246 QUEUE[Q_FORWARD] = .NEXT_ENTRY;
; 0247 NEXT_ENTRY[Q_REVERSE] = .QUEUE;
; 0248 ENTRY[Q_FORWARD] = 0;
; 0249 ENTRY[Q_REVERSE] = 0;
; 0250 end;
; 0251
; 0252 UNLOCK (QUEUE[Q_SEMAPHORE]); ! Unlock the queue
; 0253
; 0254 return .ENTRY; ! Return address of entry found, if any
; 0255 end; ! End of NMU$QUEUE_REMOVE
.SBTTL UQ.REMOVE NMU$QUEUE_REMOVE as UQ_REMOVE
000000 004167 000000G UQ.REMOVE::
JSR R1,$SAVE3 ; 0180
000004 016601 000012 MOV 12(SP),R1 ; QUEUE,* 0214
000010 012703 000004 MOV #4,R3
000014 060103 ADD R1,R3
000016 005713 1$: TST (R3)
000020 001376 BNE 1$
000022 012713 000001 2$: MOV #1,(R3)
000026 001775 BEQ 2$
000030 005711 TST (R1) ; 0222
000032 001003 BNE 3$
000034 010111 MOV R1,(R1) ; 0224
000036 010161 000002 MOV R1,2(R1) ; 0225
000042 011102 3$: MOV (R1),R2 ; *,ENTRY 0232
000044 020201 CMP R2,R1 ; ENTRY,* 0242
000046 001002 BNE 4$
000050 005002 CLR R2 ; ENTRY 0243
000052 000407 BR 5$ ; 0242
000054 011200 4$: MOV (R2),R0 ; ENTRY,NEXT.ENTRY 0245
000056 010011 MOV R0,(R1) ; NEXT.ENTRY,* 0246
000060 010160 000002 MOV R1,2(R0) ; *,*(NEXT.ENTRY) 0247
000064 005012 CLR (R2) ; ENTRY 0248
000066 005062 000002 CLR 2(R2) ; *(ENTRY) 0249
000072 005013 5$: CLR (R3) ; 0252
000074 010200 MOV R2,R0 ; ENTRY,* 0204
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 10
X00.03 NMU$QUEUE_REMOVE as UQ_REMOVE 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (6)
000076 000207 RTS PC ; 0180
; Routine Size: 32 words, Routine Base: $CODE$ + 0130
; Maximum stack depth per invocation: 5 words
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 11
X00.03 NMU$QUEUE_EXTRACT as UQ_EXTRACT 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (7)
; 0256 %global_routine ('NMU$QUEUE_EXTRACT', QUEUE: ref Q_HEADER, ENTRY: ref Q_ENTRY) =
; 0257
; 0258 !++
; 0259 ! Functional description:
; 0260 !
; 0261 ! This routine handles extraction of an entry from a place
; 0262 ! in a queue other than the beginning. This requires "knowing"
; 0263 ! the address of the queue entry before calling this routine.
; 0264 !
; 0265 ! Formal parameters:
; 0266 !
; 0267 ! .QUEUE Address of queue header
; 0268 ! .ENTRY Address of entry (after queue information)
; 0269 !
; 0270 ! Routine value:
; 0271 !
; 0272 ! $true Entry was found on the queue and extracted
; 0273 ! $false Entry was not found on the queue
; 0274 !
; 0275 ! Side effects:
; 0276 !
; 0277 ! The links of the queue entries before and after the
; 0278 ! entry to be extracted are updated to point to each
; 0279 ! other.
; 0280 !
; 0281 !--
; 0282
; 0283 begin
; 0284
; 0285 local
; 0286 NEXT_ENTRY : ref Q_ENTRY,
; 0287 PREVIOUS_ENTRY : ref Q_ENTRY,
; 0288 SEARCH : ref Q_ENTRY,
; 0289 RET_VAL;
; 0290
; 0291 !
; 0292 ! Lock the queue from concurrently running processes.
; 0293 !
; 0294
; 0295 while not LOCK (QUEUE[Q_SEMAPHORE])
; 0296 do 1;
; 0297
; 0298 !
; 0299 ! If the queue header is zero ... queue is empty.
; 0300 ! Initialize the queue header.
; 0301 !
; 0302
; 0303 if .(.QUEUE) eql 0
; 0304 then begin
; 0305 QUEUE[Q_FORWARD] = .QUEUE;
; 0306 QUEUE[Q_REVERSE] = .QUEUE;
; 0307 end;
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 12
X00.03 NMU$QUEUE_EXTRACT as UQ_EXTRACT 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (7)
; 0308
; 0309 !
; 0310 ! Loop until the entry is found.
; 0311 !
; 0312
; 0313 SEARCH = .QUEUE[Q_FORWARD];
; 0314
; 0315 while (.SEARCH neq .ENTRY) and (.SEARCH neq .QUEUE)
; 0316 do SEARCH = .SEARCH[Q_FORWARD];
; 0317
; 0318 if .SEARCH eql .ENTRY ! Found entry ?
; 0319 then begin ! Yes, extract it and return true
; 0320 NEXT_ENTRY = .ENTRY[Q_FORWARD];
; 0321 PREVIOUS_ENTRY = .ENTRY[Q_REVERSE];
; 0322 NEXT_ENTRY[Q_REVERSE] = .PREVIOUS_ENTRY;
; 0323 PREVIOUS_ENTRY[Q_FORWARD] = .NEXT_ENTRY;
; 0324 RET_VAL = $TRUE;
; 0325 end
; 0326 else RET_VAL = $FALSE; ! No, return false
; 0327
; 0328 UNLOCK (QUEUE[Q_SEMAPHORE]); ! Unlock queue
; 0329
; 0330 return .RET_VAL; ! Return result of extraction
; 0331 end; ! End of NMU$QUEUE_EXTRACT
.SBTTL UQ.EXTRACT NMU$QUEUE_EXTRACT as UQ_EXTRACT
000000 004167 000000G UQ.EXTRACT::
JSR R1,$SAVE3 ; 0256
000004 016602 000014 MOV 14(SP),R2 ; QUEUE,* 0295
000010 012703 000004 MOV #4,R3
000014 060203 ADD R2,R3
000016 005713 1$: TST (R3)
000020 001376 BNE 1$
000022 012713 000001 2$: MOV #1,(R3)
000026 001775 BEQ 2$
000030 005712 TST (R2) ; 0303
000032 001003 BNE 3$
000034 010212 MOV R2,(R2) ; 0305
000036 010262 000002 MOV R2,2(R2) ; 0306
000042 011200 3$: MOV (R2),R0 ; *,SEARCH 0313
000044 016601 000012 MOV 12(SP),R1 ; ENTRY,* 0315
000050 020001 4$: CMP R0,R1 ; SEARCH,*
000052 001406 BEQ 6$
000054 020002 CMP R0,R2 ; SEARCH,*
000056 001402 BEQ 5$
000060 011000 MOV (R0),R0 ; SEARCH,SEARCH 0316
000062 000772 BR 4$ ; 0315
000064 020001 5$: CMP R0,R1 ; SEARCH,* 0318
000066 001011 BNE 7$
000070 011102 6$: MOV (R1),R2 ; *,NEXT.ENTRY 0320
000072 016101 000002 MOV 2(R1),R1 ; *,PREVIOUS.ENTRY 0321
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 13
X00.03 NMU$QUEUE_EXTRACT as UQ_EXTRACT 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (7)
000076 010162 000002 MOV R1,2(R2) ; PREVIOUS.ENTRY,*(NEXT.ENTRY) 0322
000102 010211 MOV R2,(R1) ; NEXT.ENTRY,PREVIOUS.ENTRY 0323
000104 012701 000001 MOV #1,R1 ; *,RET.VAL 0324
000110 000401 BR 8$ ; 0318
000112 005001 7$: CLR R1 ; RET.VAL 0326
000114 005013 8$: CLR (R3) ; 0328
000116 010100 MOV R1,R0 ; RET.VAL,* 0283
000120 000207 RTS PC ; 0256
; Routine Size: 41 words, Routine Base: $CODE$ + 0230
; Maximum stack depth per invocation: 5 words
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 14
X00.03 NMU$QUEUE_LENGTH as UQ_LENGTH 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (8)
; 0332 %global_routine ('NMU$QUEUE_LENGTH', QUEUE: ref Q_HEADER) =
; 0333
; 0334 !++
; 0335 ! Functional description:
; 0336 !
; 0337 ! This routine returns the length (number of entries) of a queue.
; 0338 !
; 0339 ! Formal parameters:
; 0340 !
; 0341 ! .QUEUE Address of queue header
; 0342 !
; 0343 ! Routine value:
; 0344 !
; 0345 ! The length (number of entries) of the queue.
; 0346 !
; 0347 ! Side effects: none
; 0348 !
; 0349 !--
; 0350
; 0351 begin
; 0352
; 0353 local
; 0354 ENTRY,
; 0355 RESULT,
; 0356 NEXT : ref Q_ENTRY;
; 0357
; 0358 !
; 0359 ! Lock the queue from concurrently running processes.
; 0360 !
; 0361
; 0362 while not LOCK (QUEUE[Q_SEMAPHORE])
; 0363 do 1;
; 0364
; 0365 !
; 0366 ! If the queue header is zero ... queue is empty.
; 0367 ! Return length of 0
; 0368 !
; 0369
; 0370 RESULT = 0;
; 0371
; 0372 if .(.QUEUE) neq 0
; 0373 then begin
; 0374 NEXT = .QUEUE[Q_FORWARD]; ! Set first entry to the queue
; 0375
; 0376 while (ENTRY = .NEXT) neq .QUEUE
; 0377 do begin ! Scan queue until end of queue
; 0378 RESULT = .RESULT + 1;
; 0379 NEXT = .NEXT[Q_FORWARD];
; 0380 end;
; 0381 end;
; 0382
; 0383 UNLOCK (QUEUE[Q_SEMAPHORE]); ! Unlock the queue
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 15
X00.03 NMU$QUEUE_LENGTH as UQ_LENGTH 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (8)
; 0384
; 0385 return .RESULT; ! Return the result of scanning
; 0386 end; ! End of NMU$QUEUE_LENGTH
.SBTTL UQ.LENGTH NMU$QUEUE_LENGTH as UQ_LENGTH
000000 004167 000000G UQ.LENGTH::
JSR R1,$SAVE4 ; 0332
000004 016601 000014 MOV 14(SP),R1 ; QUEUE,* 0362
000010 012703 000004 MOV #4,R3
000014 060103 ADD R1,R3
000016 005713 1$: TST (R3)
000020 001376 BNE 1$
000022 012713 000001 2$: MOV #1,(R3)
000026 001775 BEQ 2$
000030 005002 CLR R2 ; RESULT 0370
000032 005711 TST (R1) ; 0372
000034 001407 BEQ 4$
000036 011100 MOV (R1),R0 ; *,NEXT 0374
000040 010004 3$: MOV R0,R4 ; NEXT,ENTRY 0376
000042 020001 CMP R0,R1 ; NEXT,*
000044 001403 BEQ 4$
000046 005202 INC R2 ; RESULT 0378
000050 011000 MOV (R0),R0 ; NEXT,NEXT 0379
000052 000772 BR 3$ ; 0376
000054 005013 4$: CLR (R3) ; 0383
000056 010200 MOV R2,R0 ; RESULT,* 0351
000060 000207 RTS PC ; 0332
; Routine Size: 25 words, Routine Base: $CODE$ + 0352
; Maximum stack depth per invocation: 6 words
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 16
X00.03 NMU$QUEUE_SCAN as UQ_SCAN 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (9)
; 0387 %global_routine ('NMU$QUEUE_SCAN', QUEUE: ref Q_HEADER, DATA, S_RTN) =
; 0388
; 0389 !++
; 0390 ! Functional description:
; 0391 !
; 0392 ! This routine facilitates scanning a queue. The S_RTN
; 0393 ! parameter specifies a routine that is to be called with
; 0394 ! the DATA parameter and each ENTRY. When the return
; 0395 ! from the S_RTN is non-zero or the queue runs out, the
; 0396 ! scanning stops.
; 0397 !
; 0398 ! Formal parameters:
; 0399 !
; 0400 ! .QUEUE Address of queue header
; 0401 ! .DATA Data to be passed to each S_RTN call
; 0402 ! .S_RTN Scanning routine to be called for each entry
; 0403 !
; 0404 ! Routine value:
; 0405 !
; 0406 ! The value of S_RTN if it ever returns a non-zero value.
; 0407 ! Zero if the queue runs out before non-zero from S_RTN.
; 0408 !
; 0409 ! Side effects: none
; 0410 !
; 0411 !--
; 0412
; 0413 begin
; 0414
; 0415 bind routine
; 0416 SCAN_ROUTINE = .S_RTN;
; 0417
; 0418 local
; 0419 ENTRY,
; 0420 RESULT,
; 0421 NEXT : ref Q_ENTRY;
; 0422
; 0423 !
; 0424 ! Lock the queue from concurrently running processes.
; 0425 !
; 0426
; 0427 while not LOCK (QUEUE[Q_SEMAPHORE])
; 0428 do 1;
; 0429
; 0430 !
; 0431 ! If the queue header is zero ... queue is empty.
; 0432 ! Initialize the queue header.
; 0433 !
; 0434
; 0435 if .(.QUEUE) eql 0
; 0436 then begin
; 0437 QUEUE[Q_FORWARD] = .QUEUE;
; 0438 QUEUE[Q_REVERSE] = .QUEUE;
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 17
X00.03 NMU$QUEUE_SCAN as UQ_SCAN 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (9)
; 0439 end;
; 0440
; 0441 !
; 0442 ! Clear the result value and point to the
; 0443 ! first entry on the queue.
; 0444 !
; 0445
; 0446 RESULT = 0;
; 0447 NEXT = .QUEUE[Q_FORWARD];
; 0448
; 0449 !
; 0450 ! Scan queue until end of queue or the scan
; 0451 ! routine returns a non zero value.
; 0452 !
; 0453
; 0454 while (ENTRY = .NEXT) neq .QUEUE
; 0455 do begin
; 0456 NEXT = .NEXT[Q_FORWARD];
; 0457 UNLOCK (QUEUE[Q_SEMAPHORE]);
; 0458
; 0459 if (RESULT = SCAN_ROUTINE (.ENTRY, .DATA)) neq 0
; 0460 then exitloop;
; 0461
; 0462 while not LOCK (QUEUE[Q_SEMAPHORE])
; 0463 do 1;
; 0464 end;
; 0465
; 0466 UNLOCK (QUEUE[Q_SEMAPHORE]); ! Unlock the queue
; 0467
; 0468 return .RESULT; ! Return the result of scanning
; 0469 end; ! End of NMU$QUEUE_SCAN
.SBTTL UQ.SCAN NMU$QUEUE_SCAN as UQ_SCAN
000000 004167 000000G UQ.SCAN::
JSR R1,$SAVE5 ; 0387
000004 016602 000022 MOV 22(SP),R2 ; QUEUE,* 0427
000010 012704 000004 MOV #4,R4
000014 060204 ADD R2,R4
000016 005714 1$: TST (R4)
000020 001376 BNE 1$
000022 012714 000001 2$: MOV #1,(R4)
000026 001775 BEQ 2$
000030 005712 TST (R2) ; 0435
000032 001003 BNE 3$
000034 010212 MOV R2,(R2) ; 0437
000036 010262 000002 MOV R2,2(R2) ; 0438
000042 005003 3$: CLR R3 ; RESULT 0446
000044 011201 MOV (R2),R1 ; *,NEXT 0447
000046 010105 4$: MOV R1,R5 ; NEXT,ENTRY 0454
000050 020102 CMP R1,R2 ; NEXT,*
000052 001420 BEQ 7$
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 18
X00.03 NMU$QUEUE_SCAN as UQ_SCAN 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (9)
000054 011101 MOV (R1),R1 ; NEXT,NEXT 0456
000056 005014 CLR (R4) ; 0457
000060 010546 MOV R5,-(SP) ; ENTRY,* 0459
000062 016646 000022 MOV 22(SP),-(SP) ; DATA,*
000066 004776 000022 JSR PC,@22(SP) ; *,S.RTN
000072 022626 CMP (SP)+,(SP)+
000074 010003 MOV R0,R3 ; *,RESULT
000076 001006 BNE 7$ ; 0460
000100 005714 5$: TST (R4) ; 0462
000102 001376 6$: BNE 5$
000104 012714 000001 MOV #1,(R4)
000110 001356 BNE 4$
000112 000773 BR 6$
000114 005014 7$: CLR (R4) ; 0466
000116 010300 MOV R3,R0 ; RESULT,* 0413
000120 000207 RTS PC ; 0387
; Routine Size: 41 words, Routine Base: $CODE$ + 0434
; Maximum stack depth per invocation: 9 words
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 19
X00.03 NMU$QUEUE_SCAN_EXTRACT as UQ_SEXTRACT 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (10)
; 0470 %global_routine ('NMU$QUEUE_SCAN_EXTRACT', ENTRY: ref Q_ENTRY) : novalue =
; 0471
; 0472 !++
; 0473 ! Functional description:
; 0474 !
; 0475 ! This routine is used to extract a queue entry from
; 0476 ! a queue while scanning the queue. It is assumed
; 0477 ! that the only queue being worked on is the one being
; 0478 ! scanned. It also is assumed that the entry being
; 0479 ! extracted is the one currently being looked at by
; 0480 ! the scanning routine.
; 0481 !
; 0482 ! ANY OTHER USE OF THIS ROUTINE CAN GIVE UNPREDICTABLE
; 0483 ! RESULTS!
; 0484 !
; 0485 ! Formal parameters:
; 0486 !
; 0487 ! .ENTRY Address of queue entry to remove.
; 0488 !
; 0489 ! Routine value: none
; 0490 ! Side effects: none
; 0491 !
; 0492 !--
; 0493
; 0494 begin
; 0495
; 0496 local
; 0497 NEXT_ENTRY : ref Q_ENTRY,
; 0498 PREVIOUS_ENTRY : ref Q_ENTRY;
; 0499
; 0500 NEXT_ENTRY = .ENTRY[Q_FORWARD];
; 0501 PREVIOUS_ENTRY = .ENTRY[Q_REVERSE];
; 0502 NEXT_ENTRY[Q_REVERSE] = .PREVIOUS_ENTRY;
; 0503 PREVIOUS_ENTRY[Q_FORWARD] = .NEXT_ENTRY;
; 0504
; 0505 end; ! End of NMU$QUEUE_SCAN_EXTRACT
.SBTTL UQ.SEXTRACT NMU$QUEUE_SCAN_EXTRACT as UQ_SEXTRACT
000000 010146 UQ.SEXTRACT::
MOV R1,-(SP) ; 0470
000002 017601 000004 MOV @4(SP),R1 ; ENTRY,NEXT.ENTRY 0500
000006 016600 000004 MOV 4(SP),R0 ; ENTRY,* 0501
000012 016000 000002 MOV 2(R0),R0 ; *,PREVIOUS.ENTRY
000016 010061 000002 MOV R0,2(R1) ; PREVIOUS.ENTRY,*(NEXT.ENTRY) 0502
000022 010110 MOV R1,(R0) ; NEXT.ENTRY,PREVIOUS.ENTRY 0503
000024 012601 MOV (SP)+,R1 ; 0470
000026 000207 RTS PC
; Routine Size: 12 words, Routine Base: $CODE$ + 0556
; Maximum stack depth per invocation: 2 words
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 20
X00.03 NMU$QUEUE_SCAN_EXTRACT as UQ_SEXTRACT 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (11)
; 0506 end ! End of module NMUQUE
; 0507 eludom
; OTS external references
.GLOBL $SAVE5, $SAVE4, $SAVE3
; PSECT SUMMARY
;
; Psect Name Words Attributes
; $CODE$ 195 RO , I , LCL, REL, CON
; LIBRARY STATISTICS
;
; -------- Symbols -------- Blocks
; File Total Loaded Percent Read
;
; DNET61:<MCB.NML>NMULIB.L16.1 2716 28 1 0
NMUQUE NMUQUE -- General Queue Management 24-May-1985 13:28:45 TOPS-20 Bliss-16 2A(530) Page 21
X00.03 NMU$QUEUE_SCAN_EXTRACT as UQ_SEXTRACT 3-Jan-1983 17:14:48 DNET61:<MCB.NML>NMUQUE.BLI.1 (12)
; 0508
; 0509 ! Local Modes:
; 0510 ! Mode:BLISS
; 0511 ! Auto Save Mode:2
; 0512 ! Comment Column:40
; 0513 ! Comment Rounding:+1
; 0514 ! End:
; Size: 195 code + 0 data words
; Run Time: 00:05.2
; Elapsed Time: 00:08.4
; Memory Used: 30 pages
; Compilation Complete
DATA 387 459
LAST_ENTRY 129 162# 163# 166#
LOCK 136 214 295 362 427 462
NEXT 356 374# 376 379# 421 447# 454 456#
NEXT_ENTRY 208 245# 246 247# 286 320# 322# 323 497 500# 502# 503
NMU$QUEUE_MANAGER 70
NMUQUE 17#
PREVIOUS_ENTRY 287 321# 322 323# 498 501# 502 503#
QUEUE 71 93# 94# 95 98 136 144 146# 147# 155 162# 164
165# 172 180 214 222 224# 225# 232 242# 246# 247# 252
256 295 303 305# 306# 313 315 328 332 362 372 374#
376 383 387 427 435 437# 438# 447# 454 457 462 466
Q_ENTRY 98 129 207 208 256 286 287 288 356 421 470 497
498
Q_FORWARD 93 146 164 166 224 232 245 246 248 305 313 316
320 323 374 379 437 447 456 500 503
Q_HEADER 71 98 180 256 332 387
Q_REVERSE 94 147 155 162 163 165 225 247 249 306 321 322
438 501 502
Q_SEMAPHORE 95 136 172 214 252 295 328 362 383 427 457 462
466
RESULT 355 370# 378# 385 420 446# 459# 468
RET_VAL 130 155# 178 289 324# 326# 330
SCAN_ROUTINE 416* 459
SEARCH 288 313# 315 316# 318
S_RTN 387 416
UNLOCK 95 172 252 328 383 457 466
$FALSE 326
$TRUE 324
%GLOBAL_ROUTINE 71# 98# 180# 256# 332# 387# 470#