u8* tileMemory = (u8*)BG_TILE_RAM_SUB(1); u16* mapMemory = (u16*)BG_MAP_RAM_SUB(0); SUB_BG0_CR = BG_32x32 | BG_COLOR_256 | BG_MAP_BASE(0) | BG_TILE_BASE(1); swiCopy(tilecolor_Tiles, tileMemory, 64*2); for (i=0 ; i<256 ; i++) BG_PALETTE_SUB[i] = bg_Palette[i]; for(i = 0; i < 32 * 32; i++) mapMemory[i] = 0;
// 64K, can hold palettes for all four BG layers // allocate for cpu access vramSetBankE(VRAM_E_LCD); // background, displayed on BG0, using slot 0. Decompress((void*)(0x6880000), background_pal_bin); // blocks, displayed on BG2, using palette 0 in slot 2 Decompress((void*)(0x6880000 + 256*16*2), sprites_pal_bin); // for 'shaded' blocks, creating an alternate palette in pal1, slot 2 CreateShadedPalette( (u16*)(0x6880000 + 256*17*2), (u16*)(0x6880000 + 256*16*2)); // text, also displayed on BG2, with a third palette (still in slot 2) Decompress((void*)(0x6880000 + 256*16*2*2), font_pal_bin); // then allocate it for extended palette use vramSetBankE(VRAM_E_BG_EXT_PALETTE);
VRAM_F_CR = VRAM_ENABLE | VRAM_OFFSET(0) | VRAM_F_BG_EXT_PALETTE; //< slots 0 et 1VRAM_G_CR = VRAM_ENABLE | VRAM_OFFSET(1) | VRAM_G_BG_EXT_PALETTE; //< slots 2 et 3