delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/19/01:50:14

From: firewind <firewind AT metroid DOT dyn DOT ml DOT org>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: how to convert real mode pointer into protected mode ?
Date: 19 Aug 1997 01:21:42 GMT
Organization: Netcom
Lines: 41
Message-ID: <5tasf6$cvc@dfw-ixnews12.ix.netcom.com>
References: <33F82B88 DOT 642 AT chem DOT uw DOT edu DOT pl>
NNTP-Posting-Host: elp-tx2-03.ix.netcom.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Wojciech Galazka <wgalazka AT chem DOT uw DOT edu DOT pl> wrote:
> I wonder if anyone could tell me the following
> I have a pair of ES:DI containing a real mode address.
> Under real mode DOS I'd write
> char *name = MK_FP(ES,DI);

> It seems to me that in protected mode the
> above address is equivalent to
> selector = _dos_ds
> offset = ES <<4+DI

> The question is, how having either real mode segment and offset,
> or protected mode selector and offset, create a
> char *name similar in spirit as MK_FP
> Something like 
> char *name =MK_FP(selector, offset)

> I've the read FAQ, parts 182. and 18.4 and found that
> <sys/farptr.h> or dosmemget/put aren't the ways to go.
> Any suggestions ?
> Could __dpmi_map_conventional_memory_in_memory_block be the answer?

I know very little about DOS stuff, having started with DJGPP. But, I do
know some. :)  Are you sure the _far* functions aren't what you want? For
example, here is the code to read the DOS InDOS flag:

	regs.h.ah = 0x34;
        __dpmi_int(0x21, &regs);
        es = regs.x.es;
        bx = regs.x.bx;

	/* ... */

	indos = _farpeekb(_dos_ds, es*16+bx);

The selector is always _dos_ds for RM stuff, the offset is segment*16+offset.

Of course, this is for read\writes of a single unit. If you need to r\w more
at once, you can loop a _farpoke* statement (which is very common), or use
the dosmem{get,put} functions. Try either\both of these, and please post with
more detail if you can't get it working.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019