Mail Archives: djgpp/1997/08/19/01:50:14
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, ®s);
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 -