Mail Archives: djgpp/1997/08/05/11:35:18
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 -