Date: Wed, 30 Oct 1996 19:32:46 +0200 (IST) From: Eli Zaretskii To: Phil Galbiati Cc: djgpp AT delorie DOT com Subject: Re: [Q] how to get offset of DOS conv. memory In-Reply-To: <327696D8.50F9@Tek.com> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Tue, 29 Oct 1996, Phil Galbiati wrote: > Am I correct in guessing that __dpmi_allocate_dos_memory() always > allocates blocks aligned on 16-byte boundaries, so the offset is > always zero? Yes. > If so, would the proper way to use these functions be > something like this [error conditions neglected for brevity]: The code is correct. Three comments: 1) Use `movedata' instead of `dosmemput': it's faster if you need to move buffers larger than 20 bytes or so. 2) You don't need to free the allocated DOS memory, unless you need a lot of allocations, or the code is to be put into a general-purpose library. All DOS memory that you allocate is automatically freed for you when the program exits. 3) If you only need to move data from DOS memory to your buffer (or vice versa), as opposed to keep it in the DOS memory for some time, you can use the transfer buffer, which is a 16KB-long buffer in DOS memory that every DJGPP program gets for free. The DJGPP FAQ list (available as v2/faq202b.zip from the same place you get DJGPP) will tell you more about the above issues in Chapter 18.