delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/30/13:28:55

Date: Wed, 30 Oct 1996 19:32:46 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Phil Galbiati <Philip DOT S DOT Galbiati AT Tek DOT com>
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: <Pine.SUN.3.91.961030192400.21770F-100000@is>
Mime-Version: 1.0

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 -


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