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 > Tile background problem

#59386 - alangerow - Tue Nov 01, 2005 8:53 am

When trying Headspin's keyboard examples (Extended Keyboard Example 4), I'm getting the first tile repeated for the bottom third of the screen. I've spent all night trying to get it to not do that, to no luck. I'm wondering if anyone may have any advice.

This is a screenshot of the problem:
[Images not permitted - Click here to view it]

And here is a sample of the code:
Code:
   videoSetMode(MODE_0_2D | DISPLAY_BG0_ACTIVE);

   vramSetMainBanks(VRAM_A_MAIN_BG_0x6000000, VRAM_B_MAIN_BG_0x6020000,
         VRAM_C_SUB_BG , VRAM_D_LCD);

   uint16 * map = (uint16 *) SCREEN_BASE_BLOCK(29);

   BG0_CR = BG_COLOR_16 | BG_32x32 | (29 << SCREEN_SHIFT) | (1 << CHAR_SHIFT);

   dmaCopy((uint16 *)keyboard_Palette, (uint16 *)BG_PALETTE, 32);
   dmaCopy((uint16 *)keyboard_Map, (uint16 *)map, 1024);
   dmaCopy((uint16 *)keyboard_Tiles, (uint16 *)CHAR_BASE_BLOCK(1), 14080);

#59399 - GPFerror - Tue Nov 01, 2005 2:55 pm

this is what I did as a workaround to solve the same problem

first I ran this code

Code:
   char a[10];
   int i;
   for(i=0;i<10816;i++) {
            if (keyboard_Tiles[i] == 0 ) {
           
            sprintf(a,"tile # %d",i);
            print(a);
            break;
            }
            }

so I could figure out where in the keyboard map was a blank tile
then I replace the above code with this

Code:
    for(int i=0;i<768;i++) map[i] = 7008; //blank tile


where the 7008 was the tile number the code above found in my keyboard map. and that cleared the rest of the keyboard screen.

Troy(GPF)

#59444 - alangerow - Tue Nov 01, 2005 9:19 pm

Thank you! Your reply helped me not only figure out how to correct the problem, but it also helped me understand tiles more in general. Thank you very much for the response.