Page 1 of 1

An doubt about detecting amount of RAM

Posted: Fri Jul 16, 2010 2:52 pm
by nikito
Hi!

I have read the detecting memory page on the Osdev-wiki.
There are talking about using BIOS function, and use the E*X extended register in the some time. I miss a point here. Need to call BIOS trough protected mode? What directive have to use in NASM([bits 16] or [bits 32]) or some prefixes.

Thanks for the help!

Re: An doubt about detecting amount of RAM

Posted: Fri Jul 16, 2010 3:39 pm
by neon
Hello,

Typically the boot loader would pass this information to the operating system. If this is not possible, you may need to fall back to real mode or v86 mode in order to use the BIOS services for detecting memory.

Re: An doubt about detecting amount of RAM

Posted: Fri Jul 16, 2010 3:52 pm
by bewing
But the answer to your other question is that you use the "operand size prefix" in order to use extended registers when you are in real mode. NASM will know to put one in for you, and you do not need to do anything other than say "MOV EAX, 0xe820". You should be in "BITS 16" mode.

Re: An doubt about detecting amount of RAM

Posted: Fri Jul 16, 2010 4:10 pm
by nikito
Thanks guys!