Problem with 768pxx768px bg

Post Reply
OdnetninI
Posts: 19
Joined: Sat Nov 20, 2010 12:38 pm

Problem with 768pxx768px bg

Post by OdnetninI » Tue Nov 01, 2011 4:22 pm

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:
Image
and the code is:
http://devkitpro.org/download/file.php?mode=view&id=56
Attachments
EJ1.rar
code of problem
(46.06 KiB) Downloaded 958 times
Sin título.png
problem bg
(41.17 KiB) Not downloaded yet

elhobbs
Posts: 358
Joined: Thu Jul 02, 2009 1:19 pm

Re: Problem with 768pxx768px bg

Post by elhobbs » Tue Nov 01, 2011 5:49 pm

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.

OdnetninI
Posts: 19
Joined: Sat Nov 20, 2010 12:38 pm

Re: Problem with 768pxx768px bg

Post by OdnetninI » Tue Nov 01, 2011 5:54 pm

mmm,
but, with up screen, what i can do?

Dwedit
Posts: 43
Joined: Sun Jan 06, 2008 4:06 am

Re: Problem with 768pxx768px bg

Post by Dwedit » Wed Nov 02, 2011 5:35 pm

By any chance, did you call something else that writes to VRAM, such as iprintf?

OdnetninI
Posts: 19
Joined: Sat Nov 20, 2010 12:38 pm

Re: Problem with 768pxx768px bg

Post by OdnetninI » Wed Nov 02, 2011 7:55 pm

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

mtheall
Posts: 211
Joined: Thu Feb 03, 2011 10:47 pm

Re: Problem with 768pxx768px bg

Post by mtheall » Thu Nov 03, 2011 3:48 am

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.

mtheall
Posts: 211
Joined: Thu Feb 03, 2011 10:47 pm

Re: Problem with 768pxx768px bg

Post by mtheall » Thu Nov 03, 2011 5:03 am

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).

OdnetninI
Posts: 19
Joined: Sat Nov 20, 2010 12:38 pm

Re: Problem with 768pxx768px bg

Post by OdnetninI » Thu Nov 03, 2011 9:20 pm

I make the changes that you say, but the result is the same.
Anything else?

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests