Mail Archives: djgpp/2001/01/01/02:04:07
On Thu, 28 Dec 2000, Dennis Katsonis wrote:
> I am writing a game using the Allegro graphics library ver 3.12 for DJGPP
> The game works fine but for one problem. It seems to cause the MS-DOS
> prompt to crash occasionally when I exit the game with windows giving me a
> dialog box about an illegal operation. The faulting component is given as
> VMM(01)+0000FE7.
> Most of the time the program exits fine, but if I start another prompt at a
> later time, it may exit with this error. If I recompile, it may then work
> fine or may not.
Sounds like memory corruption problem, or use of some uninitialized
memory or a bad pointer.
> The last few lines of code in the program are
>
> set_gfx_mode(GFX_TEXT,80,25,0,0);
> textptr +=__djgpp_conventional_base;
> __djgpp_nearptr_enable();
> memcpy(textptr,data[endscreen].dat,4000);
> __djgpp_nearptr_disable();
You need to move the line "textptr +=__djgpp_conventional_base;" _after_
the call to __djgpp_nearptr_enable.
You also need to test whether a call to __djgpp_nearptr_enable succeeded,
before you use that.
Finally, you could easily do the same without the complications of
nearptr by using the ScreenUpdate library function.
- Raw text -