Mail Archives: djgpp/1996/10/30/13:28:55
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.
- Raw text -