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>get free memory information</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
        Get Free Memory Information


                 This  function  is  provided  so  that  protected  mode
                 applications  can   determine  how   much   memory   is
                 available.   Under DPMI  implementations  that  support
                 virtual memory, it is important to consider issues such
                 as the amount of available physical memory.

                 Note that  since DPMI  applications will  often run  in
                 multi-tasking  environments,   this  function  must  be
                 considered only advisory.

            To Call

                 AX = 0500h
                 ES:(E)DI = Selector:Offset of 30h byte buffer

            Returns

                 If function was successful:
                 Carry flag is clear.
                 ES:(E)DI = Selector:Offset of buffer with the following
                      structure:



                       Offset           Description

                        00h   Largest available free block in
                       bytes

                        04h   Maximum unlocked page allocation

                        08h    Maximum locked page allocation

                        0Ch   Linear addr space size in pages

                        10h    Total number of unlocked pages

                        14h         Number of free pages

                        18h    Total number of physical pages

                        1Ch  Free linear address space in pages

                        20h   Size of paging file/partition in
                       pages




                       24h-2Fh            Reserved





                 If function was not successful:
                 Carry flag is set.




            Programmer's Notes

                 o    32-bit programs  must use  ES:EDI to  point to the
                      buffer.  16-bit programs should use ES:DI.
                 o    DPMI implementations  that do  not support virtual
                      memory (returned  in flags  from Get Version call)
                      will only  fill in  the first  field.   This value
                      specifies that  largest allocation  that could  be
                      made using  function 0501h.   Other fields will be
                      set to -1.
                 o    Only  the   first  field   of  this  structure  is
                      guaranteed to  contain a  valid value.  All fields
                      that are  not returned  by the DPMI implementation
                      will be  set to  -1 (0FFFFFFFFh)  to indicate that
                      the information is not available.
                 o    The field  at offset  00h  specifies  the  largest
                      block of  contiguous linear  memory in  bytes that
                      could be  allocated  if  the  memory  were  to  be
                      allocated and left unlocked.
                 o    The field  at offset  04h specifies  the number of
                      pages that  could be allocated.  This is the value
                      returned by field 00h / page size.
                 o    The field  at offset  08h  specifies  the  largest
                      block of  memory in  pages that could be allocated
                      and then locked.
                 o    The field  at offset 0Ch specifies the size of the
                      total  linear   address  space  in  pages.    This
                      includes all linear address space that has already
                      been allocated.
                 o    The field at offset 10h specifies the total number
                      of pages  that are currently unlocked and could be
                      paged out.   This  value also  contains  any  free
                      pages.
                 o    The field  at offset  14h specifies  the number of
                      physical pages that currently are not in use.
                 o    The field at offset 18h specifies the total number
                      of physical  pages that  the  DPMI  host  manages.
                      This value includes all free, locked, and unlocked
                      physical pages.
                 o    The field  at offset 20h specifies the size of the
                      DPMI host's paging partition or file in pages.
                 o    To determine  the size  of pages for the DPMI host
                      call the Get Page Size service (see function 0B03H).

See Also: INT 31H Function 0B03H

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