Page 1 of 1

Detecting amount of RAM?

Posted: Sun Jan 11, 2004 12:00 am
by St8ic
I would like to have my OS display how much RAM the system has at startup, but I have no idea how to begin. Any tips or code? Thanks.

RE:Detecting amount of RAM?

Posted: Sun Jan 11, 2004 12:00 am
by PrzemekG_
There is a link to OS developement FAQ where you can find 2 examples.

RE:Detecting amount of RAM?

Posted: Sun Jan 11, 2004 12:00 am
by St8ic
Thanks alot. It was helpful in understanding more about what I'm doing, and I've decided to use the BIOS to detect the RAM. It has alot on doing that, but I can't quite get it to work right. int15 deals with getting the system memory map, where ECX is the "actual length returned in bytes". Can anyone help me call this properly? Thanks again!

(P.S. I've already enabled the A20 line)

RE:Detecting amount of RAM?

Posted: Tue Jan 20, 2004 12:00 am
by ~
invert every byte, check the result and invert it back.
if the result is wrong, there is no more ram.
start at 1MB because of the bios data. this sample only works in pmode.

RE:Detecting amount of RAM?

Posted: Tue Jan 20, 2004 12:00 am
by Dangermoose
Start at 1mb to avoid the bios. What about other holes in memory, you'd be writing data to them.
I had memory probing for my os to begin with, until it screwed my motherboard over.

Moose.

RE:Detecting amount of RAM?

Posted: Fri Jan 23, 2004 12:00 am
by bubach
but.... if you have enabled the A20 line, doesn´t that mean that u r
in p mode? and if thats correct, u can´t use the bios, or?

Detecting amount of RAM?

Posted: Thu Jan 29, 2004 12:00 am
by graphics in pm
inverting ram works in pmode with a20 enabled.
i dont't use the bios functions

RE:Detecting amount of RAM?

Posted: Thu Jan 29, 2004 12:00 am
by Karig
You can enable the A20 line from within real mode. This does not put you in protected mode.

RE:Detecting amount of RAM?

Posted: Thu Jan 29, 2004 12:00 am
by Gnome
If you use GRUB, it supplies this information in the Multiboot information structure.

Gnome