I\'ve tried to decode the following bitmap using the background pallete scheme described at http://imrannazar.com/GameBoy-Emulation-in-JavaScript:-Graphics
<
In addition to the answer by PBurggraf, here is a snippet of my code that I used to check my understanding of it.
static const uint8_t data[] = {
0xCE, 0xED, 0x66, 0x66, 0xCC, 0x0D, 0x00, 0x0B, 0x03, 0x73, 0x00, 0x83,
0x00, 0x0C, 0x00, 0x0D, 0x00, 0x08, 0x11, 0x1F, 0x88, 0x89, 0x00, 0x0E,
0xDC, 0xCC, 0x6E, 0xE6, 0xDD, 0xDD, 0xD9, 0x99, 0xBB, 0xBB, 0x67, 0x63,
0x6E, 0x0E, 0xEC, 0xCC, 0xDD, 0xDC, 0x99, 0x9F, 0xBB, 0xB9, 0x33, 0x3E,
};
for(int y=0; y<8; ++y)
{
int i = ((y/2)%2)+(y/4)*24;
for(int x=0; x<12; ++x,i+=2)
{
const uint8_t nibble = (y%2) ? (data[i]&0xF) : (data[i]>>4);
for(int b=4; b--;) std::cout << (((nibble>>b)&1) ? "*" : " ");
}
std::cout << std::endl;
}
It outputs:
** ** ** **
*** ** ** ** **
*** ** **** **
** * ** ** ** ** ** **** ** ** ***** ****
** * ** ** *** ** ** ** ** *** ** ** ** ** **
** *** ** ** ** ** ****** ** ** ** ** ** **
** *** ** ** ** ** ** ** ** ** ** ** **
** ** ** ** ** ** ***** ** ** ***** ****
Hope it helps someone.