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 > Own graphic-format too slow ?

#19458 - ProfEich - Tue Apr 20, 2004 1:49 pm

Hi!
I'm developing a little project and I designed an own graphic-format for it.
Well reading it would be no problem - but I guess when I read it, it would be slower than loading it with DMA.

But DMA-Copy can't copy data from my own file because it's kind of crypted.

Is it really slow when I read it byte per byte in the memory?
If yes, how to make it faster?

#19459 - torne - Tue Apr 20, 2004 2:11 pm

It's slower than DMA except for small amounts of data, yes. To make it faster, use a nice unrolled loop of ldmia/stmia instructions and copy as many bytes at once as possible..

#19461 - poslundc - Tue Apr 20, 2004 2:53 pm

Put your decompression algorithm into either IWRAM or EWRAM. That way, so long as you're loading bytes consecutively from the ROM you should be okay.

An alternative is to create a buffer in IWRAM for your data, use DMA to load a chunk of data from ROM to the buffer, and then decrypt it however you please.

As you observe, neither of these would be as fast as simply DMAing the data from ROM to VRAM. But many GBA applications compress their graphics and find the necessary time to decompress them.

Dan.