www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/09/06:36:49

Date: Sun, 9 Feb 1997 13:27:35 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Till Harbaum <harbaum AT ra DOT ibr DOT cs DOT tu-bs DOT de>
cc: djgpp AT delorie DOT com
Subject: Re: caveat bc3.1 -> djgpp
In-Reply-To: <yks914z9s0p.fsf@ra.ibr.cs.tu-bs.de>
Message-ID: <Pine.SUN.3.91.970209131615.859B-100000@is>
MIME-Version: 1.0

On 8 Feb 1997, Till Harbaum wrote:

> Why are the x registers from the REGS union 32 bits long and
> the x registers from __dpmi_regs 16 bit?

Because different DOS-based compilers have different and incompatible
conventions about union REGS, and there's no reason why the Borland's
variant should be the default.  (There is also the int386 functions which
uses the same union REGS.)  You should #define _NAIVE_DOS_REGS before
including <dos.h> to get what 16-bit programs expect. 

Btw, I suggest everybody who is serious about calling real-mode 
DOS/BIOS services to stay away of int86 and use __dpmi_int instead, even 
for functions that are supported by int86.  The problems with 16-bit vs 
32-bit width of the .x member is one of the reasons, but there are more.

> Perhaps someone (Eli?) should mention this in the faq?

Why should the FAQ explain something that is clearly documented in the 
library reference?  From the DOS prompt type "info libc alpha int86", hit 
[Enter] and observe:

int86
=====

Syntax
------

     #include <dos.h>

     int int86(int ivec, union REGS *in, union REGS *out);

Description
-----------

Note: The `.x.' branch is a problem generator.  Most code expects the
`.x.' branch to have e.g. "`.x.ax'" members, and that they are 16-bit.
If you know you want 32-bit values, use the `.d.eax' members.  If you
know you want 16-bit values, use the `.w.ax' members.  The `.x.'
members behave according to `#defines', as follows:

`default'
     If you specify no `#define', the `.x.' branch has "`ax'" members
     and is 32-bit.  This is compatible with previous versions of djgpp.

`_NAIVE_DOS_REGS'
     This define gives you `.x.ax', but they are 16-bit.  This is
     probably what most programs ported from 16-bit dos compilers will
     want.

`_BORLAND_DOS_REGS'
     This define gives you `.x.eax' which are 32-bit.  This is
     compatible with Borland's 32-bit compilers.

- Raw text -


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