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 Protected Mode Interface - <b>allocate memory block</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
        Allocate Memory Block


                 This function allocates and commits linear memory.

            To Call

                 AX = 0501h
                 BX:CX = Size of memory block to allocate in bytes

            Returns

                 If function was successful:
                 Carry flag is clear
                 BX:CX = Linear address of allocated memory block
                 SI:DI = Memory block handle (used to resize and free)

                 If function was unsuccessful:
                 Carry flag is set

            Programmer's Notes

                 o    This function  does not allocate any selectors for
                      the memory block.  It is the responsibility of the
                      caller to  allocate and  initialize any  selectors
                      needed to access the memory.
                 o    Under DPMI  implementations that  support  virtual
                      memory  the   memory  block   will  be   allocated
                      unlocked.   If some or all of the memory should be
                      locked you  will  need  to  use  either  the  lock
                      selector  function   or  the  lock  linear  region
                      function.
                 o    Under many  implementations of  DPMI,  allocations
                      will  be  page  granular.    This  means  that  an
                      allocation  of  1001h  bytes  will  result  in  an
                      allocation of  2000h bytes.   Therefore it is best
                      to always allocate memory in multiples of 4K.

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