Mail Archives: djgpp/1999/11/18/06:50:33
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 -