Mail Archives: djgpp/1996/05/22/02:02:04
On Tue, 21 May 1996, Bryanston School wrote:
> trying to capture an area of memory which is mapped into linear memory
> off a physical device to disk. I mapped this memory using the instructions
> in the FAQ (map physical memory, allocate descriptor, set limits and base),
> but I don't seem to be able to access it without using the _farpeek / _farpoke
> functions. Is there a quick way to do fwrite(memory, sizeof(memory), sizeof(int), filehandle) without doing it in a loop and transferring 4 bytes to the disk at once?
You seem to forget that writing *any* buffer under DJGPP (or any other DOS
protected-mode environment) involves moving its contents to a transfer
buffer where DOS can get at it. So you always pay a price of moving your
memory region in 4-byte chunks. Therefore the fastest way would be to
move that 1MB directly to the transfer buffer (with `movedata' or
`dosmemputl'), then call the DOS write function via DPMI (using the
`__dpmi_int' library function). That way you have only a single memory
move instead of a double one.
> Also, I have found that declaring a lot of local variables in
> main() sometimes gives errors, such as variables changing between
> one printf() and another.
How much are ``a lot of local variables''? If they might hit 256KB, then
you just overflow the default stack. Solutions to this problem are
described in section 15.8 of the DJGPP FAQ list (available as
v2/faq200b.zip from the same place you get DJGPP).
- Raw text -