Several weeks ago I decided to learn NDS homebrew and found some old tutorials, got devkitPro set up, libnds, etc. I have been working on some simple tests (multiple backgrounds, sprites, animated sprites, text systems) with some great success. However, recently I stumbled upon a CPU profiling method (http://forums.devkitpro.org/viewtopic.php?p=2128#p2128) and decided to test a few of my functions and other doodads. One of the most critical things I noticed was that using a simple for loop to copy a 32x32 map took up about 14,800 cycles compared to the 559 of a dmaCopy. After seeing this gargantuan gap between these numbers, I now have a dilemma. Using dmaCopy is about 26x quicker, but I can't switch the palette of the tiles...
e.g.
Code: Select all
dmaCopy(pictureTiles,bgGetMapPtr(bg),1024); // ~559 cycles
Code: Select all
for(for(i=0;i<1024;i++) { // ~14,800 cycles
mapPtr[i]=pictureTiles[i] | TILE_PALETTE(2);
}
Is there any way to apply a palette swap quicker? It seems outrageous that it takes an extra 14,000 cycles to change the palette.
edit: spelling and grammar.