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.

Graphics > 256 Colors, only getting 21 or so.

#6182 - Daedro - Mon May 19, 2003 4:22 am

I know this is a very newbie question, but Im tired and enoyed.

I have an image, its in 256 colors format. It has about 112 colors. Only about 21 or so colors are showing up and I get a very unblended image.

I know it is something with my coding, becuase it looks fine before I convert it into c. Also I have seen real-life pictures on gba with what looks like more than 256 colors, so what am I doing wrong?

I have
Code:
REG_BG0CNT = BG_COLOR_256 | TEXTBG_SIZE_256x256 | (31 << SCREEN_SHIFT) | WRAPAROUND;

thats the only thing to define the color setting, but that doesnt matter becuase even in 16 color i can get 256 color.. what is going on..

I also have:

Code:
        SetMode(MODE_0 | BG0_ENABLE | BG1_ENABLE);

if it helps any.

Thanks in advance.

#6183 - niltsair - Mon May 19, 2003 4:42 am

Perhaps if you showed us the code you use to load your palette.

#6189 - Daedro - Mon May 19, 2003 8:12 am

Here:

Code:

void PlotBG()
{
   u16* bg0map =(u16*)ScreenBaseBlock(31);
   BlitBG(bg0map,testMap.layers[0].data, testMap.layers[0].w,0,0);
}

int main()
{
    int x=0,y=0;

   u16* bg0map =(u16*)ScreenBaseBlock(31);

        REG_BG0CNT = BG_COLOR_256 | TEXTBG_SIZE_256x256 | (31 << SCREEN_SHIFT) | WRAPAROUND;

        SetMode(MODE_0 | BG0_ENABLE | BG1_ENABLE);

   //now we use aour DMA copy rotuine to copy in the palette
   DMA_Copy(3,(void*)testMap.pal,(void*)BGPaletteMem,256,DMA_16NOW);

   //now we copy in the tile data
   DMA_Copy(3,(void*)testMap.tiledata,(void*)CharBaseBlock(0),testMap.tileDataSize/4,DMA_32NOW);

        BlitBG(bg0map,testMap.layers[1].data, testMap.layers[0].w,0,0);

        while(1)
   {

        while(!(REG_DISPSTAT & 1)); //wait for vblank to start

        if(!(*KEYS & KEY_START)) //hittem up
   
        {
           PlotBG(); // my border referal
        }
       
        while((REG_DISPSTAT & 1));
       
        }
}


It is probably how its being setup.. before i loaded a palette and then data, i have an extra in here now and it gets bad. I am using the basic map editor that thepernproject suggests.. is outputs like: testMap.layers[1].data

Its a strange one.. or maybe its seems like that because I move around to different ways or formatting a lot lately. I use own map editor, no fliping or selecting mulitple tiles... another doesnt export to c, ect ect ect. Anyone suggest a very nice map editor?