delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/08/19:40:49

From: "Marp" <Marp AT 0 DOT 0 DOT 0 DOT 0>
Newsgroups: comp.os.msdos.djgpp
Subject: What did I do wrong?
Date: Fri, 8 Jan 1999 19:33:49 -0500
Organization: ICGNetcom
Lines: 39
Message-ID: <77685n$o14@sjx-ixn6.ix.netcom.com>
NNTP-Posting-Host: prn-nj4-09.ix.netcom.com
X-NETCOM-Date: Fri Jan 08 4:33:59 PM PST 1999
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Ok here's my problem. I have some sources I want to get working with djgpp.
There's this one function that needed rewriting:

void CallDevice(void *ptr)
{
  static union REGS reg;
  static struct SREGS seg;

  segread(&seg);
  seg.es=FP_SEG(ptr);
  reg.x.ax=0x1510;
  reg.x.bx=FP_OFF(ptr);
  reg.x.cx=cdrom;
  int86x(0x2f, &reg, &reg, &seg);
}

I rewrote it like this:

void CallDevice(void *ptr)
{
  __dpmi_regs regs;

  dosmemput(ptr,26,__tb);
  regs.x.es=__tb >> 4;
  regs.x.ax=0x1510;
  regs.x.bx=__tb & 0x0f;
  regs.x.cx=cdrom;
  __dpmi_int(0x2f, &regs);
  dosmemget(__tb,26,ptr);
  return;
}

but my program doesn't work. I'm pretty sure this function is the problem.
(ptr points to a structure that's 26 bytes and I used
__attribute__((packed)) and cdrom is a global int) So could someone tell me
what I did wrong (if anything)? I apologize to Eli for not putting any
effort into it the last time :)


- Raw text -


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