Original Post
I''m a bit confused here...
I''ve got a GBA project going in Mode 0, and I''m using four backgrounds. However, some of the data I put for BG0 is always corrupted... And frankly, I don''t understand what''s going on. Here''s a code clip:
Just for your information, most of the constants, etc. come from Dovoto''s tutorials, but a few might be from Staring Monkey''s also. You can probably get the point, even if you haven''t seen them, though.
When I run this code, the data for a number of the tiles on the bottom layer (BG3) is just blue garbage. It''s almost like some of the data in CHAR_BASE(0) is unavailable to me, or edited elsewhere. I can''t find anywhere in my code that I might be messing with the image data for the backgrounds though. Is it possible that I''m using more space than is given to me in each base block? If that''s the case, I don''t get why it only happens on the layer assigned to base 0. That, and the tiles at the end of the array don''t always get garbled... Anyone have any ideas?
-Arek the Absolute
// set up backgrounds
REG_BG0CNT = TEXTBG_SIZE_256x256 | CHAR_BASE(3) | SCREEN_BASE(0) | BG_COLOR_256 | BG_PRIORITY(0);
REG_BG1CNT = TEXTBG_SIZE_256x256 | CHAR_BASE(2) | SCREEN_BASE(20)| BG_COLOR_256 | BG_PRIORITY(1);
REG_BG2CNT = TEXTBG_SIZE_256x256 | CHAR_BASE(1) | SCREEN_BASE(3) | BG_MOSAIC_ENABLE | BG_COLOR_256 | BG_PRIORITY(2);
REG_BG3CNT = TEXTBG_SIZE_256x256 | CHAR_BASE(0) | SCREEN_BASE(9) | BG_MOSAIC_ENABLE | BG_COLOR_256 | BG_PRIORITY(3);
// load the background palette
for (i = 0; i < 256; i++)
BGPaletteMemory[i] = BGPalette[i];
// copy the tiles to the background memory
u16* Background3Mem = (u16 *)CharBaseBlock(0);
u16* Background2Mem = (u16 *)CharBaseBlock(1);
u16* Background1Mem = (u16 *)CharBaseBlock(2);
u16* Background0Mem = (u16 *)CharBaseBlock(3);
// the tileset intended for each layer is 128x128, or 16x16 tiles
for (i = 0; i < 128*128/2; i++){
Background3Mem[i] = image[i];
Background2Mem[i] = image[i+8192];
Background1Mem[i] = image[i+16384];
Background0Mem[i] = 0x0000; // I have my reasons.
}
// set the screen mode
SetMode(MODE_0 | BG2_ENABLE | BG3_ENABLE | BG0_ENABLE | BG1_ENABLE | OBJ_ENABLE | OBJ_MAP_1D);