The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: HATEM on December 31, 2004, 10:23:50 PM

Title: How Can we Determin Memory Size?
Post by: HATEM on December 31, 2004, 10:23:50 PM

Hello everyone,

Can any one tell me how to get the memory size in the real mode?


Regards
Title: Re: How Can we Determin Memory Size?
Post by: MichaelW on December 31, 2004, 11:28:00 PM
You can download an example program from the old forum:

http://www.masmforum.com/viewtopic.php?t=3388

But as I noted in your "I need help" thread, this will not work under Windows 2000 or XP.

Title: Re: How Can we Determin Memory Size?
Post by: HATEM on January 01, 2005, 09:28:05 AM
Thank you for your reply. But as u said Interrupt 15h, Function E820h is not supported under Windows 2000/XP.So i dont think that this will help.
Title: Re: How Can we Determin Memory Size?
Post by: masmer on January 01, 2005, 11:32:51 AM

Microsoft Windows stores the size of the memory in offset 040:0413h but i am not very sure that it works all the time.I hope that i gave you some help.
Title: Re: How Can we Determin Memory Size?
Post by: masmer on January 01, 2005, 11:33:55 AM
Sorry i didnt mention that you must get a word size and convert the hex value to decimal which will give you the memory size in MB.
Title: Re: How Can we Determin Memory Size?
Post by: MichaelW on January 01, 2005, 10:15:50 PM
Quote from: HATEM on January 01, 2005, 09:28:05 AM
Thank you for your reply. But as u said Interrupt 15h, Function E820h is not supported under Windows 2000/XP.So i dont think that this will help.

For 2000/XP try  here (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/globalmemorystatusex.asp).