Bginit using registers
Posted: Thu May 14, 2009 9:12 am
Hello again,
I'm trying to understand exactly what bgInit does and so i'm recreating the init using the registers. However it isn't quite working. What does work:
int bg1 = bgInit(3, BgType_ExRotation, BgSize_ER_256x256, 0,1);
dmaCopy(mikeTiles, bgGetGfxPtr(bg1), mikeTilesLen);
dmaCopy(mikePal, BG_PALETTE, mikePalLen);
dmaCopy(mikeMap, bgGetMapPtr(bg1), mikeMapLen);
What doesn't work:
videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE);
vramSetBankA(VRAM_A_MAIN_BG);
REG_BG3CNT = BG_MAP_BASE(0) | BG_TILE_BASE(1) | BG_COLOR_256 | BG_PRIORITY(2);
REG_BG3PA = 1 << 8;
REG_BG3PB = 0;
REG_BG3PC = 0;
REG_BG3PD = 1 << 8;
dmaCopy(mikeTiles, BG_TILE_RAM(1), mikeTilesLen);
dmaCopy(mikePal, BG_PALETTE, mikePalLen);
dmaCopy(mikeMap, BG_MAP_BASE(0), mikeMapLen);
Now my problem (i believe) is that i'm not sure how to specify using the registers the size and type of my background, mainly the 256x256 and text type. But when I look at the registry options, none of them are what I expect (i.e. BG_RS_16x16, etc. since I am using text tiles at 8x8) and i don't know what it defaults to.
My grit:
# Set the warning/log level to 3
-W3
# Tile image
-gt
#Include map
-m
#8 bit
-gB8
Thanks for any help,
Mike
I'm trying to understand exactly what bgInit does and so i'm recreating the init using the registers. However it isn't quite working. What does work:
int bg1 = bgInit(3, BgType_ExRotation, BgSize_ER_256x256, 0,1);
dmaCopy(mikeTiles, bgGetGfxPtr(bg1), mikeTilesLen);
dmaCopy(mikePal, BG_PALETTE, mikePalLen);
dmaCopy(mikeMap, bgGetMapPtr(bg1), mikeMapLen);
What doesn't work:
videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE);
vramSetBankA(VRAM_A_MAIN_BG);
REG_BG3CNT = BG_MAP_BASE(0) | BG_TILE_BASE(1) | BG_COLOR_256 | BG_PRIORITY(2);
REG_BG3PA = 1 << 8;
REG_BG3PB = 0;
REG_BG3PC = 0;
REG_BG3PD = 1 << 8;
dmaCopy(mikeTiles, BG_TILE_RAM(1), mikeTilesLen);
dmaCopy(mikePal, BG_PALETTE, mikePalLen);
dmaCopy(mikeMap, BG_MAP_BASE(0), mikeMapLen);
Now my problem (i believe) is that i'm not sure how to specify using the registers the size and type of my background, mainly the 256x256 and text type. But when I look at the registry options, none of them are what I expect (i.e. BG_RS_16x16, etc. since I am using text tiles at 8x8) and i don't know what it defaults to.
My grit:
# Set the warning/log level to 3
-W3
# Tile image
-gt
#Include map
-m
#8 bit
-gB8
Thanks for any help,
Mike