Detecting total RAM size via BIOS
From: Jeremy Harrison (jeremy_at_lava.net)
Date: 04/27/04
- Next message: Cameron Gibbs: "The Linear Address Space"
- Previous message: Robert Redelmeier: "Re: x86 architecture questions"
- Next in thread: Matt Taylor: "Re: Detecting total RAM size via BIOS"
- Reply: Matt Taylor: "Re: Detecting total RAM size via BIOS"
- Reply: Ivan Korotkov: "Re: Detecting total RAM size via BIOS"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 26 Apr 2004 22:31:21 +0000 (UTC)
In follow-up to the post below, I hope someone might be able to help me
with my problem. I am trying to write a routine that will return the size
of RAM on the host computer. I need it to run from a command prompt, and
I need it to work on each OS from Windows 95 through XP. As an analog,
WinMSD returns the wished for information (along with a lot of other stuff)
on machines that have WinMSD (2000/XP). I want to roll a "specialized"
application that will only return the total RAM size. I write my
routines in PC Assembly; my suspicion is that I can get RAM information
by peeking in at some port. I just haven't been able to determine which
one...
Albeit not RAM/memory related, the posting below made me think that
perhaps one of you may know of a method and port if not something even
simpler that I can use.
Thank you for your assistance!
Jeremy Harrison
#include <stdio.h> /* printf() */
#include <dos.h> /* peek(), peekb() */
int main(void) {
unsigned i = peek(0x40, 0x10); /* same as INT 11h */
if(i & 0x01) {
i = ((i / 64) & 0x03) + 1;
printf("%u floppy drive(s) detected\n", i); }
printf("%u hard drive(s) detected\n", peekb(0x40, 0x75));
return 0; }
- Next message: Cameron Gibbs: "The Linear Address Space"
- Previous message: Robert Redelmeier: "Re: x86 architecture questions"
- Next in thread: Matt Taylor: "Re: Detecting total RAM size via BIOS"
- Reply: Matt Taylor: "Re: Detecting total RAM size via BIOS"
- Reply: Ivan Korotkov: "Re: Detecting total RAM size via BIOS"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]