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 > Help with a single background layer over both screens

#117493 - rezen - Mon Feb 05, 2007 3:21 am

Hi there.

Just a noob here. I am currently just messing around with the tutorials and I wanted to modify one of the bitmap ones (rotscale_text) so it can be shown within both screens when it stretches over the bottom screen.

Would I have to setup 2 areas in VRAM for the bitmap or can 1 be shown across both screens at the same time??

#117541 - JessTicular - Mon Feb 05, 2007 2:33 pm

Yep, you'll have to setup two areas.

The main VRAM starts at 0x06000000 and the sub VRAM starts at 0x06200000.

When the image is moved so far that it should be visible on the second screen, you'll have to then start scrolling that second background aswell as the main background. I think the gap between screens is 42px, but don't hold me to it.

[EDIT]
So, you could do something like this to set it up:

Code:
   // We want an extended-rotation background
   //  We can have up to 512x512 on BG3, but since we
   //  only want a single full-screen image, then we'll just be using 256x256
   //  (which conveiniently fits into just one VRAM)
   videoSetMode(MODE_3_2D | DISPLAY_BG3_ACTIVE);

   // And the same for the sub screen
   videoSetModeSub(MODE_3_2D | DISPLAY_BG3_ACTIVE);

   // Setting VRAM A to the main BG - givnig us 128KiB, exactly what we need for a 256x256x16 image
   vramSetBankA(VRAM_A_MAIN_BG_0x06000000);

   // Setting VRAM C to be sub BG
   vramSetBankC(VRAM_C_SUB_BG_0x6200000);


[/EDIT]
_________________
Nintendo DS & Dominos :: DS Dominos
http://jt0.org

#117577 - HyperHacker - Mon Feb 05, 2007 10:07 pm

I believe the gap is 96px, might be different on Lites though. That's what Moonshell uses by default.
_________________
I'm a PSP hacker now, but I still <3 DS.

#117642 - JessTicular - Tue Feb 06, 2007 8:28 am

Sweet, thanks for that.

I just whipped out my ruler and got 89.9px (so, 90px) gap.

96px sounds about right, and if moonshell uses it, then it's best to stick with an already established standard.

Cheers,
Jess.
_________________
Nintendo DS & Dominos :: DS Dominos
http://jt0.org