www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/22/03:03:44

Date: Mon, 22 Dec 1997 08:57:47 +0100 (MET)
From: Theuzifan <uzi AT simauria DOT upv DOT es>
To: Mark Phillips <bigphil AT solutions DOT mb DOT ca>
cc: djgpp AT delorie DOT com
Subject: Re: allegro bmp/pcx loading problems
In-Reply-To: <349d836a.0@news3.escape.ca>
Message-ID: <Pine.LNX.3.95.971222084816.17050E-100000@silvia.rec.upv.es>
MIME-Version: 1.0

On Sun, 21 Dec 1997, Mark Phillips wrote:

> I have a program which uses allegro to load 6 bitmaps, all of size
> 77x105 and i want to keep writing them over top of each other to do
> some crude animation.  However, half of the time when I try to compile
> the program, the compiler gives me the error: "virtual memory
> exhausted" the other half of the time it compiles but i get a general

Free some disk space, and make you sure your disk drive where DJGPP is
has at least 10 megs free. But not always this message is given by lack of
disk space. Sometimes the compiler is not able to use any swapfile (I've
120 megs free and it gaved me that error!) Are you under win95? maybe this
is the problem...I've got the same error under OpenDOS.

> protection fault after it has displayed 2 frames.  What am I doing
> wrong? here is the source if you're interested (I am just trying stuff
> out and so I just modified one of the allegro examples). oh yeah by
> the way, i accidentally overwrote allegro example #15 so if someone
> could just post ex15.c that would be great too.
> 
> 
> #include <stdlib.h>
> #include <stdio.h>
> 
> #include "allegro.h"
> 
> void pause(int);
> 
> void main()
> {
>    int i;
>    BITMAP *the_image[4];
>    PALLETE the_pallete[4];
> 
>    /* read in the bitmap files */
>    the_image[0] = load_bitmap("run1.bmp", the_pallete[0]);
>    if (!the_image[0]) {printf("Error reading bitmap file run1.bmp");
> exit(1);}
>    the_image[1] = load_bitmap("run2.bmp", the_pallete[1]);
>    if (!the_image[1]) {printf("Error reading bitmap file run2.bmp");
> exit(1);}
>    the_image[2] = load_bitmap("run3.bmp", the_pallete[2]);
>    if (!the_image[2]) {printf("Error reading bitmap file run3.bmp");
> exit(1);}
>    the_image[2] = load_bitmap("run4.bmp", the_pallete[3]);
>    if (!the_image[3]) {printf("Error reading bitmap file run4.bmp");
> exit(1);}
> //   the_image[2] = load_bitmap("run5.bmp", the_pallete[4]);
> //   if (!the_image[4]) {printf("Error reading bitmap file run5.bmp");
> exit(1);}
> //  the_image[2] = load_bitmap("run6.bmp", the_pallete[5]);
> //   if (!the_image[5]) {printf("Error reading bitmap file run6.bmp");
> exit(1);}
> 
>    allegro_init();
>    install_keyboard(); 
>    if (set_gfx_mode (GFX_AUTODETECT, 640, 480, 0, 0)!=0) exit(1);
> 
>    i = 0;
> 
>    while (!key[KEY_ESC]) {
> 
>      /* select the bitmap pallete */
>      set_pallete(the_pallete[i]);
> 
>      /* blit the image onto the screen */
>      blit(the_image[i], screen, 0, 0, 0, 0, 77, 105);
> 
>      pause(100);
> 
>      i++;
>      if (i==4) i=0;
> 
>    }
> 
>    for (i=0;i<4;i++)
>    /* destroy the bitmap */
>    destroy_bitmap(the_image[i]);
> 
> 
>    readkey();
>    exit(0);
> }
> 
> void pause(int l) {
>   int i;
>   for(i=0;i<l*10000;i++) {;}
> }
> 
> 


try the_image=(BITMAP **)malloc(sizeof(BITMAP *)*4);
I can feel I'm maybe wrong... please correct me if this happens! 

- Raw text -


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