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 > Can you use bank H and I to do a subscreen MODE_5_2D? A: yes

#167658 - TwentySeven - Sat Mar 21, 2009 1:40 pm

As the topic says:
Can you use bank H and I to do a subscreen MODE_5_2D?

Ie:
videoSetModeSub(MODE_5_2D | DISPLAY_BG3_ACTIVE );
vramSetBankH(VRAM_H_SUB_BG);
SUB_BG3_CR = BG_BMP8_256x256;

and then plot pixels to it?

I currently have H and I allocated to do a text mode and sprites for the sub screen, which works fine, but it'd be much nicer if I could just use all 48kb and treat it as a framebuffer.

#167663 - TwentySeven - Sat Mar 21, 2009 2:33 pm

Sorry, I was having a brain fade this evening. I have it working now.

It's a very cheap way to get a 256 colour "framebuffer" on the sub screen, if you're not using H and I for anything else :) The ds doesn't seem to mind that H+I is only 48kb, so long as you say within 256x192.

This works out well for me, because I really didn't want to have to give up one of the texture banks (A,B,C,D) to do a nice subscreen BG.

Straightforward:

videoSetModeSub(MODE_5_2D | DISPLAY_BG3_ACTIVE );

vramSetBankH(VRAM_H_SUB_BG); // 32k bank
vramSetBankI(VRAM_I_SUB_BG); // 16k bank

SUB_BG3_CR = BG_BMP8_256x256;

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