From: Nate Eldredge Newsgroups: comp.os.msdos.djgpp Subject: Re: I just got Allegro 3.925 for Windows working... Date: Fri, 08 Oct 1999 13:21:11 -0700 Organization: Harvey Mudd College Lines: 27 Message-ID: <37FE5237.3EBCB7FF@hmc.edu> References: <000201bf11b3$1e7893a0$ae3d7a86 AT phoenix DOT com> NNTP-Posting-Host: mercury.st.hmc.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: nntp1.interworld.net 939414109 63293 134.173.45.219 (8 Oct 1999 20:21:49 GMT) X-Complaints-To: usenet AT nntp1 DOT interworld DOT net NNTP-Posting-Date: 8 Oct 1999 20:21:49 GMT X-Mailer: Mozilla 4.61 [en] (X11; U; Linux 2.2.13pre12 i586) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Johnny Chan wrote: > > How can I find out in my program the start location (physical address) and > the size of itself? I want to show the size of the program and its starting > address on the screen, how can I do it? AFAIK, you can't get the physical address of the start of your program. The mapping between the virtual memory your program sees and physical memory is not fixed, so even if you did get an address, it would be instantly obsolete. The size, however, is fairly possible (note that it will be the virtual size). A reasonable heuristic (I think) is `(((unsigned long)sbrk(0)) - 0x1000)'. This might be inaccurate in some cases, but I think it should yield a ballpark figure. > Also, I wonder what exe file format DJGPP is used? My program need to browse > thru its PSP to look for some useful informaton, Any suggestion to do that? > Where to get the file format of DJGPP executable? The format is called COFF; DJGPP prepends a small .exe stub to allow DOS to run it. The spec of the COFF format is (I think) somewhere on www.delorie.com; the FAQ may have a pointer. -- Nate Eldredge neldredge AT hmc DOT edu