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 > Setting DS screen into 64x32 tiles?

#41431 - JL - Thu Apr 28, 2005 10:29 am

Hi guys,

I'm trying to get my code to set the sub screen into 512x256 size (or 64x32 tiles, if you will). I'm using mode 0 and I've been trying several settings for SUB_BG0_CR, but it looks as if it always goes to 32x32 tiles each time.

This is my code:

Code:

videoSetMode(0); //not using the main screen
videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE);
vramSetBankC(VRAM_C_SUB_BG);
            
SUB_BG0_CR = BG_MAP_BASE(29) | WRAPAROUND | BG_RS_64x32 | BG_256_COLOR;


I've tested it on dualis, not on a real NDS yet - maybe that's just it?

JL

#41433 - D^A^V - Thu Apr 28, 2005 11:38 am

got the same probleme.
always 32*32 tiles....

#41454 - josath - Thu Apr 28, 2005 6:18 pm

It works for me. You realize that it's split into two chunks in memory, right?

for example:


Code:

#define MEMORY_OFFSET (1024+32)
void setTile(int x, int y, uint16 *map, uint16 tile)
{
     int realx = x;
     uint16 *realmap = map;
     if(realx > 32)
     {
          realx -= 32;
          realmap += MEMORY_OFFSET;
      }
      map[y*32 + realx] = tile;
}


One thing you need to check, I may have MEMORY_OFFSET defined incorrectly. You should look up what it is.

#41461 - JL - Thu Apr 28, 2005 7:30 pm

Hi Josath,

*ouch*....yes, now that you mentioned it I vaguely remembered something about 2 chunks of memory which I happily ignored in my GBA code because I could get away with 256x256 screens.

Thank you, it's working now! I just assumed that the 512x256 screensize would be flat out....next time I'll read the GBA docs as well if I come across something like this!

Cheers!
JL

#41476 - tepples - Thu Apr 28, 2005 10:50 pm

Correct. 512-pixel-wide maps were split on both the NES and the Super NES.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.