#20420 - mr_schmoe - Tue May 11, 2004 12:46 am
I've been developing a bmp to gba convert and I've ran into a little snag that I can't seem to figure out. Everything works fine in 256 color mode, but when I try 16 colors, it doesn't seem to work properly
My program goes something like this.
load the bitmap data so the data in memory equals this
unsigned char bmpdata[] = { 0xA1, 0xB0, 0x1E, 0x1E, ... }
convert the data to GBA format and type cast the data to 16 bit words
so you end up with,
{ 0xA1B0, 0x1E1E, ... }
I figure the problem isn't in my conversion program, but how the GBA displays sprite data. If you look at it, the first pixel of the sprite should be color index A (or 10), right? Then then next two are ones and the fourth is a 0, right? But when I load the program on the GBA, it's sort of screwed up. It looks like the first pixel is a color index 0 and the next is a 10 (or A). Or in other words it looks like this 0x0B1A.
So like me break it down this way.
The bitmap data is stored like this:
{ 0xA1B0, 0x1E1E, ... }
In the GBA memory sprite data addresss (0x06010000), it looks like this:
{ 0xA1B0, 0x1E1E, ... }
On the screen it looks like it should be more like:
{ 0x0B1A, 0xE1E1, ... }
Is there something I'm missing here?
And as I was writing this, I went back check on somethings and now I'm not so sure my 256 color mode conversion works. I'll check that and get back with you. But in the mean time, does anyone know how would I go about reversing the data so it shows up on the screen correctly? Thanks a million.
My program goes something like this.
load the bitmap data so the data in memory equals this
unsigned char bmpdata[] = { 0xA1, 0xB0, 0x1E, 0x1E, ... }
convert the data to GBA format and type cast the data to 16 bit words
so you end up with,
{ 0xA1B0, 0x1E1E, ... }
I figure the problem isn't in my conversion program, but how the GBA displays sprite data. If you look at it, the first pixel of the sprite should be color index A (or 10), right? Then then next two are ones and the fourth is a 0, right? But when I load the program on the GBA, it's sort of screwed up. It looks like the first pixel is a color index 0 and the next is a 10 (or A). Or in other words it looks like this 0x0B1A.
So like me break it down this way.
The bitmap data is stored like this:
{ 0xA1B0, 0x1E1E, ... }
In the GBA memory sprite data addresss (0x06010000), it looks like this:
{ 0xA1B0, 0x1E1E, ... }
On the screen it looks like it should be more like:
{ 0x0B1A, 0xE1E1, ... }
Is there something I'm missing here?
And as I was writing this, I went back check on somethings and now I'm not so sure my 256 color mode conversion works. I'll check that and get back with you. But in the mean time, does anyone know how would I go about reversing the data so it shows up on the screen correctly? Thanks a million.