www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/18/06:50:33

Date: Thu, 18 Nov 1999 08:42:29 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: icemaze <icemaze AT planet DOT it>
cc: djgpp AT delorie DOT com
Subject: Re: Few lines, huge problems...
In-Reply-To: <3832D080.1B79710F@planet.it>
Message-ID: <Pine.SUN.3.91.991118084206.25299L-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 17 Nov 1999, icemaze wrote:

> ---- BEGIN ----
> char* allocDriveArray (int driveCount)
> {
>   char* array = (char*)malloc(driveCount * sizeof(char));
>   union REGS r;
>   struct SREGS s;
>   s.es = FP_SEG(array);
>   r.x.bx = FP_OFF(array);
>   r.x.ax = 0x150D;
>   int86x(0x2F, &r, &r, &s);
>   return array;
> }
> ---- END ----
> 
> I tried to port it to DJGPP C++ (since I'm making an Object Oriented
> Library), but there is nothing like FP_SEG and FP_OFF in DJGPP, so I
> don't know what to give to ES and BX. Can someone help me out? I read
> the DJGPP FAQ, but I didn't understand how to use the transfer buffer:

Did you see section 18.2 in the FAQ?  It includes a working example of
using the transfer buffer to call a real-mode interrupt function.  Use
that example as the base for converting the above code.  If you have
difficulties with some specific aspects of rewriting, please ask
specific questions.

>   asm // Function which should put in "_drive" the drive number of each
>       // CDROM unit present.
>   (
>     "movl  %0, %%es;"
>     "movw  %1, %%bx;"
>     "movw  $0x150D, %%ax;"
>     "int   $2F;"
>     :
>     : "g" (t), "g" (__tb & 0x000F)  // drive_number or drives_number???
>     : "memory","cc"
>   );

I'm puzzled why did you want to mess with inline assembly.  The
original code used int86x, and all you need is to replace that call
with a call to __dpmi_int.

- Raw text -


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