Homebrew Help with libnds bottom screen

  • Thread starter Thread starter DerSamelt
  • Start date Start date
  • Views Views 4,884
  • Replies Replies 0

DerSamelt

Member
Newcomer
Joined
Mar 8, 2025
Messages
13
Reaction score
2
Trophies
0
XP
64
Country
Germany
Hello, I've been trying to display my tiles on the bottom screen of the DS using libnds. After looking at several examples and the documentation I made this:
Code:
int bg;

int main(int argc, char* argv[]){
    videoSetModeSub(MODE_0_2D);
    vramSetBankC(VRAM_C_SUB_BG);
 
    bg = bgInitSub(0, BgType_Text_4bpp, BgSize_T_256x256, 1, 0);
    dmaCopy(tilesetPal, BG_PALETTE_SUB, tilesetPalLen);
    dmaCopy(tilesetTiles, bgGetGfxPtr(bg), tilesetTilesLen);
    dmaCopy(tilesetMap, bgGetMapPtr(bg), tilesetMapLen);
}

Yet, I've come across a few problems.
First, the code worked fine when I did it on the main engine, so it doesn't seem like the Tileset / Map is the problem. But on the sub screen, nothing got displayed.

When I took a look in NO$GBA I've noticed, that the adress to the tileset in the memory is set at 0x06000000, but when I checked the adress from bgGetGfxPtr(bg), it outputs 0x0620C000, so as it seemed in a different spot. Then I tried replacing the bgGetGfxPtr(bg) with BG_GFX (so it gets copied to 0x06000000), and when I checked there, the tileset was visible in NO$GBA (under the Tiles tab). When I looked at the BG0 though, it was empty, except for the fact that when I hovered over one grid tile the tile was there (see picture 1).

problemsubscreen1.png


problemsubscreen2.png


So my question is, why is it extracting the tiles from that adress when the background Gfx Pointer is set to a different location, and or if I missed some crucial step or forgot to account for something.

Any help appreciated!
 
Last edited by DerSamelt,

Site & Scene News

Popular threads in this forum