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:
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).
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!
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).
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,






