Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- DOS 5.0 Ref. - <b>function 48h allocate memory</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function 48h            Allocate Memory

    Allocates the requested amount of memory and returns the segment
    address of the allocated memory block.

        Entry   AH = 48h
                BX = Number of memory paragraphs to be allocated

        Return  AX = Segment address of allocated memory block
                or
                AX = Error code, if CF is set
                     | 07h Memory control blocks destroyed
                     | 08h Insufficient memory (BX = largest block)

    ------------------------------------------------------------------

    Function 48h dynamically allocates memory, in multiples of 16
    bytes (one paragraph). The amount of memory to be allocated, in
    paragraphs, is specified in BX. If the function is successful,
    AX:0000 points to the allocated memory block. (AX holds the
    segment address; the offset is always 0000.)

    The contents of the allocated memory are not defined.

    DOS allocates all available memory to a .COM program; most .EXE
    programs request all available memory when they load. If a program
    is to subsequently use the Allocate Memory function to dynamically
    allocate memory, it should use Set Memory Block Size (function
    4ah) to free as much memory as possible.

    The default memory-management strategy is to allocate the first
    available block that contains the requested number of bytes. A
    program can use function 5801h to change the way DOS chooses
    memory blocks for allocation.

See Also: 49h 4ah 5800h 5801h 59h

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson