www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/22/02:02:04

Date: Wed, 22 May 1996 08:55:39 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Bryanston School <MOLESWORTH DOT THOMAS AT bryanston DOT co DOT uk>
Cc: DJGPP mailing list <djgpp AT delorie DOT com>
Subject: Re: Acessing DPMI memory without farptr
In-Reply-To: <000000199912915529827@bryanston.co.uk>
Message-Id: <Pine.SUN.3.91.960522084607.1173G-100000@is>
Mime-Version: 1.0

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 -


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