Google
 

Trailing-Edge - PDP-10 Archives - BB-P363B-SM_1985 - mcb/cex/cexsub.lst
There are no other files named cexsub.lst in the archive.
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23
CEXSUB.M11    30-DEC-82 00:33		TABLE OF CONTENTS

  2651		DECLARATIONS
  2674		$ADD32	- Add 16 bit number to 32 bit number
  2717		$ASH32	- Shift signed 32 bit number
  2759		$DIV32	- Divide a 32 bit number
  2802		$MUL32	- Multiply to produce a 32 bit number
  2843		$CMQIF	- Queue CCBs to Front
  2900		$CMQIN	- Queue CCBs to Rear
  2952		$CMQRM	- Remove CCB from Queue
  3001		$CNV22	- Convert Bias/Address to 22 Bits
  3057		$CPTBF	- Copy CCB Chain to Unmapped Buffer
  3119		$MVFBF	- Move Data from Unmapped Buffer
  3187		$MVTBF	- Move Data to Unmapped Buffer
  3255		$PHY18	- Convert Bias/Address to 18 Bit UNIBUS Address
  3322		$RND	- Get a Random Number
  3405		$IDSTS	- Identify a Status Value from a Table
  3461		$IDVAL	- Identify a Value from a Table
  3512		$VIR18	- Convert 18 Bit UNIBUS Address to Bias/Address
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 1
CEXSUB.M11    30-DEC-82 00:33

     1						.TITLE	CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES
     2						.IDENT	/003160/
     3						.ENABL	LC
     4
     5					;
     6					;                    COPYRIGHT (c) 1980, 1981, 1982
     7					;                    DIGITAL EQUIPMENT CORPORATION
     8					;                        Maynard, Massachusetts
     9					;
    10					;     This software is furnished under a license and may  be  used
    11					;     and copied only in accordance with the terms of such license
    12					;     and with the inclusion of the above copyright notice.   This
    13					;     software  or any other copies thereof may not be provided or
    14					;     otherwise made available to any other person.  No  title  to
    15					;     and ownership of the software is hereby transferred.
    16					;
    17					;     The information  in  this  software  is  subject  to  change
    18					;     without  notice  and should not be construed as a commitment
    19					;     by DIGITAL EQUIPMENT CORPORATION.
    20					;
    21					;     DIGITAL assumes no responsibility for the use or reliability
    22					;     of  its  software  on  equipment  which  is  not supplied by
    23					;     DIGITAL.
    24					;
    25
    26					;++
    27					; FACILITY: MCB Communications Executive
    28					;
    29					; FUNCTIONAL ABSTRACT:
    30					;
    31					;	This module contains the routines of general use to processes.
    32					;
    33					; ENVIRONMENT: RSX kernel mode with EIS
    34					;
    35					; AUTHOR: Alan D. Peckham, CREATION DATE: 21-MAR-80
    36					;
    37					; MODIFIED BY:
    38					;
    39					;	Alan D. Peckham, 2-Jul-80: VERSION 3.0
    40					; 01	- Change CRSH$ references to CRSH$S.
    41					; 02	- Allow zero count to buffer move routines.
    42					;	  Globalize references to I/O page.
    43					; 03	- Moved global data to seperate module
    44					;	  (module can now be made read-only).
    45					; 04	- Correct shift bug in $CNV18.
    46					; 05	- Update CRSH$S contexts.
    47					; 06	- Correct PIX check in $PDVNM.
    48					; 07	- Fix divide bug in $RND.
    49					; 08	- Verify CCB addresses.
    50					;	Alan D. Peckham, 9-Dec-80: VERSION 3.1
    51					; 09	- Update for MCB V3.1
    52					;	Alan D. Peckham, 30-Jan-80: VERSION 3.2
    53					; 10	- Speed up queueing routines $CMQIN and $CMQIF.
    54					;	  Move $PDVID and $PRCNM to CEX process.
    55					; 11	- Added $CPCTB (CoPy Chain To Buffer).
    56					; 12	- Beware sign extension in $CNV22.
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 1-1
CEXSUB.M11    30-DEC-82 00:33

    57					;	  Add $CBLKS routine for CEX process.
    58					; 14	- Corrected copy length bug in $CPTBF.
    59					;	  Round up block estimates in $CBLKS.
    60					; 15	- Fix crash stack context in $RND.
    61					;	  Check for CCB in $CPTBF.
    62					;	  Add new routines $PHY18 and $VIR18 to facilitate
    63					;	  support of UNIBUS mapping.
    64					;	  Remove $CBLKS routine (replaced by following).
    65					;	  Add 32 bit routines:
    66					;	    $ADD32 - Add 16 bit number to 32 bit number.
    67					;	    $MUL32 - multiply two 16 bit numbers to form a 32 bit number.
    68					;	    $DIV32 - divide a 32 bit number by a 16 bit number to get
    69					;		a 16 bit quotient and 16 bit remainder.
    70					;	    $ASH32 - shift a signed 32 bit number.
    71					; 16	- Add new routines $IDSTS and $IDVAL.
    72					;--
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 2
CEXSUB.M11    30-DEC-82 00:33		DECLARATIONS

    74						.SBTTL	DECLARATIONS
    75
    76					;
    77					; INCLUDE FILES:
    78					;
    79
    80						.MCALL	CRSH$S
    81						.GLOBL	KISAR5
    82
    83					;
    84					; MACROS:
    85					;
    86					;	None
    87					;
    88					; EQUATED SYMBOLS:
    89					;
    90					;	None
    91					;
    92					; OWN STORAGE:
    93					;
    94
    95						.GLOBL	.RND		; Random number seed.
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 3
CEXSUB.M11    30-DEC-82 00:33		$ADD32	- ADD 16 BIT NUMBER TO 32 BIT NUMBER

    97						.SBTTL	$ADD32	- Add 16 bit number to 32 bit number
    98					;++
    99					; FUNCTIONAL DESCRIPTION:
   100					;
   101					;	Add 16 bit number to 32 bit number
   102					;
   103					; CALLING SEQUENCE:
   104					;
   105					;	CALL	$ADD32
   106					;
   107					; INPUT PARAMETERS:
   108					;
   109					;	R0 = High order 16 bits of number.
   110					;	R1 = Low order 16 bits of number.
   111					;	R2 = Number to add.
   112					;
   113					; IMPLICIT INPUTS:
   114					;
   115					;	None
   116					;
   117					; OUTPUT PARAMETERS:
   118					;
   119					;	R0 = High order 16 bits of sum.
   120					;	R1 = Low order 16 bits of sum.
   121					;
   122					; IMPLICIT OUTPUTS:
   123					;
   124					;	None
   125					;
   126					; CONDITION CODES:
   127					;
   128					;	None
   129					;
   130					; SIDE EFFECTS:
   131					;
   132					;	None
   133					;--
   134
   135		000000'				.PSECT	$CODE$,I,RO
   136	000000'	060201			$ADD32::ADD	R2,R1		; Do the sum.
   137	000002'	005500				ADC	R0
   138	000004'	000207				RETURN
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 4
CEXSUB.M11    30-DEC-82 00:33		$ASH32	- SHIFT SIGNED 32 BIT NUMBER

   140						.SBTTL	$ASH32	- Shift signed 32 bit number
   141					;++
   142					; FUNCTIONAL DESCRIPTION:
   143					;
   144					;	Do an arithmetic shift on the given 32 bit number.
   145					;
   146					; CALLING SEQUENCE:
   147					;
   148					;	CALL	$ASH32
   149					;
   150					; INPUT PARAMETERS:
   151					;
   152					;	R0 = High order 16 bits of number.
   153					;	R1 = Low order 16 bits of number.
   154					;	R2 = Number of places to shift.
   155					;
   156					; IMPLICIT INPUTS:
   157					;
   158					;	None
   159					;
   160					; OUTPUT PARAMETERS:
   161					;
   162					;	R0 = High order 16 bits of shifted number.
   163					;	R1 = Low order 16 bits of shifted number.
   164					;
   165					; IMPLICIT OUTPUTS:
   166					;
   167					;	None
   168					;
   169					; CONDITION CODES:
   170					;
   171					;	None
   172					;
   173					; SIDE EFFECTS:
   174					;
   175					;	None
   176					;--
   177
   178		000006'				.PSECT	$CODE$,I,RO
   179	000006'	073002			$ASH32::ASHC	R2,R0		; Do the shift.
   180	000010'	000207				RETURN
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 5
CEXSUB.M11    30-DEC-82 00:33		$DIV32	- DIVIDE A 32 BIT NUMBER

   182						.SBTTL	$DIV32	- Divide a 32 bit number
   183					;++
   184					; FUNCTIONAL DESCRIPTION:
   185					;
   186					;	Divide the given 32 bit number to form 16 bit quotient and
   187					;	remainders.
   188					;
   189					; CALLING SEQUENCE:
   190					;
   191					;	CALL	$DIV32
   192					;
   193					; INPUT PARAMETERS:
   194					;
   195					;	R0 = High order 16 bits of dividend.
   196					;	R1 = Low order 16 bits of dividend.
   197					;	R2 = Divisor.
   198					;
   199					; IMPLICIT INPUTS:
   200					;
   201					;	None
   202					;
   203					; OUTPUT PARAMETERS:
   204					;
   205					;	R0 = Quotient.
   206					;	R1 = Remainder.
   207					;
   208					; IMPLICIT OUTPUTS:
   209					;
   210					;	None
   211					;
   212					; CONDITION CODES:
   213					;
   214					;	None
   215					;
   216					; SIDE EFFECTS:
   217					;
   218					;	None
   219					;--
   220
   221		000012'				.PSECT	$CODE$,I,RO
   222	000012'	071002			$DIV32::DIV	R2,R0		; Divide.
   223	000014'	000207				RETURN
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 6
CEXSUB.M11    30-DEC-82 00:33		$MUL32	- MULTIPLY TO PRODUCE A 32 BIT NUMBER

   225						.SBTTL	$MUL32	- Multiply to produce a 32 bit number
   226					;++
   227					; FUNCTIONAL DESCRIPTION:
   228					;
   229					;	Multiply to numbers to produce 32 bit number
   230					;
   231					; CALLING SEQUENCE:
   232					;
   233					;	CALL	$MUL32
   234					;
   235					; INPUT PARAMETERS:
   236					;
   237					;	R0 = Multiplicand.
   238					;	R2 = Multipler.
   239					;
   240					; IMPLICIT INPUTS:
   241					;
   242					;	None
   243					;
   244					; OUTPUT PARAMETERS:
   245					;
   246					;	R0 = High order 16 bits of result.
   247					;	R1 = Low order 16 bits of result.
   248					;
   249					; IMPLICIT OUTPUTS:
   250					;
   251					;	None
   252					;
   253					; CONDITION CODES:
   254					;
   255					;	None
   256					;
   257					; SIDE EFFECTS:
   258					;
   259					;	None
   260					;--
   261
   262		000016'				.PSECT	$CODE$,I,RO
   263	000016'	070002			$MUL32::MUL	R2,R0		; Multiply.
   264	000020'	000207				RETURN
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 7
CEXSUB.M11    30-DEC-82 00:33		$CMQIF	- QUEUE CCBS TO FRONT

   266						.SBTTL	$CMQIF	- Queue CCBs to Front
   267					;++
   268					; FUNCTIONAL DESCRIPTION:
   269					;
   270					;	Insert a chain of CCBs on the front of the given queue.
   271					;
   272					; CALLING SEQUENCE:
   273					;
   274					;	CALL	$CMQIF
   275					;
   276					; INPUT PARAMETERS:
   277					;
   278					;	R4 = Address of CCB chain to insert in queue.
   279					;	R3 = Address of queue list header.
   280					;
   281					; IMPLICIT INPUTS:
   282					;
   283					;	None
   284					;
   285					; OUTPUT PARAMETERS:
   286					;
   287					;	None
   288					;
   289					; IMPLICIT OUTPUTS:
   290					;
   291					;	None
   292					;
   293					; CONDITION CODES:
   294					;
   295					;	None
   296					;
   297					; SIDE EFFECTS:
   298					;
   299					;	None
   300					;--
   301
   302		000022'				.PSECT	$CODE$,I,RO
   303	000022'				$CMQIF::CCBCK$			; Verify CCB address.
   304	000022'	005714				TST	(R4)		; If only one CCB
   305	000024'	001005				BNE	40$		; then
   306	000026'	012314				MOV	(R3)+,(R4)	; link to front of chain.
   307	000030'	001001				BNE	22$		; If adding to empty list
   308	000032'	010413				MOV	R4,(R3)		; then update end of list pointer
   309	000034'	010443			22$:	MOV	R4,-(R3)	; and set first CCB in queue.
   310	000036'	000207				RETURN
   311	000040'				40$:	PUSH$S	<R5,R4>		; Get some room to work.
   312	000044'	010405			42$:	MOV	R4,R5		; Copy CCB address
   313	000046'	011504				MOV	(R5),R4		; and if the last
   314	000050'	001375				BNE	42$		; then
   315	000052'					POP$S	R4		; Get head CCB back
   316	000054'	012315				MOV	(R3)+,(R5)	; and link front of queue to chain.
   317	000056'	001001				BNE	44$		; If adding to empty list
   318	000060'	010513				MOV	R5,(R3)		; then update end of list pointer
   319	000062'	010443			44$:	MOV	R4,-(R3)	; and set first CCB in queue.
   320	000064'					POP$S	R5		; Thank you!
   321	000066'	000207				RETURN
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 8
CEXSUB.M11    30-DEC-82 00:33		$CMQIN	- QUEUE CCBS TO REAR

   323						.SBTTL	$CMQIN	- Queue CCBs to Rear
   324					;++
   325					; FUNCTIONAL DESCRIPTION:
   326					;
   327					;	Append a chain of CCBs on the end of the given queue.
   328					;
   329					; CALLING SEQUENCE:
   330					;
   331					;	CALL	$CMQIN
   332					;
   333					; INPUT PARAMETERS:
   334					;
   335					;	R4 = Address of CCB chain to insert in queue.
   336					;	R3 = Address of queue list header.
   337					;
   338					; IMPLICIT INPUTS:
   339					;
   340					;	None
   341					;
   342					; OUTPUT PARAMETERS:
   343					;
   344					;	None
   345					;
   346					; IMPLICIT OUTPUTS:
   347					;
   348					;	None
   349					;
   350					; CONDITION CODES:
   351					;
   352					;	None
   353					;
   354					; SIDE EFFECTS:
   355					;
   356					;	None
   357					;--
   358
   359		000070'				.PSECT	$CODE$,I,RO
   360	000070'				$CMQIN::CCBCK$			; Verify CCB address.
   361	000070'	005714				TST	(R4)		; and if this is the only one
   362	000072'	001005				BNE	40$		; then
   363	000074'	010473	000002			MOV	R4,@2(R3)	; link it to the end of queue
   364	000100'	010463	000002			MOV	R4,2(R3)	; and update last CCB in queue.
   365	000104'	000207				RETURN
   366	000106'				40$:	PUSH$S	<R5,R4>		; Get some room to work.
   367	000112'	010405			42$:	MOV	R4,R5		; Copy CCB address
   368	000114'	011504				MOV	(R5),R4		; and if the last
   369	000116'	001375				BNE	42$		; then
   370	000120'	011673	000002			MOV	(SP),@2(R3)	; link chain to end of queue
   371	000124'	010563	000002			MOV	R5,2(R3)	; and update last CCB in queue.
   372	000130'					POP$S	<R4,R5>		; Thank you!
   373	000134'	000207				RETURN
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 9
CEXSUB.M11    30-DEC-82 00:33		$CMQRM	- REMOVE CCB FROM QUEUE

   375						.SBTTL	$CMQRM	- Remove CCB from Queue
   376					;++
   377					; FUNCTIONAL DESCRIPTION:
   378					;
   379					;	Dequeue a CCB from the front of the given queue.
   380					;
   381					; CALLING SEQUENCE:
   382					;
   383					;	CALL	$CMQRM
   384					;
   385					; INPUT PARAMETERS:
   386					;
   387					;	R3 = Address of queue list header.
   388					;
   389					; IMPLICIT INPUTS:
   390					;
   391					;	None
   392					;
   393					; OUTPUT PARAMETERS:
   394					;
   395					;	If queue non-empty:
   396					;	    R4 = Address of removed CCB chain.
   397					;	If queue empty:
   398					;	    R4 = undefined.
   399					;
   400					; IMPLICIT OUTPUTS:
   401					;
   402					;	None
   403					;
   404					; CONDITION CODES:
   405					;
   406					;	C-bit set = Queue is empty.
   407					;	C-bit clear = CCB chain removed from queue.
   408					;
   409					; SIDE EFFECTS:
   410					;
   411					;	None
   412					;--
   413
   414		000136'				.PSECT	$CODE$,I,RO
   415	000136'	000261			$CMQRM::SEC			; Assume failure
   416	000140'	011304				MOV	(R3),R4		; and if list is empty
   417	000142'	001405				BEQ	90$		; then fail.
   418	000144'	011413				MOV	(R4),(R3)	; Otherwise de-link CCB
   419	000146'	001002				BNE	10$		; and if list now empty
   420	000150'	010363	000002			MOV	R3,2(R3)	; then reset last CCB pointer.
   421	000154'	005014			10$:	CLR	(R4)		; Reset link.
   422	000156'	000207			90$:	RETURN
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 10
CEXSUB.M11    30-DEC-82 00:33		$CNV22	- CONVERT BIAS/ADDRESS TO 22 BITS

   424						.SBTTL	$CNV22	- Convert Bias/Address to 22 Bits
   425					;++
   426					; FUNCTIONAL DESCRIPTION:
   427					;
   428					;	Convert given address doubleword (mapping bias and
   429					;	virtual address) to an 22-bit unibus virtual address.
   430					;
   431					; CALLING SEQUENCE:
   432					;
   433					;	CALL	$CNV22
   434					;
   435					; INPUT PARAMETERS:
   436					;
   437					;	R2 = Relocation bias.
   438					;	R3 = Virtual address.
   439					;
   440					; IMPLICIT INPUTS:
   441					;
   442					;	None
   443					;
   444					; OUTPUT PARAMETERS:
   445					;
   446					;	R2 = Bits 16 thru 21 of the unibus address in bits 0 and 3.
   447					;	     The rest of the word is zero.
   448					;	R3 = Low order 16 bits of the unibus address.
   449					;
   450					; IMPLICIT OUTPUTS:
   451					;
   452					;	None
   453					;
   454					; CONDITION CODES:
   455					;
   456					;	None
   457					;
   458					; SIDE EFFECTS:
   459					;
   460					;	None
   461					;--
   462
   463		000160'				.PSECT	$CODE$,I,RO
   464	000160'				$CNV22::PUSH$S	R3		; Save address
   465	000162'	042703	017777			BIC	#^C<160000>,R3	; isolate page bits
   466	000166'	040316				BIC	R3,(SP)		; and remove.
   467	000170'	022703	140000			CMP	#140000,R3	; if not in APR6
   468	000174'	001402				BEQ	10$		; then
   469	000176'	050316				BIS	R3,(SP)		; assume in DSR
   470	000200'	005002				CLR	R2		; with no bias.
   471	000202'	011603			10$:	MOV	(SP),R3		; Get bits 12 to 6
   472	000204'	072327	177772			ASH	#-6,R3		; without sign
   473	000210'	042703	176000			BIC	#^C1777,R3	; and
   474	000214'	060302				ADD	R3,R2		; add to bias.
   475	000216'					POP$S	R3		; Get address back
   476	000220'	072327	000012			ASH	#12,R3		; put bits 5 to 0 in top half
   477	000224'	073227	177766			ASHC	#-12,R2		; and pull back down with bias.
   478	000230'	000207				RETURN
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 11
CEXSUB.M11    30-DEC-82 00:33		$CPTBF	- COPY CCB CHAIN TO UNMAPPED BUFFER

   480						.SBTTL	$CPTBF	- Copy CCB Chain to Unmapped Buffer
   481					;++
   482					; FUNCTIONAL DESCRIPTION:
   483					;
   484					;	Move data from CCB chain to unmapped buffer.
   485					;
   486					; CALLING SEQUENCE:
   487					;
   488					;	MOV	<relocation bias of destination buffer>,-(SP)
   489					;	MOV	<virtual address of destination buffer>,-(SP)
   490					;	CALL	$CPTBF
   491					;	CMP	(SP)+,(SP)+	;(clears the stack)
   492					;
   493					; INPUT PARAMETERS:
   494					;
   495					;	R4 = address of source CCB chain.
   496					;
   497					; IMPLICIT INPUTS:
   498					;
   499					;	On the stack:
   500					;	    2(SP) = virtual address of destination buffer.
   501					;	    4(SP) = relocation bias of destination buffer.
   502					;
   503					; OUTPUT PARAMETERS:
   504					;
   505					;	R0 = number of bytes copied.
   506					;
   507					; IMPLICIT OUTPUTS:
   508					;
   509					;	None
   510					;
   511					; CONDITION CODES:
   512					;
   513					;	None
   514					;
   515					; SIDE EFFECTS:
   516					;
   517					;	None
   518					;--
   519
   520		000232'				.PSECT	$CODE$,I,RO
   521	000232'				$CPTBF::CCBCK$			; Verify CCB address.
   522	000232'					SAV4$S			; Get room to move...
   523	000236'					PUSH$S	@#KISAR5
   524	000242'	016600	000016			MOV	2+S.PARM+0(SP),R0 ; Pick up destination address
   525	000246'	016637	000020	000000G		MOV	2+S.PARM+2(SP),@#KISAR5 ; and mapping bias.
   526	000254'	022700	140000			CMP	#140000,R0	; If APR 6 material
   527	000260'	101002				BHI	10$		; then
   528	000262'	162700	020000			SUB	#20000,R0	; adjust for APR 5.
   529	000266'	010046			10$:	MOV	R0,-(SP)	; (save starting address)
   530	000270'	016402	000022		20$:	MOV	C.CNT(R4),R2
   531	000274'	001407				BEQ	40$
   532	000276'					MAP$	C.BUF+0(R4)
   533	000304'	016401	000020			MOV	C.BUF+2(R4),R1
   534	000310'	112120			30$:	MOVB	(R1)+,(R0)+	; Copy the data.
   535	000312'	077202				SOB	R2,30$
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 11-1
CEXSUB.M11    30-DEC-82 00:33		$CPTBF	- COPY CCB CHAIN TO UNMAPPED BUFFER

   536	000314'	016404	000002		40$:	MOV	C.CHN(R4),R4
   537	000320'	001363				BNE	20$
   538	000322'	162600				SUB	(SP)+,R0	; Figure copied length.
   539	000324'					POP$S	@#KISAR5	; Thank you.
   540	000330'	000207			90$:	RETURN
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 12
CEXSUB.M11    30-DEC-82 00:33		$MVFBF	- MOVE DATA FROM UNMAPPED BUFFER

   542						.SBTTL	$MVFBF	- Move Data from Unmapped Buffer
   543					;++
   544					; FUNCTIONAL DESCRIPTION:
   545					;
   546					;	Move data from an unmapped buffer to mapped buffer.
   547					;
   548					; CALLING SEQUENCE:
   549					;
   550					;	MOV	<relocation bias of source buffer>,-(SP)
   551					;	MOV	<virtual address of source buffer>,-(SP)
   552					;	CALL	$MVFBF
   553					;	CMP	(SP)+,(SP)+	;(clears the stack)
   554					;
   555					; INPUT PARAMETERS:
   556					;
   557					;	R2 = virtual address of destination buffer.
   558					;	R3 = count of bytes to move.
   559					;
   560					; IMPLICIT INPUTS:
   561					;
   562					;	On the stack:
   563					;	    2(SP) = virtual address of source buffer.
   564					;	    4(SP) = relocation bias of source buffer.
   565					;	KISAR6 = relocation bias of destination buffer.
   566					;
   567					; OUTPUT PARAMETERS:
   568					;
   569					;	R2 = address of byte beyond last byte inserted in the
   570					;	     destination buffer.
   571					;	R3 = zero.
   572					;
   573					; IMPLICIT OUTPUTS:
   574					;
   575					;	None
   576					;
   577					; CONDITION CODES:
   578					;
   579					;	None
   580					;
   581					; SIDE EFFECTS:
   582					;
   583					;	None
   584					;--
   585
   586		000332'				.PSECT	$CODE$,I,RO
   587	000332'				$MVFBF::
   588		   001				.IF	NE,D$$BUG
   589						CMP	#20000,R3	; If copying too much
   590						BLO	100$		; then better crash.
   591						.IFTF
   592
   593	000332'	005703				TST	R3		; If nothing to move
   594	000334'	001422				BEQ	90$		; then all finished.
   595	000336'					PUSH$S	<R1,@#KISAR5>	; Get room to move...
   596	000344'	016601	000006			MOV	6(SP),R1	; Pick up source address
   597	000350'	016637	000010	000000G		MOV	10(SP),@#KISAR5	; and mapping bias.
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 12-1
CEXSUB.M11    30-DEC-82 00:33		$MVFBF	- MOVE DATA FROM UNMAPPED BUFFER

   598	000356'	022701	140000			CMP	#140000,R1	; If APR 6 material
   599	000362'	101002				BHI	10$		; then
   600	000364'	162701	020000			SUB	#20000,R1	; adjust for APR 5.
   601	000370'	112122			10$:	MOVB	(R1)+,(R2)+	; Copy the data.
   602	000372'	077302				SOB	R3,10$
   603	000374'					POP$S	<@#KISAR5,R1>	; Thank you.
   604	000402'	000207			90$:	RETURN
   605
   606						.IFT
   607					100$:	CRSH$S	CPY		; Copy too long from unmapped buffer
   608		   000				.ENDC
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 13
CEXSUB.M11    30-DEC-82 00:33		$MVTBF	- MOVE DATA TO UNMAPPED BUFFER

   610						.SBTTL	$MVTBF	- Move Data to Unmapped Buffer
   611					;++
   612					; FUNCTIONAL DESCRIPTION:
   613					;
   614					;	Move data from a mapped buffer to an unmapped buffer.
   615					;
   616					; CALLING SEQUENCE:
   617					;
   618					;	MOV	<relocation bias of destination buffer>,-(SP)
   619					;	MOV	<virtual address of destination buffer>,-(SP)
   620					;	CALL	$MVTBF
   621					;	CMP	(SP)+,(SP)+	;(clears the stack)
   622					;
   623					; INPUT PARAMETERS:
   624					;
   625					;	R2 = virtual address of source buffer.
   626					;	R3 = count of bytes to move.
   627					;
   628					; IMPLICIT INPUTS:
   629					;
   630					;	On the stack:
   631					;	    2(SP) = virtual address of destination buffer.
   632					;	    4(SP) = relocation bias of destination buffer.
   633					;	KISAR6 = relocation bias of source buffer.
   634					;
   635					; OUTPUT PARAMETERS:
   636					;
   637					;	R2 = address of byte beyond last byte inserted in the
   638					;	     source buffer.
   639					;	R3 = zero.
   640					;
   641					; IMPLICIT OUTPUTS:
   642					;
   643					;	None
   644					;
   645					; CONDITION CODES:
   646					;
   647					;	None
   648					;
   649					; SIDE EFFECTS:
   650					;
   651					;	None
   652					;--
   653
   654		000404'				.PSECT	$CODE$,I,RO
   655	000404'				$MVTBF::
   656		   001				.IF	NE,D$$BUG
   657						CMP	#20000,R3	; If copying too much
   658						BLO	100$		; then better crash.
   659						.IFTF
   660
   661	000404'	005703				TST	R3		; If nothing to move
   662	000406'	001422				BEQ	90$		; then all finished.
   663	000410'					PUSH$S	<R1,@#KISAR5>	; Get room to move...
   664	000416'	016601	000006			MOV	6(SP),R1	; Pick up destination address
   665	000422'	016637	000010	000000G		MOV	10(SP),@#KISAR5	; and mapping bias.
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 13-1
CEXSUB.M11    30-DEC-82 00:33		$MVTBF	- MOVE DATA TO UNMAPPED BUFFER

   666	000430'	022701	140000			CMP	#140000,R1	; If APR 6 material
   667	000434'	101002				BHI	10$		; then
   668	000436'	162701	020000			SUB	#20000,R1	; adjust for APR 5.
   669	000442'	112221			10$:	MOVB	(R2)+,(R1)+	; Copy the data.
   670	000444'	077302				SOB	R3,10$
   671	000446'					POP$S	<@#KISAR5,R1>	; Thank you.
   672	000454'	000207			90$:	RETURN
   673
   674						.IFT
   675					100$:	CRSH$S	CPY		; Copy too long from unmapped buffer
   676		   000				.ENDC
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 14
CEXSUB.M11    30-DEC-82 00:33		$PHY18	- CONVERT BIAS/ADDRESS TO 18 BIT UNIBUS ADDRESS

   678						.SBTTL	$PHY18	- Convert Bias/Address to 18 Bit UNIBUS Address
   679					;++
   680					; FUNCTIONAL DESCRIPTION:
   681					;
   682					;	Convert given address doubleword (mapping bias and
   683					;	virtual address) to an 18-bit UNIBUS physical address.
   684					;
   685					; CALLING SEQUENCE:
   686					;
   687					;	CALL	$PHY18
   688					;
   689					; INPUT PARAMETERS:
   690					;
   691					;	R2 = Relocation bias.
   692					;	R3 = Virtual address.
   693					;
   694					; IMPLICIT INPUTS:
   695					;
   696					;	None
   697					;
   698					; OUTPUT PARAMETERS:
   699					;
   700					;	R2 = Bits 16 thru 17 of the UNIBUS address in bits 0 and 1.
   701					;	     The rest of the word is zero.
   702					;	R3 = Low order 16 bits of the UNIBUS address.
   703					;
   704					; IMPLICIT OUTPUTS:
   705					;
   706					;	None
   707					;
   708					; CONDITION CODES:
   709					;
   710					;	None
   711					;
   712					; SIDE EFFECTS:
   713					;
   714					;	None
   715					;--
   716
   717		000456'				.PSECT	$CODE$,I,RO
   718	000456'	010346			$PHY18::MOV	R3,-(SP)	; Save address
   719	000460'	042703	017777			BIC	#^C<160000>,R3	; isolate page bits
   720	000464'	040316				BIC	R3,(SP)		; and remove.
   721	000466'	022703	140000			CMP	#140000,R3	; if not in APR6
   722	000472'	001402				BEQ	10$		; then
   723	000474'	050316				BIS	R3,(SP)		; assume in DSR
   724	000476'	005002				CLR	R2		; with no bias.
   725	000500'	011603			10$:	MOV	(SP),R3		; Get bits 12 to 6
   726	000502'	072327	177772			ASH	#-6,R3		; without sign
   727	000506'	042703	176000			BIC	#^C1777,R3	; and
   728	000512'	060203				ADD	R2,R3		; add to bias.
   729	000514'	012702	000000G			MOV	#.UBMTA,R2	; Unibus mapping data base pointer
   730	000520'	011202			15$:	MOV	(R2),R2		; Next data base entry
   731	000522'	001414				BEQ	50$		; Assume unibus mapping turned off
   732	000524'	020362	000002			CMP	R3,2(R2)	; Low memory limit
   733	000530'	103773				BLO	15$		; Under lower limit. Assume DSR
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 14-1
CEXSUB.M11    30-DEC-82 00:33		$PHY18	- CONVERT BIAS/ADDRESS TO 18 BIT UNIBUS ADDRESS

   734	000532'	020362	000004			CMP	R3,4(R2)	; Upper limit
   735	000536'	103370				BHIS	15$		; Above upper limit. Try next
   736	000540'	166203	000002			SUB	2(R2),R3	; Relative to lower limit
   737	000544'	116202	000006			MOVB	6(R2),R2	; Base unibus mapping register.
   738	000550'	072227	000007			ASH	#7,R2		; Shift to right position
   739	000554'	060302			50$:	ADD	R3,R2		; Remainder is block number in UBA
   740	000556'	012603				MOV	(SP)+,R3	; Get address back
   741	000560'	072327	000012			ASH	#12,R3		; put bits 5 to 0 in top half
   742	000564'	073227	177766			ASHC	#-12,R2		; and pull back down with bias.
   743	000570'	000207				RETURN
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 15
CEXSUB.M11    30-DEC-82 00:33		$RND	- GET A RANDOM NUMBER

   745						.SBTTL	$RND	- Get a Random Number
   746					;++
   747					; FUNCTIONAL DESCRIPTION:
   748					;
   749					;	Provide a random integer from a uniform distribution on the
   750					;	interval between 0 (closed) and n (open).
   751					;
   752					; CALLING SEQUENCE:
   753					;
   754					;	CALL	$RND
   755					;
   756					; INPUT PARAMETERS:
   757					;
   758					;	R0 = upper limit (n).
   759					;
   760					; IMPLICIT INPUTS:
   761					;
   762					;	None
   763					;
   764					; OUTPUT PARAMETERS:
   765					;
   766					;	R0 = random integer.
   767					;
   768					; IMPLICIT OUTPUTS:
   769					;
   770					;	None
   771					;
   772					; CONDITION CODES:
   773					;
   774					;	None
   775					;
   776					; SIDE EFFECTS:
   777					;
   778					;	None
   779					;--
   780
   781		000572'				.PSECT	$CODE$,I,RO
   782	000572'	   001			$RND::	.IF	NE,D$$BUG
   783						TST	R0		; (crash if invalid interval)
   784						BLE	100$
   785						.IFTF
   786
   787	000572'					SAV5$S
   788	000576'	012705	000000G			MOV	#.RND,R5	; Get address of seed
   789	000602'	012503				MOV	(R5)+,R3	; pick up seed
   790	000604'	011504				MOV	(R5),R4		; and
   791	000606'	006304				ASL	R4		; multiply by 200003 = 65539.
   792	000610'	006103				ROL	R3		; (a prime number)
   793	000612'	061504				ADD	(R5),R4
   794	000614'	005503				ADC	R3
   795	000616'	061503				ADD	(R5),R3
   796	000620'	064503				ADD	-(R5),R3
   797	000622'	042703	100000			BIC	#100000,R3	; Make it positive
   798	000626'	010325				MOV	R3,(R5)+	; and save it
   799	000630'	010415				MOV	R4,(R5)		; as the new seed.
   800	000632'					PUSH$S	R0
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 15-1
CEXSUB.M11    30-DEC-82 00:33		$RND	- GET A RANDOM NUMBER

   801	000634'	006304				ASL	R4
   802	000636'	006103				ROL	R3
   803	000640'	010402				MOV	R4,R2		; Copy multiplicand.
   804	000642'	010301				MOV	R3,R1
   805	000644'	005000				CLR	R0
   806	000646'	012705	000020			MOV	#16.,R5
   807	000652'	006316			10$:	ASL	(SP)
   808	000654'	005305				DEC	R5
   809	000656'	103375				BCC	10$
   810	000660'	001412				BEQ	80$
   811	000662'	006302			20$:	ASL	R2		; Multiply by 2.
   812	000664'	006101				ROL	R1
   813	000666'	006100				ROL	R0
   814	000670'	006316				ASL	(SP)		; Check multiplier
   815	000672'	103004				BCC	30$		; and if bit set
   816	000674'	060402				ADD	R4,R2		; then add multiplicand
   817	000676'	005501				ADC	R1		; to result.
   818	000700'	060301				ADD	R3,R1
   819	000702'	005500				ADC	R0
   820	000704'	077512			30$:	SOB	R5,20$
   821	000706'				80$:	POP$S	,1
   822	000710'	000207				RETURN
   823
   824						.IFT
   825					100$:	CRSH$S	RND		; Invalid random number interval
   826		   000				.ENDC
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 16
CEXSUB.M11    30-DEC-82 00:33		$IDSTS	- IDENTIFY A STATUS VALUE FROM A TABLE

   828						.SBTTL	$IDSTS	- Identify a Status Value from a Table
   829					;++
   830					; FUNCTIONAL DESCRIPTION:
   831					;
   832					;	Locate the given BLISS status code in a table and return
   833					;	an index into that table.  Fields STS$V_COND_ID and
   834					;	STS$V_CUST_DEF are compared.
   835					;
   836					;
   837					; CALLING SEQUENCE:
   838					;
   839					;	CALL	$IDSTS
   840					;
   841					; INPUT PARAMETERS:
   842					;
   843					;	R0 = address of plit of status codes
   844					;	R1 = value to compare
   845					;
   846					; IMPLICIT INPUTS:
   847					;
   848					;	None
   849					;
   850					; OUTPUT PARAMETERS:
   851					;
   852					;	R0 = 0 (if no match)
   853					;	     index into table + 1 (if match)
   854					;
   855					; IMPLICIT OUTPUTS:
   856					;
   857					;	None
   858					;
   859					; CONDITION CODES:
   860					;
   861					;	None
   862					;
   863					; SIDE EFFECTS:
   864					;
   865					;	None
   866					;--
   867
   868		000712'				.PSECT	$CODE$,I,RO
   869	000712'				$IDSTS::SAV2$S
   870	000716'	010046				MOV	R0,-(SP)
   871	000720'	016002	177776			MOV	-2(R0),R2
   872	000724'	001410				BEQ	20$
   873	000726'	042701	040007			BIC	#^C<137770>,R1
   874	000732'	012046			10$:	MOV	(R0)+,-(SP)
   875	000734'	042716	040007			BIC	#^C<137770>,(SP)
   876	000740'	022601				CMP	(SP)+,R1
   877	000742'	001402				BEQ	30$
   878	000744'	077206				SOB	R2,10$
   879	000746'	011600			20$:	MOV	(SP),R0
   880	000750'	162600			30$:	SUB	(SP)+,R0
   881	000752'	006200				ASR	R0
   882	000754'	000207				RETURN
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 17
CEXSUB.M11    30-DEC-82 00:33		$IDVAL	- IDENTIFY A VALUE FROM A TABLE

   884						.SBTTL	$IDVAL	- Identify a Value from a Table
   885					;++
   886					; FUNCTIONAL DESCRIPTION:
   887					;
   888					;	Locate the given value in a table and return an index
   889					;	into that table.
   890					;
   891					; CALLING SEQUENCE:
   892					;
   893					;	CALL	$IDVAL
   894					;
   895					; INPUT PARAMETERS:
   896					;
   897					;	R0 = address of plit of values to match
   898					;	R1 = value to compare
   899					;
   900					; IMPLICIT INPUTS:
   901					;
   902					;	None
   903					;
   904					; OUTPUT PARAMETERS:
   905					;
   906					;	R0 = 0 (if no match)
   907					;	     index into table + 1 (if match)
   908					;
   909					; IMPLICIT OUTPUTS:
   910					;
   911					;	None
   912					;
   913					; CONDITION CODES:
   914					;
   915					;	None
   916					;
   917					; SIDE EFFECTS:
   918					;
   919					;	None
   920					;--
   921
   922		000756'				.PSECT	$CODE$,I,RO
   923	000756'				$IDVAL::SAV2$S
   924	000762'	010046				MOV	R0,-(SP)
   925	000764'	016002	177776			MOV	-2(R0),R2
   926	000770'	001403				BEQ	20$
   927	000772'	020120			10$:	CMP	R1,(R0)+
   928	000774'	001402				BEQ	30$
   929	000776'	077203				SOB	R2,10$
   930	001000'	011600			20$:	MOV	(SP),R0
   931	001002'	162600			30$:	SUB	(SP)+,R0
   932	001004'	006200				ASR	R0
   933	001006'	000207				RETURN
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 18
CEXSUB.M11    30-DEC-82 00:33		$VIR18	- CONVERT 18 BIT UNIBUS ADDRESS TO BIAS/ADDRESS

   935						.SBTTL	$VIR18	- Convert 18 Bit UNIBUS Address to Bias/Address
   936					;++
   937					; FUNCTIONAL DESCRIPTION:
   938					;
   939					;	Convert given 18-bit UNIBUS physical address to a virtual address
   940					;	relative to the current KISAR6 mapping bias.
   941					;
   942					; CALLING SEQUENCE:
   943					;
   944					;	CALL	$VIR18
   945					;
   946					; INPUT PARAMETERS:
   947					;
   948					;	R0 = Bits 16 thru 17 of the UNIBUS address in bits 0 and 1.
   949					;	     The rest of the word is zero.
   950					;	R1 = Low order 16 bits of the UNIBUS address.
   951					;
   952					; IMPLICIT INPUTS:
   953					;
   954					;	None
   955					;
   956					; OUTPUT PARAMETERS:
   957					;
   958					;	R0 = Virtual address.
   959					;
   960					; IMPLICIT OUTPUTS:
   961					;
   962					;	None
   963					;
   964					; CONDITION CODES:
   965					;
   966					;	C-bit clear = virtual address relative to KISAR6
   967					;	C-bit set =   Unibus address could not be mapped relative
   968					;		      to the current KISAR6.
   969					;
   970					; SIDE EFFECTS:
   971					;
   972					;	Register R1 is not preserved.
   973					;--
   974						.GLOBL	KISAR6
   975
   976		001010'				.PSECT	$CODE$,I,RO
   977	001010'	005767	000000G		$VIR18::TST	.UBMTA		; Is Unibus mapping in effect
   978	001014'	001415				BEQ	10$		; No
   979	001016'	073027	000003			ASHC	#3,R0		; Unibus mapping register number
   980	001022'	072027	000002			ASH	#2,R0		; Relative Unibus mapping reg address
   981	001026'	072127	177775			ASH	#-3,R1		; Address relative to UBMR.
   982	001032'	042701	160000			BIC	#160000,R1	; Clear hi bits
   983	001036'	066001	000000G			ADD	UBMPR(R0),R1	; Add low order physical (UBMR) address
   984	001042'	016000	000002G			MOV	UBMPR+2(R0),R0	; High order physical address
   985	001046'	005500				ADC	R0		; Add carry from above
   986	001050'	073027	000012		10$:	ASHC	#16.-6,R0	; Get bias
   987	001054'	163700	000000G			SUB	@#KISAR6,R0	; and block offset.
   988	001060'	100410				BMI	80$		; if
   989	001062'	022700	000200			CMP	#200,R0		; within range
   990	001066'	101405				BLOS	80$		; then
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 18-1
CEXSUB.M11    30-DEC-82 00:33		$VIR18	- CONVERT 18 BIT UNIBUS ADDRESS TO BIAS/ADDRESS

   991	001070'	062700	001400			ADD	#1400,R0	; place in APR6
   992	001074'	073027	000006		70$:	ASHC	#6.,R0		; to get virtual address.
   993	001100'	000207				RETURN
   994	001102'	063700	000000G		80$:	ADD	@#KISAR6,R0	; (not in APR6)
   995	001106'	052700	176000			BIS	#176000,R0	; Force carry
   996	001112'	000770				BR	70$
   997
   998		000001				.END
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 19
CEXSUB.M11    30-DEC-82 00:33		CROSS REFERENCE TABLE -- USER SYMBOLS

