sub engine LCD access

Post Reply
The4thcircle
Posts: 1
Joined: Sat Mar 07, 2009 12:07 am

sub engine LCD access

Post by The4thcircle » Sat May 30, 2009 11:25 pm

Hi there, I'm just starting to get into DS coding, and I'm making a little paint program.

This isn't about that though, what it is about is me trying to wrestle control of the sub engine.

Is there any way to get the sub engine to accept a raw LCD screenbuffer?

I've done it on the top but the bottom seems... reluctant. I know I could set it to use the main engine for the bottom screen but then I'm left trying to get direct LCD control on the TOP screen.

My ides sort of needs both simultaneously. Is that even possible?

Stripping out the unneeded parts, the sequence I'm essentially doing is:


vramSetMainBanks(VRAM_A_LCD, VRAM_B_LCD, VRAM_C_LCD, VRAM_D_LCD);

videoSetMode(MODE_FB1);
videoSetModeSub(MODE_FB2);

//do stuff on VRAM_C
videoSetMode(MODE_FB3);
//do stuff on VRAM_A
videoSetModeSub(MODE_FB1);
//do stuff on VRAM_B

and so on. I'm sort of doing a pass the parcel with the unused vram acting as my working buffer.

it displays just fine on the main engine but my sub engine screen stays resolutely blank.
Any advice?


-T4C

User avatar
vuurrobin
Posts: 219
Joined: Fri Jul 11, 2008 8:49 pm
Location: The Netherlands
Contact:

Re: sub engine LCD access

Post by vuurrobin » Sun May 31, 2009 1:11 am

the sub engine doesn't have a framebuffer mode.

see here for all the posible modes:
http://www.dev-scene.com/NDS/Tutorials_Day_2#2D

Al_Bro
Posts: 15
Joined: Wed Apr 08, 2009 10:33 pm

Re: sub engine LCD access

Post by Al_Bro » Wed Jun 03, 2009 9:27 pm

If you're just wanting direct access to the sub-engine then it can be done. I've got a test program that uses the main engine for 3D and I've experimented with using banks H and I for the sub-engine (there's just enough RAM there).

Try something like:

Code: Select all

	videoSetModeSub(MODE_5_2D);
	vramSetBankH(VRAM_H_SUB_BG);
	vramSetBankI(VRAM_I_SUB_BG_0x06208000);
	int SubPtr = bgInitSub(2, BgType_Bmp8, BgSize_B8_256x256, 0, 0);
	for(int i=0; i < 256; i++)
	{
		BG_PALETTE_SUB[i] = RGB15(i & 0x1F, i & 0x1F, i & 0x1F);
	}
	u16 *SubData = bgGetGfxPtr(SubPtr);
	for(int y=0; y < 128; y++)
	{
		for(int x=0; x < 192 / 2; x++)
			SubData[x + y * 192 / 2] = ((x * 2) & 0xFF) | (((x * 2 + 1) << 8) & 0xFF00);
	}
Of course, that's not a practical application - you'd want to make sure you use a proper palette and it's quite likely to contain some bugs (design or otherwise!).

Post Reply

Who is online

Users browsing this forum: Jotalinho and 7 guests