[comp.sys.ibm.pc] MEM.COM problems: Finding DOS's segment?

dalegass@dalcs.UUCP (04/14/87)

A few problems have been reported with my MEM.COM program which showw a map
of the memory allocated by DOS.

I have used the /0 interrupt segment value to find the segment
in which DOS resides, in order to pick up relevant memory mapping parameters.

However, some people have complained the program has failed; this is due to
the fact that they are running or have installed some program which has
taken over or changed this /0 interrupt.

I'll assume that interrupt 3fh isn't used; it's one of the many that points
to a IRET instruction in DOS.  INT 3F is reserved for DOS, so it may be used in
later versions of DOS, and thus taken over by TSRs in the future...

MEM.COM can be patched to use this interrupt instead of the /0 interrupt 
as follows:

C:\>debug mem.com
-e118
xxxx:0119  02.FE  <- this 02 value is now changed to FEh, for seg of int 3fh
-w
xxxx bytes written
-q

This should fix the program when working with programs that take of /0.

Does anybody know a way to consistantly find DOS's segment?  
(Segment 012eh on DOS 3.1 for me)


Thanks,


***************************************************************************
Dale Gass, Dalhousie U., Halifax, N.S., Canada

UUCP:   {seismo|watmath|utai|garfield}!dalcs!dalegass.UUCP
     				       or dalegass@dalcs.UUCP
        ...!dalcs!dalcsug!dalegass.UUCP  or dalegass@dalcsug.UUCP
CDN:    dalegass@cs.dal.cdn
CSNET:  dalegass%cs.dal.cdn@ubc.csnet
ARPA:   dalegass%cs.dal.cdn%ubc.csnet@CSNET-RELAY.ARPA

mmm@gssc.UUCP (Preacher McLain) (04/16/87)

In article <2524@dalcs.UUCP> dalegass@dalcs.UUCP (Dale Gass) writes:
> [other stuff deleted]
>I have used the /0 interrupt segment value to find the segment
>in which DOS resides, in order to pick up relevant memory mapping parameters.
> [ditto]

	Try using Int 21h function 52h.  It returns the beginning of DOS's
memory map in Es.  This, of course, is undocumented and subject to change in
future DOS versions (the 3.x line, not the OS/2 line), but it's worked on 3.0,
3.1 and 3.2.  I'm not sure about 3.3, but I don't see any reason why it won't
work.
-- 
			       Mitchell McLain
		    ...hplabs!tektronix!sequent!gssc!EST