Mail Archives: djgpp/1995/10/12/05:02:06
On Sat, 7 Oct 1995, Iota (Tom Wenisch) wrote:
> I'm having a truly strange problem getting some VESA-based graphics code to
> work. The strange thing is, when stepped through in GDB, the code runs
> flawlessly, but when run from the command line, the code crashes DOS, WIN95,
> and every configuration and memory manager I have on my system.
Use __dpmi_int() instead of the function you've used; it zeroes out the
SS, SP and the FLAGS registers before calling the DPMI server, which you
didn't do in your code. Note that this is explained in the DJGPP FAQ
list (available as faq102.zip at the same place you get DJGPP), in
section 18.3:
18.3 Q: My program crashes/doesn't do what it should when I call
_go32_dpmi_simulate_int().
A: You should zero out some of the fields of the
_go32_dpmi_registers structure before you call
_go32_dpmi_simulate_int(). Random values in these fields can
cause your program to behave erratically. The fields in point
are SS, SP and FLAGS. When SS and SP are zeroed, the DPMI host
will provide a stack for the interrupt handler which is at least
30-word long (most DPMI hosts provide much larger stack); this is
usually enough, but if it isn't, then you should point SS and SP
to larger buffer in conventional memory (possibly part of the
transfer buffer).
- Raw text -