delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/05/11:35:18

From: p DOT steiner AT t-online DOT de (Peter Steiner)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: real-mode pointers
Date: 2 Aug 1997 16:15:34 GMT
Organization: Telekom Online Internet Gateway
Lines: 45
Message-ID: <5rvmf6$bha$3@news00.btx.dtag.de>
References: <33DF967A DOT 2A6C AT indy DOT net> <fPq0HJACN63zEwOT AT talula DOT demon DOT co DOT uk> <33E1B093 DOT 7B69F0FC AT Mathematik DOT TU-Chemnitz DOT DE> <33E280E0 DOT F74 AT indy DOT net>
Reply-To: p DOT steiner AT t-online DOT de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Fri, 01 Aug 1997 19:35:44 -0500, Chris Frolik <frolikcc AT indy DOT net> wrote:
>Robert Hoehne wrote:
>> 
>> Shawn Hargreaves wrote:
>> >
>> > >2) Every address in memory can be accessed using the segment:offset
>> > >notation
>> >
>> > Untrue. Real mode segments are 64k in size, right? But they overlap, and
>> 
>> In general it is true, that every address is accessed using
>> segment:offset.
>> Also in a flat 32bit environment memory is accessed this way, but there
>> the segments called often selectors and the segment size may be much
>> larger than 64K.
>> 
>> BTW: This is probably not what the original poster expected to hear, but
>> it is so.

>Hmm...what about conventional memory?  The FAQ says that it uses 20-bit
>addresses, but how can it be accessed using a real-mode pointer?

What about djgppfaq.txt section 18.4 How to move data between your program
and conventional memory?
   ....
   * If you want to access a byte, a 16-bit word, or a 32-bit double word,
     use the "far pointer" functions declared on the <sys/farptr.h>' header
     file.  You should convert any real-mode far pointer segment:offset pair
     into a "linear address" (i.e., segment*16 + offset), and use dos_ds'
     or any other selector which allows access to conventional memory, like
     this:

           unsigned char value = _farpeekb(_dos_ds, segment*16 + offset);
   ....

There are also faster ways mentioned for larger buffers.

Bye,

Peter Steiner
-- 
   _   x    ___
  / \_/_\_ /,--'  p DOT steiner AT t-online DOT de (Peter Steiner)
  \/>'~~~~//
    \_____/   signature V0.2 alpha

- Raw text -


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