🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.ibm.pc.programmer
2 messages
2 total messages Started by Roggie Boone Fri, 09 Oct 1992 20:49
Determining Extended memory size in C program
#1071
Author: Roggie Boone
Date: Fri, 09 Oct 1992 20:49
36 lines
1715 bytes
I am trying to include code in my C program that will report the
amount of memory on a computer (Conventional, EMS, Extended).
I can use the Turbo C built-in function biosmemory() to get 
conventional memory.  I am having trouble with extended
memory.  I am trying to use BIOS INT 15 Function 88 for this.

The relevant subsection of my code is as follows:

	union REGS regs;

	basemem = biosmemory();    // reports 640K 

	_AH = 0x88;
	int86(0x15, &regs, &regs);
	cout << "Extended memory: " << _AX << endl;

My system has 7168K extended memory.  However, when I run the
code above it prints out "Extended memory: 34368".  According to
the documention I have, _AX should contain the number of K of
extended memory as reported by POST.  Thus I would expect, 
to see "7168" in AX.  Am I missing some conversion or something in 
there?

Thanks in advance for your help.

R. Boone
boone@athena.cs.uga.edu




-- 
Roggie Boone
Computer Support Staff                    Internet:  boone@athena.cs.uga.edu     
Dept. of Ag and Applied Economics         Internet:  roggie@aisun1.cs.uga.edu
University of Georgia                     Phone:  (706) 542-2482
Re: Determining Extended memory size in C program
#1072
Author: Ken Ballou
Date: Sat, 10 Oct 1992 01:06
12 lines
924 bytes
I think you might have better luck with:

	cout << "Extended memory: " << regs.x.ax << endl;

Using _AX instead of regs.x.ax means you write whatever is in register AX
after you evaluate cout << "Extended memory: " (in fact, that should be the
address of cout).

					- Ken
--
Kenneth R. Ballou			ballou@vmsdev.enet.dec.com
Digital Equipment Corporation		...!decwrl!vmsdev.enet!ballou
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads