Mail Archives: djgpp/2000/06/01/23:00:32
From: | "AndrewJ" <luminous-is AT home DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
References: | <393682e4$0$81880 AT SSP1NO17 DOT highway DOT telekom DOT at>
|
Subject: | Re: DPMI
|
Lines: | 48
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 5.00.2919.6600
|
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2919.6600
|
Message-ID: | <8gyZ4.135421$55.2869837@news2.rdc1.on.home.com>
|
Date: | Thu, 01 Jun 2000 18:50:44 GMT
|
NNTP-Posting-Host: | 24.42.120.18
|
X-Complaints-To: | abuse AT home DOT net
|
X-Trace: | news2.rdc1.on.home.com 959885444 24.42.120.18 (Thu, 01 Jun 2000 11:50:44 PDT)
|
NNTP-Posting-Date: | Thu, 01 Jun 2000 11:50:44 PDT
|
Organization: | @Home Network Canada
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hi Florian,
> There are some dpmi funktions, which tell me how many memory is free
> (physical and virtual). But how can I know, how much memory has the
> computer? Is there a funktion?
You might try try INT 31h/0500h, dpmi get free memory information.
/* %DJDIR%/include/dpmi.h, line 189 */
int __dpmi_get_free_memory_information(__dpmi_free_mem_info *_info);
If you multiply the value in
__dpmi_free_mem_info.total_number_of_physical_pages by 4096 (the size of a page
in bytes), you should get the total amount of physical memory available (note:
not the total amount of physical memory free).
/* dpmipmem.c - gcc -Wall -o dpmipmem.exe dpmipmem.c */
/* a small example demonstrating how to get the total/free amount of physical
memory */
#include <stdio.h>
#include <dpmi.h>
int main(void)
{
__dpmi_free_mem_info info;
/* should probably check the return code, but... */
__dpmi_get_free_memory_information(&info);
printf("%ld bytes physical memory (%ld pages)\n",
info.total_number_of_physical_pages * 4096,
info.total_number_of_physical_pages);
printf("%ld bytes total free space (%ld pages)\n",
info.total_number_of_free_pages * 4096,
info.total_number_of_free_pages);
return(0);
}
This gives me 66273280 and 49610752 respectively, which is right for my 64MB
machine with 49 mb or so of DPMI memory available (set through the
properties/memory page for the DOS window).
AndrewJ
- Raw text -