Detecting amount of RAM?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
St8ic

Detecting amount of RAM?

Post 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.
PrzemekG_

RE:Detecting amount of RAM?

Post by PrzemekG_ »

There is a link to OS developement FAQ where you can find 2 examples.
St8ic

RE:Detecting amount of RAM?

Post 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?

Post 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.
Dangermoose

RE:Detecting amount of RAM?

Post 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.
User avatar
bubach
Member
Member
Posts: 1224
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

RE:Detecting amount of RAM?

Post 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?
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
graphics in pm

Detecting amount of RAM?

Post by graphics in pm »

inverting ram works in pmode with a20 enabled.
i dont't use the bios functions
Karig

RE:Detecting amount of RAM?

Post by Karig »

You can enable the A20 line from within real mode. This does not put you in protected mode.
Gnome

RE:Detecting amount of RAM?

Post by Gnome »

If you use GRUB, it supplies this information in the Multiboot information structure.

Gnome
Post Reply