gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Problems with GBAJunkie's tutorial re:displaying sprites

#7699 - Misogynator - Mon Jun 23, 2003 4:32 am

I started trying to compile the examples in the tutorial to see if VC++/DevKitAdvance would compile them properly. The one that simply copied an image to VRAM worked ok, but the one that is supposed to render a pacman sprite to the screen resulted in a box of random pixels in the top left hand corner and no pacman sprite. This sounds like the "artifact" I've seen reference to, but the example program sets all the sprites to 160y/240x. Also, if I create my own sprite header of the same dimensions as the pacman sprite, using the same pcx2gba converter, all that results is a black screen. I saw a topic buried down in the forum where a similar problem was posted, but the solution of using pcx2sprite instead of pcx2gba isn't working for me.

Thanks for any help.

#7726 - Lupin - Mon Jun 23, 2003 4:43 pm

did you try to set the sprites to 159/239 ?

you should also try to deactivate the -O2 or -O3 option, I got some problems with it lately...

#7746 - Misogynator - Mon Jun 23, 2003 10:34 pm

Awesome. It was the O2 thing, incidentally, and I really wish I had any idea what that was.

#7751 - Archeious - Mon Jun 23, 2003 11:41 pm

Misogynator wrote:
Awesome. It was the O2 thing, incidentally, and I really wish I had any idea what that was.


The O option in GCC is the optimaztion level in GCC. Chances are the compiler was optimizing something right out that well shouldn't have been. :) It happens sometimes, like when your waiting for a VSYNC, but that is neither here nor there.

#7756 - tepples - Tue Jun 24, 2003 6:03 am

See FAQ section "C and C++" entry: Q: My program works when compiled without optimizations (-O0)...
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#7765 - Lupin - Tue Jun 24, 2003 10:01 am

i lately wrote my first tutorial for my website, but it doesn't seem to compile with the -O2 option, the only registers iam using are:

REG_DISP_CNT
REG_BG0CNT
REG_DMAXSAD
REG_DMAXDAD
REG_DMAXCNT

wich of them need to be volatile? I looked at various samples and in all samples they are declared non-volatile...

#7768 - torne - Tue Jun 24, 2003 11:44 am

All registers must be volatile.

Torne

#7774 - jcpredator - Tue Jun 24, 2003 2:32 pm

I don't mean to be rude or anything but I personally have had many problems with GBAjunkies tutorials. My main concern with that is his tutorials are almost identical to thepernproject's. Maybe someone should make another tutorial site that tries to explain and teach in a different way but is still similar to other tutorials. Most people don't learn in the same way so I just think that there should be more than 1 way of teaching beginners.
_________________
There is no spoon...

#7776 - Lupin - Tue Jun 24, 2003 3:04 pm

Ok, I changed every register to volatile, it works better now, but there are still some new problems showing up....

do unsolved pointers need to be volatile too? Like this one:

#define ScreenPalette ((u16*)0x5000000)

I think my prblems are because of my crappy written DMA copies :(
seems like I have to take a look at them again...

#7811 - niltsair - Wed Jun 25, 2003 2:22 pm

You need to declare volatile everything that can change without your coding intervention, which means registers (DMA, interrupt, Keypad, etc..) ScreenPalette is only a memory area that hold the colors values for your palette, it won't change if you dont specifically do it, so no, it doesn't need to be declared volatile.