.NLIST TOC,SYM .TITLE $RQVCB .SBTTL ULBLIB 020 - Request Virtual Core Block .IDENT \V01.00\ .PSECT .LIBC. .ENABL LC,GBL ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only with the ; inclusion of the above copyright notice. This software, or ; any other copies thereof, may not be provided or otherwise ; made available to any other person except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. ;+ ; $RQVCB ; This routine is called to allocate space from virtual memory. The ; allocation request is rounded up to the nearest word boundary. If the ; rounded value crosses a disk block boundary, the allocation begins at ; next block. Note that virtual addresses are word values. ; ; R1 = size of the request (<=512.) ; $HGVAD = next free virtual address ; ; CALL $RQVCB ; ; C-bit = 0 => success ; R0, R1 = disk address of the allocated page ; R2 = next free virtual address ; $HGVAD = next free virtual address ; ; C-bit = 1 => request failed because ; 1) request exceeded 512. bytes, or ; 2) virtual storage exhausted. ; R0, R1, R2 = random ;- $RQVCB:: MOV R1,R2 ;Save length MOV $HGVAD,R1 ;Get highest virtual address BEQ 2$ ;If equal, no space left CLC ;Clear carry ROR R2 ;Do unsigned divide ADC R2 ;Round up to nearest word CMP R2,#256. ;Check length of request BHI 2$ ;Branch if too big DEC R2 ;Back off size by one MOV R1,R0 ;Copy free address ADD R2,R0 ;Compute last address in allocation BCS 3$ ;Branch if address space overflow CLRB R0 ;Clear displacement into block CMP R0,R1 ;See if crossing block boundry BLOS 1$ ;Branch if not MOV R0,R1 ;Set virtual address 1$: INC R2 ;Convert back to length ADD R1,R2 ;Compute next free address MOV R2,$HGVAD ;Update free address TST (PC)+ ;Set success 2$: SEC ;Set failure 3$: RETURN .END