delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/30/07:13:33

Message-Id: <3.0.5.32.19980330133928.007a5e90@vip.cybercity.dk>
Date: Mon, 30 Mar 1998 13:39:28 +0200
To: djgpp AT delorie DOT com
From: "Nils Emil P. Larsen" <Peter_Larsen AT vip DOT cybercity DOT dk>
Subject: Allegro: draw_compiled_sprite (help me)
Mime-Version: 1.0

I get an General Protection fault when I run the code above - I compiled it
with no errors or warnings!
What are I doing wrong? The program for speed testing generation of memory
screens and the blitting to screen. My gfx-card is a Cirrus 54xx card with
1 MB VRAM. Rhide says (after executing the EXE) that it's the line

draw_compiled_sprite(buff, test_sprite, 0, 0);

that generate the error! Please help me!

Thank you,
Nils Emil P. Larsen

/******************************************************************/
#include <time.h>
#include "allegro.h"

main()
{
signed long int the_time=0;
int antal=0;
char *file="forest.bmp"; /* A 640*480 8-bit RLE-encoded image */
PALETTE pal;
BITMAP *image, *buff;
COMPILED_SPRITE *test_sprite;

allegro_init();
install_keyboard();

set_gfx_mode(GFX_AUTODETECT, 640, 480, 1024, 1024);

buff = create_bitmap(1024, 1024);
clear(buff);

image=load_bitmap(file, pal);
set_palette(pal);

test_sprite = get_compiled_sprite(image, is_planar_bitmap(image));

the_time = biostime(0,0);       
do
{
draw_compiled_sprite(buff, test_sprite, 0,0);
blit(buff, screen, 0, 0, 0, 0, 640, 480);
draw_compiled_sprite(buff, test_sprite, 40,40);
blit(buff, screen, 0, 0, 0, 0, 640, 480);
antal=antal+2;
} while (!key[KEY_ESC]);

the_time = biostime(0,0) - the_time;

set_gfx_mode(GFX_TEXT, 80, 25, 0, 0);

printf("antal: %i, TID: %i", antal, the_time);

allegro_exit();
};
/********************************************************************/

This is the error:

Shutting down Allegro
Exiting due to signal SIGSEGV
General Protection Fault at eip=0044400f
eax=303f4434 ebx=0043b004 ecx=00000000 edx=000a7000 esi=0000a4c0 edi=0000001e
ebp=000859f4 esp=000859e1 program=C:\DOSPRO\DJGPP\USER\GYSSE.EXE
cs: sel=00af  base=82328000  limit=0059ffff
ds: sel=00b7  base=82328000  limit=0059ffff
es: sel=00b7  base=82328000  limit=0059ffff
fs: sel=00b7  base=82328000  limit=0059ffff
gs: sel=00c7  base=00000000  limit=ffffffff
ss: sel=00b7  base=82328000  limit=0059ffff

Call frame traceback EIPs:
  0x0044400f
  0x0000165d
  0x0002c6be



- Raw text -


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