delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2011/03/15/02:30:40

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
Date: Tue, 15 Mar 2011 02:30:24 -0400
Message-Id: <E1PzNlw-0006v5-4l@fencepost.gnu.org>
From: Eli Zaretskii <eliz AT gnu DOT org>
To: djgpp AT delorie DOT com
In-reply-to:
<f1bda3ea-6f2b-4e52-9378-85dd56198198 AT i39g2000prd DOT googlegroups DOT com>
(message from Jim Michaels on Mon, 14 Mar 2011 15:52:59 -0700 (PDT))
Subject: Re: csdpmi7 not working on virtualbox, how use dosmemget with seg ofs
from int21h?
References: <39cdc18e-eccb-4213-b896-db3be020702e AT w9g2000prg DOT googlegroups DOT com>
<iknmth$1lb$1 AT speranza DOT aioe DOT org> <3e035797-6b8e-4106-bd29-98e87a9cc121 AT a21g2000prj DOT googlegroups DOT com>
<E1Pz5o6-0001qv-4s AT fencepost DOT gnu DOT org> <f1bda3ea-6f2b-4e52-9378-85dd56198198 AT i39g2000prd DOT googlegroups DOT com>
Reply-To: djgpp AT delorie DOT com

> From: Jim Michaels <jmichae3 AT yahoo DOT com>
> Newsgroups: comp.os.msdos.djgpp
> Date: Mon, 14 Mar 2011 15:52:59 -0700 (PDT)
> 
> I don't take to hand-waving.  I need concrete examples.  code it.

"Hand-waving"? "code it"?  Do I work for you that you think you can
talk to me that way?

Do you realize that I needed to take some non-trivial amount of time
out of my busy day to write up that stuff, complete with verified URLs
and references to functions and variables you would have otherwise
needed to dig out yourself?  Can you appreciate this effort given out
to you for free?  Or is the above some new way of saying thank you?

> so I ask again, the address is actually from DOS in ES:DI, how do I
> translate this address into an address dosmemget can use? I KNOW that
> this address is NOT __tb.  so try again.

You have the answer at your fingertips, in the library reference
(libc.info).  Quote:

  dosmemget
  =========

  Syntax
  ------

       #include <sys/movedata.h>

       void dosmemget(int offset, int length, void *buffer);

  Description
  -----------

  This function transfers data from MS-DOS's conventional memory space to
  the program's virtual address space.  The OFFSET is a physical address,
  which can be computed from a real-mode segment/offset pair as follows:

       offset = segment * 16 + offset;

  The LENGTH is the number of bytes to transfer, and BUFFER is a pointer
  to somewhere in your virtual address space (such as memory obtained
  from `malloc') where the data will go.

End of quote.  Any questions?  If not, then "try again".

> that FAQ is only half useless to me right now - parts of it I think I
> may need like maybe the peek and dosmemget.

You are wrong, everything I wrote is relevant and useful.

> I don't know, maybe DJ forgot to put that piece in DJGPP or just
> didn't think to document it - hey - I make mistakes too.

DJ didn't forget anything of the kind, DJGPP v2.03 is being in use for
10 years, and all the machinery to implement what you want is there
and working well.  Believe me.  You can look at the library sources to
see similar functions that call DOS interrupts.  They are all working.

> maybe the answer is simple.

Yes, it is: RTFM.

> one part of the answer I was thinking was to convert it to a long
> after the int21h call:
> unsigned long adr = r.x.es;
> adr <<= 4;
> adr += r.x.di;

See the above excerpt from the library docs.

> but what to do with it after that I don't rightly know.

The references to the FAQ I posted will tell you _precisely_ that.

- Raw text -


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