C.BUF   000016        	  532	  533
C.CHN   000002        	  536
C.CNT   000022        	  530
D$$BUG= 000000        	  303	  360	  521	  588	  656	  782
KISAR5= ****** G      	   81#	  523	  525*	  539*	  595	  597*	  603*	  663	  665*	  671*
KISAR6= ****** G      	  532#*	  974#	  987	  994
S.PARM= 000010        	  522#	  524	  525	  787#	  869#	  923#
UBMPR = ****** GX     	  983	  984
$ADD32  000000RG   002	  136#
$ASH32  000006RG   002	  179#
$CMQIF  000022RG   002	  303#
$CMQIN  000070RG   002	  360#
$CMQRM  000136RG   002	  415#
$CNV22  000160RG   002	  464#
$CPTBF  000232RG   002	  521#
$DIV32  000012RG   002	  222#
$IDSTS  000712RG   002	  869#
$IDVAL  000756RG   002	  923#
$MUL32  000016RG   002	  263#
$MVFBF  000332RG   002	  587#
$MVTBF  000404RG   002	  655#
$PHY18  000456RG   002	  718#
$RND    000572RG   002	  782#
$SAVE2= ****** G      	  869#	  923#
$SAVE4= ****** G      	  522#
$SAVE5= ****** G      	  787#
$VIR18  001010RG   002	  977#
.RND  = ****** G      	   95#	  788
.UBMTA= ****** GX     	  729	  977
CEXSUB - COMM/EXEC MISCELLANEOUS SUPPORT ROUTINES	DNMAC X24.07-563  28-MAY-85  14:23  PAGE 20
CEXSUB.M11    30-DEC-82 00:33		CROSS REFERENCE TABLE -- MACRO NAMES

CCBCK$	  303	  360	  521
CRSH$S	   80#
MAP$	  532
POP$S	  315	  320	  372	  475	  539	  603	  671	  821
PUSH$S	  311	  366	  464	  523	  595	  663	  800
SAV2$S	  869	  923
SAV4$S	  522
SAV5$S	  787


. ABS.  000000     000	   CON   RW    ABS   LCL   I  
        000000     001	   CON   RW    REL   LCL   I  
$CODE$  001114     002	   CON   RO    REL   LCL   I  


 ERRORS DETECTED:  0
 DEFAULT GLOBALS GENERATED:  2

 CEXSUB,CEXSUB/CR=MCB:RSXLIB/PA:1,MCBLIB/PA:1,CEX:CEXLIB/PA:1,CEXSUB
 RUN-TIME: 4 2 .2 SECONDS
 RUN-TIME RATIO: 40/7=5.5
 CORE USED:  15K  (29 PAGES)