Mail Archives: djgpp/1994/08/19/20:37:42
> I'm somewhat confused about dosmemget and linear addresses in go32...
>
> dosmemget is defined as:
> #include <go32.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:
>
>
> But go32_info_block has a number with begins with 0xe0000000 and there
> is an example:
> dosmemget(_go32_info_block.linear_address_of_primary_screen, 80*25*2, buf);
dosmemget and dosmemput automatically strip the top four bits off the
linear address you give it to compensate for those values. They're
set that way as an indication to go32 that the libc routines have
already transferred data into the transfer buffer; when go32 sees the
magic number as a pointer, and the magic number corresponds to the
address of the transfer buffer, it doesn't need to transfer any
memory. That speeds things up a lot as there are fewer mode switches
required.
> Wouldn't it be easier (and possible) to map in the 1Mbyte of dos memory
> readonly?
You have to go through a function to read *and* write at the moment,
unless you use farptr and/or movedata, but then you have to know to
strip off the top four bytes yourself.
- Raw text -