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 > Strange sprite refresh problem...

#16247 - fixxorion - Wed Feb 11, 2004 4:33 am

Hi all!

I have a rather strange issue with sprites using HAM. I have 2 sprites on the screen, but when I update their positions...nothing happens even though I do a call CopyOAM. I then tried it on the following example file:

http://www.gbadev.org/download.php?section=demos&filename=mode4sprites.zip

If I create a new project in Visual HAM, load the files, and compile it...it works. However, when trying to move the ghost sprite around, it doesn't work!! If I use the batch file included with the file, everything works great...why?!?!

Any help would be greatly appreciated!!

Thanx,

fixxorion

#16248 - dagamer34 - Wed Feb 11, 2004 4:40 am

Do you wait for a VBlank or HBlank before copying data to OAM? It's locked at any other time.
_________________
Little kids and Playstation 2's don't mix. :(

#16250 - fixxorion - Wed Feb 11, 2004 5:02 am

Thanx for the reply!

This is the code from the example file (the main loop):

while(1){
GetInput();
MoveSprite(&sprites[0], ghostx, ghosty);
CopyOAM();
WaitForVsync();
}

This doesn't work with visual HAM...only by using the batch file can I get it to work.

Immensly strange...especially since the code is copying to OAM and then waiting for the Vsync.

Any other ideas?

fixxorion

#16266 - batblaster - Wed Feb 11, 2004 12:59 pm

There is a godd Forum for HAM developer on www.ngine.de you can try all you need to fix code with HAM...
_________________
Batblaster / 7 Raven Studios Co. Ltd
------------------------------------------

#16278 - poslundc - Wed Feb 11, 2004 3:29 pm

I know nothing about HAM, but the CopyOAM() function should appear either immediately after the WaitForVSync() function or at the very beginning of the loop. This probably won't make a difference on your particular program, though, as I doubt that the other two functions being called consume enough cycles to push CopyOAM() into the VDraw period. It's just a question of program organization.

Dan.

#16290 - jenswa - Wed Feb 11, 2004 8:57 pm

Yeah i figurd that out when the display began to show some weird stuff.
Although this is an old code sample from when i started with coding for the gba.
The code wasn't written for HAM, it was written for use with DevKitAdvance. So it should compile with devkitadv and i don't know about HAM.
_________________
It seems this wasn't lost after all.

#16304 - fixxorion - Thu Feb 12, 2004 1:31 am

Thanx for all the replies!

I ended up just using DevKitAdvance, and that worked fine. Still don't understand what could have caused it, but at least it works now.

Thanx again!

fixxorion