Q: My program crashes/doesn't do what it should when I call
A: You should zero out some of the members of the
structure before you call the DPMI function that invoke real-mode
procedures. Random values in these members can cause your program to
behave erratically. The members in point are
are zeroed, the DPMI host will provide a stack for the call. This stack
is usually large enough, but sometimes you'll need to use your own,
larger stack, e.g., if you expect interrupts to nest deeply, or if your
handler needs a lot of stack space31. In these cases you should point
.x.sp to a larger buffer which is in
conventional memory (possibly part of the transfer buffer).
If SS:SP isn't zero, it will be used as the address of the stack for the interrupt handler, so if it points to a random location, your program will most certainly crash. A non-zero FLAGS member can also make the processor do all kinds of weird things (e.g., imagine that the single-step or the debug bit is set!).