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 > vram bank help

#170393 - tine622 - Mon Sep 21, 2009 6:31 am

Hello, I have a piece of code that allocates vram bank B and sets up a screen for the main window. Can anyone help me to convert this code to set up the screen for the sub screen on vram bank C?


Code:
 
videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE); 
vramSetBankB(VRAM_B_MAIN_BG_0x06020000);

BACKGROUND.control[3] = BG_BMP16_256x256 | BG_BMP_BASE(8) | BG_PRIORITY(3);
BACKGROUND.bg3_rotation.xdx = 1 << 8;
BACKGROUND.bg3_rotation.xdy = 0;
BACKGROUND.bg3_rotation.ydx = 0;
BACKGROUND.bg3_rotation.ydy = 1 << 8;

*screen = new BScreen((uint16*)BG_BMP_RAM(8), BSize(256,192)); // BG3 on main


I know it is something simple but I am having a horrible time trying to wrap my mind around the vram bank allocation. Thanks for your help =)

Mark Carpenter

#170394 - DiscoStew - Mon Sep 21, 2009 7:03 am

I think this might be the way, according to your original setup. Tell us if it works. :)

Code:
videoSetModeSub( MODE_5_2D | DISPLAY_BG3_ACTIVE );
vramSetBankC( VRAM_C_SUB_BG );

BACKGROUND_SUB.control[ 3 ] = BG_BMP16_256x256 | BG_BMP_BASE( 0 ) | BG_PRIORITY( 3 );
BACKGROUND_SUB.bg3_rotation.xdx = 1 << 8;
BACKGROUND_SUB.bg3_rotation.xdy = 0;
BACKGROUND_SUB.bg3_rotation.ydx = 0;
BACKGROUND_SUB.bg3_rotation.ydy = 1 << 8;

*screen = new BScreen((uint16*)BG_BMP_RAM_SUB( 0 ), BSize( 256, 192 ));

_________________
DS - It's all about DiscoStew

#170414 - tine622 - Tue Sep 22, 2009 3:47 am

Thanks for the response! That worked perfectly.


Mark Carpenter