Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compiler's heretic behaviour
#1
I don't know how to call this, but heretic might be close. Let me explain what happens:

I'm making my crap game and I'm following strictly the programmers manual of good practics, you know, first I do the loading screen, then I do some graphics, sprite first and then the backgrounds and at last I try to do some code to move the whole thing with QAOPM (it could be I'm reading the manual upside down, yes).

Now I'm at the stage where I have the sprites done and I'm making the rooms' background. At this stage I just draw it all on the screen and when I'm happy with an item I add a ' before the line to make it a coment and move on to the next item. When I have everything, I will sort it all out.

Well, I had the first room layout. I did a carpet to decorate it. It was ok so I greyed it out (with the ' ) and started to desing a "David Star". When I print it, the first two graphics of the sprite data (which happen to be the mask for the sprite looking down) are corrupted. Somehow it seems that the background data (made with plots and draws) is overwritting the beginning of the sprite data. The strange thing is that if I print the carpet first and over it I print the star, nothing happens. And if I print the star making it double lined, everything is OK too.

So I'll send you a package with the code and attachements so you can check it if you want. No need to hurry up, I can workaround it and go on with the game.

Apenao Smile


Attached Files
.zip   gentle.zip (Size: 7.72 KB / Downloads: 815)
Reply
#2
I'm tied up with something else right this minute, Apenao - so I haven't really looked - but are you compiling with -O3?

Try without as well. My football game has some issues with -O3 in the graphics department.

*lion*
Reply
#3
Mmm I forgot to mention. That's without optimization at all, I haven't tried with optimization yet. But I've done several drawings an got the same results. It seems that the graphic gets corrupted when there are just a few draw sentences after a plot. Say 4 or 5. If the picture is more complex, the corruption disapears. Strange.
Reply
#4
Well, I've just tried with optimization -O 2 and got the same result. But with optimization -O 3 it compiles and the result is OK.
Reply
#5
apenao Wrote:Well, I've just tried with optimization -O 2 and got the same result. But with optimization -O 3 it compiles and the result is OK.
At first sight, it seems the compiler is getting confused with an ASM data block not being isolated from the main execution code. So I enclosed it between SUB FASTCALL xxx and END SUB, and it worked. Also added a fake call Gentlecillo() to avoid -O3 to remove this sub.
Code:
SUB FASTCALL Gentlecillo
gentlecillo:
ASM
; ASM source file created by SevenuP v1.20
; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain
...
END SUB
Gentlecillo() ' Fake Call
Also did the same in file sprite:
Code:
SUB FASTCALL eSprite
esprite:
ASM
xp: defb 0
yp: defb 0
gfxdir: defw 0
[...]
END SUB
eSprite() ' Fake Call, never executed
Anyway, we need to investigate further to discard a new compiler bug.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)