Page 1 of 1

VRAM_B completely useless?? (Self-Solved)

Posted: Sat Apr 03, 2010 2:26 am
by Aerolite
Hey all,

Been looking over these forums for quite a while now regarding various issues, but now I have a particularly odd issue to report myself...

In the process of writing a game, I came across (after much tedious debugging/hairpulling) in interesting problem with VRAM_B that is easily reproducible. Essentially... it doesn't work. At all. :S
I've tried using it for both VRAM_B_MAIN_BG and VRAM_B_MAIN_SPRITE, and both result in any non-palette data-transfers to the appropriate regions failing. Its not my code, because not only have I gone over it all at least 10 times, but if I simply switch out VRAM_B for say VRAM_E, it works fine (albeit with lesser storage).

The simplest way to demonstrate this issue is with the official libnds examples.

With the Simple Sprite example, simply change the line "vramSetBankA(VRAM_A_MAIN_SPRITE);" to "vramSetBankB(VRAM_B_MAIN_SPRITE);". This results in the subscreen sprite being fine, while the mainscreen sprite is simply not there. A check with the debug version of No$GBA shows that the sprite attributes have all been set, and the palette written correctly, yet the tile data is no where to be found.

This can also be demonstrated with the Allocation Test example. Simply comment out the line "vramSetBankA(VRAM_A_MAIN_SPRITE);", and leave the next line "vramSetBankB(VRAM_B_MAIN_SPRITE);" intact. A check with both the No$GBA and Ensata emulators simply shows no visuals.

Does anyone have any ideas as to what could possibly be causing this? Currently I could probably safely use the VRAM_E for my sprites, but as my game expands that 64k may not be enough...

Re: VRAM_B completely useless??

Posted: Sat Apr 03, 2010 2:58 am
by Aerolite
Lol.
Ironically, despite me trying for days to work out why this issue was occurring, about 10mins after making this post I found the solution. :roll:

This thread outlines the same issue I was having, and how to fix it. It essentially was a simple offsetting error which I didn't take into account. The fix basically just involves replacing VRAM_B_MAIN_SPRITE with VRAM_B_MAIN_SPRITE_0x06400000 to make sure it maps to the first block in memory.

Thanks once again to this forum for giving me the answer to a particularly annoying problem. :)

Re: VRAM_B completely useless?? (Self-Solved)

Posted: Sat Apr 03, 2010 10:45 am
by WinterMute
Funnily enough I've just committed a change to libnds which removes the offset, we had a bit of a discussion about that on IRC yesterday.