Page 1 of 1
Problem with 768pxx768px bg
Posted: Tue Nov 01, 2011 4:22 pm
by OdnetninI
hi friends,
I'm trying put a 768x768 px background and do it scroll, but the final is:
in the top: when I do scroll, the result is
and in the botton whithout scroll there are many black px:
and the code is:
http://devkitpro.org/download/file.php?mode=view&id=56
Re: Problem with 768pxx768px bg
Posted: Tue Nov 01, 2011 5:49 pm
by elhobbs
at a quick glance at your code it looks like you are using 8 bit backgrounds. I believe that palette index 0 is reserved for transparent and cannot be mapped to a color.
Re: Problem with 768pxx768px bg
Posted: Tue Nov 01, 2011 5:54 pm
by OdnetninI
mmm,
but, with up screen, what i can do?
Re: Problem with 768pxx768px bg
Posted: Wed Nov 02, 2011 5:35 pm
by Dwedit
By any chance, did you call something else that writes to VRAM, such as iprintf?
Re: Problem with 768pxx768px bg
Posted: Wed Nov 02, 2011 7:55 pm
by OdnetninI
No, but I think that I have the solve of problem,
result that bg have 1024 diferent tiles, and I'm trying to allocate in ((0x6000000) + (tilebase << 11)) or ((0x6200000) + (tilebase << 11))
, what i can do?
and whith botton screen
Re: Problem with 768pxx768px bg
Posted: Thu Nov 03, 2011 3:48 am
by mtheall
Please make sure you can fill out
this worksheet with no conflicts. If you don't understand the parameters, please visit the irc channel #dsdev on irc.blitzed.org for further assistance.
Re: Problem with 768pxx768px bg
Posted: Thu Nov 03, 2011 5:03 am
by mtheall
It will probably also help to improve readability if you try to use the libnds API's instead of using registers directly:
Code: Select all
void InitBasico(void){
//Iniciar modo de Video
videoSetMode(MODE_0_2D);
videoSetModeSub(MODE_0_2D);
bgExtPaletteEnable();
bgExtPaletteEnableSub();
//Memoria Vram
vramSetPrimaryBanks(VRAM_A_MAIN_BG, VRAM_B_MAIN_SPRITE, VRAM_C_SUB_BG, VRAM_D_SUB_SPRITE);
vramSetBanks_EFG(VRAM_E_LCD, VRAM_F_LCD, VRAM_G_LCD);
vramSetBankH(VRAM_H_LCD);
vramSetBankI(VRAM_I_LCD);
}
Code: Select all
REG_BG0CNT = BgType_Text8bpp | bg_size | BG_PRIORITY_0 | BG_PALETTE_SLOT0 | BG_COLOR_256 | BG_TILE_BASE(1) | BG_MAP_BASE(0);
becomes
Code: Select all
bgInit(0, BgType_Text8bpp, bg_size, 0, 1);
bgSetPriority(0, 0);
though you may need to change the way you define bg_size.
However, your CreateBG function is a little too generic; it is prone to corrupt video. You can easily
see the limitations on your backgrounds are with the values hard-coded in this function without the risk of corrupt video.
Note: For REG_BG2CNT and REG_BG2CNT_SUB you used BG_MAP_BASE(5) where I think you mean 2 (the rest of the code in that block uses 2).
Re: Problem with 768pxx768px bg
Posted: Thu Nov 03, 2011 9:20 pm
by OdnetninI
I make the changes that you say, but the result is the same.
Anything else?