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 > Blank Screen Problems.

#44124 - TheMikaus - Mon May 30, 2005 4:16 pm

I know I saw this on the forum, but when I did a search for blank screen I couldn't find what I was looking for. So I apologize ahead of time if this is already on here somewhere.

Code:

powerON(POWER_ALL);

   videoSetMode(MODE_0_2D | DISPLAY_BG0_ACTIVE);
   videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE);
   
   vramSetMainBanks(VRAM_A_MAIN_BG, VRAM_B_MAIN_SPRITE, VRAM_C_SUB_BG, VRAM_D_SUB_SPRITE);
#ifndef EMULATOR   
   lcdSwap();
#endif

  irqInitHandler(irqDefaultHandler);
  irqSet(IRQ_VBLANK, 0);
  irqEnable(IRQ_VBLANK);
 
  //get the maps
  uint16 * map0 = (uint16 *)SCREEN_BASE_BLOCK(0);
  uint16 * map1 = (uint16 *)SCREEN_BASE_BLOCK_SUB(0);
 
 
  //Make both the top and the bottom maps 256 color screens
  BG0_CR = BG_COLOR_256 | BG_32x32 | (0 << SCREEN_SHIFT) | (1 << CHAR_SHIFT);
  SUB_BG0_CR = BG_COLOR_256 | BG_32x32 | (0 << SCREEN_SHIFT) | (1 << CHAR_SHIFT);
 
  //Copy the needed palette info
  COPY16((uint16*)splashPal, (uint16 *)BG_PALETTE, 256);
  COPY16((uint16*)splashSubPal, (uint16 *)BG_PALETTE_SUB, 256);
 
  //Copy the needed tile info
  COPY16((uint16*)splashTile,(uint16 *)CHAR_BASE_BLOCK(1), 26000);
  COPY16((uint16*)touchTile,(uint16 *)CHAR_BASE_BLOCK_SUB(1), 26000);


From there I go on to load the map tiles and such. It works fine on the emulator but when I run it on the DS I get to black screens. Can someone tell me what it is that I'm forgetting to initialize properly?

-------------EDIT---------------
I think it has to do with loading the tiles, but I'm not sure. I used the birds project as a template of sorts for this. So here's a download link.
http://www.themikausprojects.com/ds-temp.zip

Help!!!! Please.

#44181 - TheMikaus - Mon May 30, 2005 10:42 pm

I changed my COPY16 calls to dmaCopy and then I changed the screen base block to 31 (I could probably have used 29 as well) and it worked! yeah.

I was using 0 originally because that's what the demo I was looking at used. So yeah. Fun!

#44336 - tepples - Tue May 31, 2005 9:39 pm

Right. When you're starting out, use the higher numbered maps unless you have a good reason not to.

EDIT: Yet another lucky guess where a GBA answer works on DS!
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.


Last edited by tepples on Wed Jun 01, 2005 1:01 am; edited 1 time in total

#44345 - TheMikaus - Tue May 31, 2005 10:14 pm

Yeah. Actually it's something I should have remembered from GBA stuff, but the example I saw used 0 so I used 0 and the emu seemed to work. Now I use 31 and it works on hardware and crashes the emu. :)