Mail Archives: djgpp/1998/10/22/13:48:11
On Thu, 22 Oct 1998, Matthew Conte wrote:
> Section 18.1 of the FAQ says nothing about the size of the regs.
Yes, it does (see the excerpt below). Maybe you have an old version; the
latest is in v2/faq211b.zip.
Excerpt from the FAQ v2.11, section 18.1:
Note that calling `int86' and `intdos' can sometimes cause trouble due to
size (16 bits as opposed to 32 bits) of the members in the `union REGS'
structure. Do *not* assume that e.g. `regs.x.ax' is always 16 bit!
This problem and the facilities available to specify the width of the
registers are all described in the library reference; see description of
the int86 function in "libc.a reference", or point your Web browser
to http://www.delorie.com/djgpp/doc/libc-2.01/libc_411.html#SEC411.
In particular, programs which interface with the mouse via calls to
the `int86' library function, should mask off the high 16 bits of the
registers which report mouse position and other values, since the high 16
bits aren't necessarily zeroed (which will wreak havoc in any program
that interfaces to the mouse).
> Sure looks to me like the regs are 16-bit, and would explain why the values
> returned when you assumed 32-bit integers are garbage.
Please read a few sentences more:
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.
See? The default is 32-bit .ax members, and most DOS code ported from
other compilers assumes they are 16 bits. If you want them to be 16 bit,
use _NAIVE_DOS_REGS.
- Raw text -