gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > ANOTHER scrolling question

#168738 - RedXIV - Tue May 19, 2009 3:49 am

I've been doing a little bit of DS programming and i'm a bit confused with tiled background bigger than average. I've no problem with average tiled backgrounds and I've managed to get them to repeat scrolling but what i have now is a map of size 32 x 320 and i want to scroll down through it, one row of tiles at a time on both screens. I tried loading it in with my 32x32 code and i expected to get the first 32x32 chunk of my 32x320 map but i got a jumbled mess.

Any ideas?

Here's my 32x32 code:


Code:

videoSetMode(MODE_0_2D | DISPLAY_BG0_ACTIVE );


vramSetBankA(VRAM_A_MAIN_BG_0x06000000);



REG_BG0CNT = BG_32x32 | BG_COLOR_256 | BG_MAP_BASE(0) | BG_TILE_BASE(1);


memcpy(BG_MAP_RAM(0), BG_Maps_bin, BG_Maps_bin_size);
memcpy(BG_TILE_RAM(1), BG_Tiles_bin, BG_Tiles_bin_size);
memcpy(BG_PALETTE, BG_Palette_bin, BG_Palette_bin_size);

#168742 - sverx - Tue May 19, 2009 12:47 pm

if your
Code:
BG_Maps_bin_size

is more than 32KB, you'll reach the place where
Code:
BG_TILE_RAM(1)

begins, so your tiles will overwrite (partially) your map...

btw I see no code to replace the part of your BIG map you want to use in your 32x32 map...