ALSVB	MACRO M1110  22-AUG-78 01:39  PAGE 2





      1						.TITLE	ALSVB

      2						.IDENT	/01/

      3

      4					;

      5					; COPYRIGHT   1976,  DIGITAL  EQUIPMENT  CORP.,  MAYNARD,   MASS.

      6					;

      7					; THIS SOFTWARE IS FURNISHED TO PURCHASER UNDER A LICENSE FOR USE

      8					; ON A SINGLE COMPUTER SYSTEM  AND  CAN BE COPIED (WITH INCLUSION

      9					; OF DEC'S COPYRIGHT NOTICE)  ONLY FOR USE IN SUCH SYSTEM, EXCEPT

     10					; AS MAY OTHERWISE BE PROVIDED IN WRITING BY DEC.

     11					;

     12					; THE INFORMATION IN  THIS DOCUMENT IS  SUBJECT TO CHANGE WITHOUT

     13					; NOTICE AND SHOULD NOT  BE CONSTRUED AS  A COMMITMENT BY DIGITAL

     14					; EQUIPMENT CORPORATION.

     15					;

     16					; DEC ASSUMES  NO  RESPONSIBILITY  FOR  THE  USE  OR  RELIABILITY

     17					; OF ITS  SOFTWARE  ON  EQUIPMENT  WHICH IS NOT  SUPPLIED BY DEC.

     18					;

     19					; VERSION 01

     20					;

     21					; C. MONIA 05-MAR-75

     22					;

     23					; ALLOCATE SMALL VIRTUAL CORE BLOCK

     24					;

     25					; LOCAL DATA

     26					;

     27					; OFFSET INTO CURRENT LARGE BLOCK

     28					;

     29

     30	000000				BLOFF:	.BLKW	1		;

     31

     32					;

     33					; VIRTUAL ADDRESS OF CURRENT LARGE BLOCK

     34					;

     35

     36	000002				BLVAD:	.BLKW	1		;

     37

     38					;+

     39					; **-$ALSVB-ALLOCATE SMALL VIRTUAL CORE BLOCK

     40					;

     41					; THE PURPOSE OF THIS SUBROUTINE IS TO ALLOCATE SMALL BLOCKS OF

     42					; VIRTUAL MEMORY WITHOUT EXCESSIVE FRAGMENTATION AND WASTED VIRTUAL

     43					; ADDRESS SPACE WHEN HIGHLY DIVERGENT ALLOCATION SIZES ARE ENCOUNTERED

     44					;

     45					; INPUTS:

     46					;

     47					;	R1=SIZE OF BLOCK TO ALLOCATE IN BYTES

     48					;

     49					; THIS ROUTINE MUST BE CALLED INITIALLY WITH A VALUE OF ZERO IN

     50					; R1 TO FORCE THE ALLOCATION OF THE FIRST LARGE BLOCK. THE SIZE MAY

     51					; NOT EXCEED THE SIZE OF A LARGE BLOCK

     52					;

     53					;

     54					; OUTPUTS:

     55					;

     56					;	R0=REAL ADDRESS OF BLOCK

     57					;	R1=VIRTUAL ADDRESS OF BLOCK

ALSVB	MACRO M1110  22-AUG-78 01:39  PAGE 2-1





     58					;

     59					; PAGE CONTAINING BLOCK IS WRITE-MARKED

     60					;

     61					;

     62					; R3 - R5 ARE PRESERVED

     63					;

     64					; THE ROUTINE INITIALLY ALLOCATES A BLOCK OF SIZE N$DLGH, PERFORMS

     65					; THE SUB-ALLOCATION THEN RETURNS CONTROL TO THE CALLER. SUBSE-

     66					; QUENT CALLS CAUSE ADDITIONAL BLOCKS TO BE ALLOCATED UNTIL

     67					; SPACE WITHIN THE LARGE BLOCK IS EXHAUSTED. A NEW LARGE BLOCK

     68					; IS THEN ALLOCATED.

     69					;

     70					;-

     71

     72	000004				$ALSVB::			;

     73	000004	005201 				INC	R1		; ROUND BLOCK SIZE TO WORD BOUNDARY

     74	000006	006201 				ASR	R1		; CONVERT TO WORDS

     75	000010	001422 				BEQ	10$		; IF EQ, FIRST CALL

     76	000012	016702 	177762 			MOV	BLOFF,R2	; GET CURRENT OFFSET INTO BLOCK

     77	000016	060102 				ADD	R1,R2		; UPDATE CURRENT OFFSET

     78	000020	020227 	000000C			CMP	R2,#N$DLGH/2	; ALLOCATION EXCEED REMAINING SPACE?

     79	000024	101014 				BHI	10$		; IF HI YES

     80	000026	010267 	177746 			MOV	R2,BLOFF	; SAVE OFFSET INTO BLOCK

     81	000032	016700 	177744 			MOV	BLVAD,R0	; GET VIRTUAL BLOCK ADDRESS

     82	000036	060167 	177740 			ADD	R1,BLVAD	; UPDATE VIRTUAL ADDRESS

     83	000042	010001 				MOV	R0,R1		; SET ADDRESS

     84	000044					CALL	$CVRL		; CONVERT TO REAL

     85	000050					CALL	$WRMPG		; WRITE-MARK PAGE

     86	000054	000413 				BR	20$		;

     87	000056				10$:				;

     88	000056	010167 	177716 			MOV	R1,BLOFF	; SET BLOCK OFFSET

     89	000062	012701 	000000G			MOV	#N$DLGH,R1	; GET SIZE OF LARGE BLOCK

     90	000066					CALL	$ALVRT		; ALLOCATE VIRTUAL MEMORY

     91	000072	010167 	177704 			MOV	R1,BLVAD	; SAVE VIRTUAL ADDRESS

     92	000076	066767 	177676 	177676 		ADD	BLOFF,BLVAD	; POINT TO NEXT FREE VIRTUAL ADDRESS

     93	000104				20$:				;

     94	000104					RETURN			;

     95

     96		000001 				.END

ALSVB	MACRO M1110  22-AUG-78 01:39  PAGE 2-2

SYMBOL TABLE



BLOFF   000000R  	FF    = 000014   	N$DLGH= ****** GX	VT    = 000013   	$CVRL = ****** GX

BLVAD   000002R  	HT    = 000011   	R$$11M= 000000   	$ALSVB  000004RG 	$WRMPG= ****** GX

CR    = 000015   	LF    = 000012   	SPA   = 000040   	$ALVRT= ****** GX	$$    = 000001



. ABS.	000000	   000

      	000106	   001

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  590 WORDS  ( 3 PAGES)

DYNAMIC MEMORY:  2772 WORDS  ( 10 PAGES)

ELAPSED TIME:  00:00:06

OBJ$:ALSVB,LIS$:ALSVB/-SP=SRC$:MACFLM,ALSVB

