delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/23/14:30:21

Message-ID: <3798AC68.D3DEB5FF@home.com>
From: ALEXANDER PEREZ <coindood AT home DOT com>
Organization: @Home Network Member
X-Mailer: Mozilla 4.5 [en]C-AtHome0405 (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: This program won't work!
Lines: 85
Date: Fri, 23 Jul 1999 18:00:28 GMT
NNTP-Posting-Host: 24.2.93.62
X-Complaints-To: abuse AT home DOT net
X-Trace: news.rdc1.nj.home.com 932752828 24.2.93.62 (Fri, 23 Jul 1999 11:00:28 PDT)
NNTP-Posting-Date: Fri, 23 Jul 1999 11:00:28 PDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I have a program that just won't work!  It compiles fine, but when I run
it, it gets this error:

Shutting down Allegro
Exiting due to signal SIGSEGV
General Protection Fault at eip=0000524a
eax=000c7e4c ebx=0000836c ecx=0000060c edx=49444a44 esi=00000054
edi=00047e60
ebp=000c7e40 esp=000c7e20 program=C:\ALEX\CSRC\D_AND_D.EXE
cs: sel=00a7  base=836c3000  limit=000cffff
ds: sel=00af  base=836c3000  limit=000cffff
es: sel=00af  base=836c3000  limit=000cffff
fs: sel=0087  base=0000f260  limit=0000ffff
gs: sel=00bf  base=00000000  limit=0010ffff
ss: sel=00af  base=836c3000  limit=000cffff
App stack: [000c7e60..00047e60]  Exceptn stack: [00047d40..00045e00]

Call frame traceback EIPs:
  0x0000524a
  0x00026d52
.
the program source is this:

#include <conio.h>
#include "allegro.h"



 int main(void)
	{
        BITMAP *screen;
        int done;
        int x = 1, y = 1;

        allegro_init();
        set_gfx_mode(GFX_VGA, 320, 200, 0, 0);

		  do
			{
                        clear(screen);
                        putpixel(screen, x, y, x);

			// move player
			if (kbhit())
			{

				switch(getch())
						{
                                        case '8': // up
					{
                                        y += 5;
					} break;

					case '2': // down
					{
                                        y -= 5;
					} break;

					case '6': // right
					{
                                        x -= 5;
					} break;

					case '4': // left
					{
                                        y += 5;
					} break;

					case 'q':
					{
						done=1;
					} break;
						} // end switch
			} // end if player hit q

                putpixel(screen, x, y, x);

		} 	while(!done);// end while


       return 0;
	}// end main

.
Please e-mail me at coindood AT home DOT com if you can help me!

- Raw text -


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