Mail Archives: djgpp/1995/10/10/11:03:38
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.
Here's the code fragment for a function to determine the current graphics
mode using VESA function 0x4F03
int GFX_GetVidMode() {
_go32_dpmi_registers regs;
if (VESA_Detected) { //Presence of VESA hardware previously determined
regs.x.ax = 0x4F03;
_go32_dpmi_simulate_int(0x10,®s); //Program crashes in this line
if (regs.h.al == 0x4F && regs.h.ah == 0x00)
return(regs.x.bx); //BX holds VidMode
//Detection failed
}
[stuff deleted]
return(-1); //Detection failed
}
I'mrunning djgpp2 beta 2 (Haven't gotten around to getting beta 3 yet...)
When run under Win95, DOS box crashes out with an illegal instruction at
address 16C4:002E.
Under EMM386, I once got an "Error #01 at CE23:056A", but I was unable to
duplicate this behavior. If I remember correctly, CE23 is CS in my program.
Under CWSDPMI, the program simply crashed (taking the keyboard with it).
I single stepped with stepi through the _go32_dpmi_simulate_int, and found that
the programming was actually crashing in _go32_simulate_real_mode_int at
address E276.
I couldn't think of ANY reason why this code fragment might run when stepped
through, but not when run full speed (under GDB or DOS). Any ideas?
- Raw text -