www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/11/19:03:41

From: David Jenkins <me AT jenkinsdavid DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: a few questions...
Date: Thu, 11 Sep 1997 16:46:03 +0100
Organization: None
Distribution: world
Message-ID: <0Zxy$AA7IBG0EwOE@jenkinsdavid.demon.co.uk>
References: <5v87rt$2j4$1 AT kurica DOT wt DOT com DOT au>
NNTP-Posting-Host: jenkinsdavid.demon.co.uk
MIME-Version: 1.0
Lines: 109
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <5v87rt$2j4$1 AT kurica DOT wt DOT com DOT au>, Robert Debeljakovic
<rdebelj AT wt DOT com DOT au> writes
>Hi all,
>I am trying very hard to get this djgpp + allegro stuff together but some bits 
>are still a touch confusing...
>
>I have allegro 2.2 and have ran the game demo a few times and all this is 
>fine. I have run the game in all the different graphics modes and  I have 
>perused the code (demo.c) on many occasions and all this is ok too.
>
>I have a downloaded a few programs off one of the djgpp sites. It belongs to 
>one of you guys here, but I can't remeber which one now...(too many bookmarks)
>It has terrain programs and programs called mad_01.c -> mad_16.c. These 

Uh-ohhh, those are mine, sorry.
http://www.jenkinsdavid.demon.co.uk


>programs also use allegro... The thing is that half of these I cannot run from 
>dos. They do run from inside win95 but not when I reboot into a dos session. 

I only ever run my stuff from Win95, I've recently discovered that Win95
handles certain errors better than Dos does. See below about the game
I'm working on and how I fixed the errors in Dos.
(Thanks to Thomas Demmer, Ian Romanick, Hans Broeker and Eli. Thanks
guys. :) 

>The dos version I'm using is just the one that comes with my win95b. Ok, I 
>heard about the extender cwsdpmi and have played with this a lot... those few 
>programs still do not work regardless of whether cwsdpmi is loaded or not. Can 
>someone offer my some other alternatives... I have read the FAQ and the 
>allegro.txt file. 
>
>I really want to start some hardcore  coding using these two but It still 
>won't 'start'.
>
>Also, is there a faq that can explain to me those hex return codes... or is 
>there a debugging FAQ?
>
You mean these kind of hex return codes??

Shutting down Allegro
Exiting due to signal SIGSEGV
Page fault at eip=000056ba, error=0004
eax=69696b6a ebx=0002a7e4 ecx=00b68004 edx=00000000 esi=69696b6a
edi=0089d470
ebp=ff465f20 esp=ff465ef8 program=C:\MYFILES\TEMP\HOVER.EXE
cs: sel=00a7  base=845b6000  limit=ff465fff
ds: sel=00af  base=845b6000  limit=ff465fff
es: sel=00af  base=845b6000  limit=ff465fff
fs: sel=00af  base=845b6000  limit=ff465fff
gs: sel=00c7  base=00000000  limit=ffffffff
ss: sel=00af  base=845b6000  limit=ff465fff

Call frame traceback EIPs:
  0x000056ba 
  0x000036be 
  0x00002de7 
  0x00003cf2 
  0x0003456e 

What you need to do is this,
build the .exe in the same folder as the sources.
Run it till the program crashes, printing the above error code.
Then type symify program_name.exe
Which will print the following out.

Shutting down Allegro
Exiting due to signal SIGSEGV
Page fault at eip=000056ba, error=0004
eax=69696b6a ebx=0002a7e4 ecx=00b68004 edx=00000000 esi=69696b6a
edi=0089d470
ebp=ff465f20 esp=ff465ef8 program=C:\MYFILES\TEMP\HOVER.EXE
cs: sel=00a7  base=845b6000  limit=ff465fff
ds: sel=00af  base=845b6000  limit=ff465fff
es: sel=00af  base=845b6000  limit=ff465fff
fs: sel=00af  base=845b6000  limit=ff465fff
gs: sel=00c7  base=00000000  limit=ffffffff
ss: sel=00af  base=845b6000  limit=ff465fff

Call frame traceback EIPs:
  0x000056ba __getpixel+30
  0x000036be _make_hover_sprites+174, line 300 of init.c
  0x00002de7 _init_display+259, line 72 of init.c
  0x00003cf2 _main+82, line 41 of main.c
  0x0003456e ___crt1_startup+138

From this I found that a call in main.c to a function in init.c called
init_display() which in turn was calling another function called
make_hover_sprites() which was using the Allegro _getpixel() function, I
was getting a pixel from outside the bitmap using the quick and dirty
_getpixel() as opposed to the slower but cleaner getpixel().

I fixed that, then another bug showed up in another section, which I
killed using the same method. So now this game works in both Dos and
Win95. :)

I think Win95's DPMI sees the illegal calls and tells the program to
forget it and carry on. BUT Dos isn't clever enough to do that, so it
crashes.

AND if you want to get in touch via email and pick one of my sources
which gives errors, I'll try and fix it, so you can see the bits which
give the errors.

-- 
http://www.jenkinsdavid.demon.co.uk for C programmers.
David Jenkins

- Raw text -


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