Pages

Friday, February 13, 2009

Reading the memory size

In the older post I have told that the memory size of the RAM is calculated during the RAM test performed during the Booting. The size of the RAM is stored in the memory location 0x413 and 0x414. Here is a C program which calculates the memory size of your RAM in KB. The limitation of this program is that it shows the memory size excluding the expanded and extended memory. It only shows size only up to 640 KB. If you are using the RAM which has more capacity, it shows the 640 as your RAM size. The program is shown below:


#include
#include

void main()
{
int far* mem;
mem=(int far*)0x413;
printf("\nBase memory size=%u KB",*mem);
getch();
}

There is another way to find out the RAM size. This way also have the above mentioned limitations. The below is a CPP program which calculates the RAM size by using the function biosmemory().


#include
#include
#include

void main()
{
int mem;
mem=biosmemory();
cout<<"The size of your RAM is:"<getch();
}

Note that the output of the program is limited to 640 KB

No comments:

Post a Comment