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 > Please Help: Mode 5 on Both Screens

#66288 - Rinky - Mon Jan 09, 2006 3:39 pm

I absolutely can not get the Extended Rotation Background to work on the touch screen. I've search the forum and tried a thousand different things but it just stays blank.

I have a BMP class which renders itself to the specified buffer; both BMPs work fine if drawn to the top screen e.g. topBMP.render((uint16*)VRAM_0);

Anyway...

I power on and swap the screens (just for DSEmu)...

Code:
   
powerON(POWER_ALL);
lcdSwap();


Then set the video mode for the top screen
Code:

   videoSetMode(MODE_5_2D | DISPLAY_BG2_ACTIVE);
   vramSetBankA(VRAM_A_MAIN_BG_0x6000000);
   BG2_CR = BG_BMP16_256x256;
      
   BG2_XDX = 1<<8;
   BG2_XDY = 0;
   BG2_YDX = 0;
   BG2_YDY = 1<<8;
   BG2_CY = 0;
   BG2_CX = 0;   

Now calling the render method of my BMP class with the parameter VRAM_0 displays EITHER file on the top screen perfectly.

I deal with the second screen...

Code:

   videoSetModeSub(MODE_5_2D | DISPLAY_BG3_ACTIVE);
   vramSetBankC(VRAM_C_SUB_BG_0x6200000);
   SUB_BG3_CR = BG_BMP16_256x256;

   SUB_BG3_XDX = 1<<8;
   SUB_BG3_XDY = 0;
   SUB_BG3_YDX = 0;
   SUB_BG3_YDY = 1<<8;
   SUB_BG3_CY = 0;
   SUB_BG3_CX = 0;      

and try to "render" to display. E.g. bmp.render((uint16*)0x6200000); but it stays blank.

The memory viewer in DSEmu would suggest that nothing is being written to the memory bank i.e. it isn't enabled properly???? I've also tried doing a direct write and this doesn't work either

Code:

uint16* buf;
buf = (uint16*)0x6200000;
*buf = RGB15(255,0,0) | BIT(15);


Can anyone give me the code to activate Mode 5 on the sub screen; and explain where I'm going wrong.

It'd really be appreciated.

#66312 - Rinky - Mon Jan 09, 2006 6:47 pm

Hmm... it seems that the problem isn't exactly what I thought.

I can display the bottom picture only if the top one isn't displayed.
And vice versa.

However, if I write directly to VRAM e.g.


Code:

      uint16* tmp   = (uint16*)0x6200000;
      *tmp = RGB15(255,0,0) | BIT(15);
         
      uint16* tmp2 = (uint16*)0x6000000;
      *tmp2 = RGB15(255,255,255) | BIT(15);   


Then both work. Must be some kind of problem with my render method in the BMP classes.

#66317 - Rinky - Mon Jan 09, 2006 7:18 pm

Yep, got it.

Thanks for all your help guys. ;) I'm kidding.

Anyway, I didn't realise that when Photoshop saves a BMP with reverse row ordering then it sets the MSB of the bitmaps height attribute = a negative number. This was causing problems in my loop.