www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/01/01/02:04:07

Date: Mon, 1 Jan 2001 08:57:35 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Dennis Katsonis <dennisk AT netspace DOT net DOT au>
cc: djgpp AT delorie DOT com
Subject: Re: allegro program crashes on exit
In-Reply-To: <92f5e4$171d$1@otis.netspace.net.au>
Message-ID: <Pine.SUN.3.91.1010101074532.3587B-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019