cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/17/14:20:58

From: icemaze <icemaze AT planet DOT it>
Newsgroups: comp.os.msdos.djgpp
Subject: Few lines, huge problems...
Date: Wed, 17 Nov 1999 16:57:52 +0100
Organization: Centro Servizi Interbusiness
Lines: 60
Message-ID: <3832D080.1B79710F@planet.it>
NNTP-Posting-Host: pri2-1.planet.it
Mime-Version: 1.0
X-Mailer: Mozilla 4.5 [en] (Win98; I)
X-Accept-Language: it,en
To: djgpp AT Delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm trying to make a cdrom library with DJGPP. I need to use assembly
to communicate with MSCDEX, and I managed to get, for example, its
version number and the number of CDs installed. I need some help with
this piece of asm code I found in a CD-Programming FAQ: it's
written in C.

---- 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:
all I managed to get is a SIGNAL_ABORT!! This is the latest version of
my code:

---- BEGIN ----
void cdromclass::GetCDDrives (void)
{
  char *_drive = new char [_number_of_drives];

// Trying to use DJGPP transfer buffer... but it doesn't work!! :(
  unsigned long t = __tb >> 4;
  t &= 0xFFFF;

  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"
  );

  printf ("\n\nLinear buffer address: %04X:%01X.", (__tb >> 4) & 0xFFFF,
__tb & 0x000F);
  for (k = 0; k < _number_of_drives; k++)
    printf ("\nDrive %d is #%d!", k, _drive[k]);
  delete [] _drive;
}
---- END ----

Help! ^_^

-- 
icemaze AT planet DOT it

- Raw text -


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