News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

I Need Help

Started by HATEM, December 31, 2004, 09:31:52 PM

Previous topic - Next topic

HATEM


Hi everyone,

I saw an old program that finds the size of memory in MB by looking a word at the offset 0040:0413h in memory and converting the contents to decimal. I dont know how the programer knew that this offset has the memory size!!! the problem that i got this program from a friend and not from the internet but he doen't know why too. I searched in the internet for 3 hours and i couldnt find any information about it.Could you please help me ?

Regards

russian

You gave a 32-bit segment-offset adress, those are only used in DOS 16-bit programming. for win32 programming you should use GlobalMemoryStatus to get memory information. If you really want to know why the program you saw checks 0040:0413h then google for a memory map of memory in real-mode(1 mb), you can find one in the first chapters of 16-bit DOS assembly language books. It's probably a BIOS or ROM area that is used to store some computer configurations.

HATEM

The problem is that this memory address is not related to the bios at all after i looked of the bios memory. I dont know but maybe
that the OS is the one which stores the memory size in that address but I still cannot find any evidence for this. I really need to document where I get any information for my project thats why.

Regards

MichaelW

I think there is an error in the address. The BIOS data area is at segment address 40h, and the word at offset 13h stores the "base" memory size in KB.  For recent systems the value stored here is typically 640. Note that 40h:13h is absolute address 413h. There is a BIOS function that when called from a DOS program running under DOS or Window 9x can return information from which you can calculate a meaningful memory size (Interrupt 15h, Function E820h), but the function will not return any useful information under Windows 2000 or XP.
eschew obfuscation

pbrennick

HATEM,

40:13    word    Memory size in Kbytes  (see ~INT 12~)

INT 12 - Memory Size Determination
            no input data

on return:
            AX  = the number of contiguous 1k memory blocks found at startup
            - contiguous memory does not include video memory or extended RAM


This is from Ralf Brown's stuff.

Google - Ralf Brown

Paul