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.

DS development > copying a palette?

#143602 - spinal_cord - Wed Oct 24, 2007 11:17 am

I'm not sure if I'm doing this right, but I'm trying to copy some colours from a background to a sprite.

Code:

// get the pixel numbers
   col5 = PA_Get8bitPixel(0,3,191); // 5 - lit led colour
   col4 = PA_Get8bitPixel(0,1,191); // 4 - dim led colour
   col3 = PA_Get8bitPixel(0,2,191); // 3 - seconds colour
   col2 = PA_Get8bitPixel(0,0,191); // 2 - text colour

// copy bg palette to array
   u32 dest = 0x05000400 + (1<<10);
   DMA_Copy((void*)dest, (void*)top_Pal, 256, DMA_16NOW);


// copy some of those array entries to sprite palette
pale[1]=top_Pal[col5]; // lit led
pale[2]=top_Pal[col4]; // dim led


Am I doing this right?
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage