delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/03/09:44:33

Date: Mon, 3 Nov 1997 16:42:37 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Brett Porter <bporter AT rabble DOT uow DOT edu DOT au>
cc: DJGPP <djgpp AT delorie DOT com>
Subject: Re: Question about __dpmi_allocate_dos_memory
In-Reply-To: <199711031208.XAA05407@rabble.uow.edu.au>
Message-ID: <Pine.SUN.3.91.971103163707.15552B-100000@is>
MIME-Version: 1.0

On Mon, 3 Nov 1997, Brett Porter wrote:

> I've noticed that __dpmi_allocate_dos_memory has superseded (and much
> simplified) calling this DPMI function, over the
> _go32_dpmi_allocate_dos_memory equivalent.

No, they are two different functions (but use the same underlying DPMI 
function).  The older _go32 variety is also required if you want to write 
code that will compile with DJGPP v1.x.

> But the routine gives you back just a selector and a segment.

Because the allocated block is aligned so that the offset is zero.

> So if I have a structure MyStruct, I want to call like this:
> 
> movedata( _my_ds(), (int )&MyStruct, DosSelector, 0, sizeof( MyStruct));
> 
> Is this right?

Yes.  But beware of moving structs: gcc pads struct elements, unless you 
explicitly tell it not to.

> Likewise when I pass the segment
> returned from the allocate to __dpmi_int with an es:ebx combination: I
> assume again that the allocation aligns it on a segment boundary?

Yes.

> (BTW, the code doesn't work... in case you haven't guessed :)

Then debug it.  Or post it.

- Raw text -


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