Palette and PrintConsole and more...

Post Reply
Sylus101
Posts: 179
Joined: Wed Dec 24, 2008 5:08 am

Palette and PrintConsole and more...

Post by Sylus101 » Fri Feb 20, 2009 8:29 pm

What palette index positions, if not using extended palettes, does initializing a print console take up?

Also, I am trying to convert to make sure of extended background palettes and can't quite figure it out. I'll post some code later, but if this procedure has something inherently wrong with it, let me know...

This is for SUB Engine, 8 bit ext rot bg, Bg layer 3.

Use bgInit to setup the background, bgInitSub(3, BgType_Bmp8, BgSize_B8_256x256, 0, 0);

Set bit 30 in Sub Display Control to 1.
Set VRAM H control to LCD.

Write palette via DMA to &VRAM_H[12288] (that should be the start of slot 3).

Set VRAM H control to be Extended Palette.

Load graphics into VRAM location allocated to sub bg graphics, C in this case. This had been working when there was just one palette.

Sorry for the sloppy post. I'm hoping there's just something wrong in general with this method.
Last edited by Sylus101 on Fri Feb 20, 2009 11:32 pm, edited 2 times in total.
-Sylus "Not Stylus..." McFrederickson

Come visit my web site.

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

Re: Palette and PrintConsole and more...

Post by vuurrobin » Fri Feb 20, 2009 10:00 pm

255 for the text, not sure about the background.

Code: Select all

#include <nds.h>
#include <cstdio>

int main(void)
{
	powerOn(POWER_ALL_2D);

	consoleDemoInit();

	BG_PALETTE_SUB[255] = RGB15(31, 0, 0);

	printf("Hello World");

	return 0;
}

I dont really understand you second part, but thats probably just me. I dont have that much experience and I've never worked with extended pallettes.

Sylus101
Posts: 179
Joined: Wed Dec 24, 2008 5:08 am

Re: Palette and PrintConsole and more...

Post by Sylus101 » Fri Feb 20, 2009 10:29 pm

This is helpful, though, thank you!

I am having a major brain struggle, though, with amount of vram used on background ext palettes...

For sprites, one engine has 16 palettes with 256 16 bit colors. This is just 8KB.

What the heck is the 32KB used for for the backgrounds??? If I've only got 4 layers, don't I need a grand total of just 2KB for one engine??

Okay, I read and re-read gbatek and found this:
BG Extended Palette enabled in DISPCNT Bit 30, when enabled,

standard palette --> 16-color tiles (with 16bit bgmap entries) (text)
256-color tiles (with 8bit bgmap entries) (rot/scal)
256-color bitmaps
backdrop-color (color 0)
extended palette --> 256-color tiles (with 16bit bgmap entries)(text,rot/scal)

Sooooo, I guess I was being stubborn and just passing that up... so the an 8bit bitmap is going to look at the standard palette location for it's colors, that's cool, I can live with that.

That still leaves me questioning exactly how that 32KB is spent for tiled bg palettes?
-Sylus "Not Stylus..." McFrederickson

Come visit my web site.

Sylus101
Posts: 179
Joined: Wed Dec 24, 2008 5:08 am

Re: Palette and PrintConsole and more...

Post by Sylus101 » Fri Mar 13, 2009 3:10 pm

Sorry for the double post (I think enough time past) but this was left with an unanswered question.

"What the heck is the 32KB used for for the backgrounds??? If I've only got 4 layers, don't I need a grand total of just 2KB for one engine??"
-Sylus "Not Stylus..." McFrederickson

Come visit my web site.

WinterMute
Site Admin
Posts: 2003
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Palette and PrintConsole and more...

Post by WinterMute » Sun Mar 15, 2009 11:54 pm

16 256 color palettes for each layer.
Help keep devkitPro toolchains free, Donate today

Personal Blog

Sylus101
Posts: 179
Joined: Wed Dec 24, 2008 5:08 am

Re: Palette and PrintConsole and more...

Post by Sylus101 » Mon Mar 16, 2009 8:25 pm

Wow?!?! Any theory on why so much? I suppose you could pull some cool palette shifting effects that way.

Okay, so gbatek shows that it's 4 slots of 8K each, and from what I can tell, each layer initially uses it's same numbered slot (except where BG0 and BG1 can be changed).

Now, where do you tell a BG to use one of the 16 palettes that are in each slot? So far all I can find was bit 13 for BG0 and BG1 that could specify a whole slot change.

EDIT - And one other question about the Console. How much memory exactly does the tile and map data take up, respectively?
-Sylus "Not Stylus..." McFrederickson

Come visit my web site.

WinterMute
Site Admin
Posts: 2003
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Palette and PrintConsole and more...

Post by WinterMute » Wed Mar 25, 2009 10:59 am

Normally the slot number corresponds to the background number except where, as you noted, the slots for bg0 & bg1 can be changed.

The reasoning behind this is probably to allow for more complex tilesets for multilayer games - platform style games with parallax spring to mind. With the extra VRAM on the DS you can basically have a unique tileset with it's own palette for each layer that you display and not have the maps and tiles dependent on each other.

Map & tile data for the console takes either 8k or 16k for 16 & 256 color tiles respectively plus 2k for the map.
Help keep devkitPro toolchains free, Donate today

Personal Blog

Sylus101
Posts: 179
Joined: Wed Dec 24, 2008 5:08 am

Re: Palette and PrintConsole and more...

Post by Sylus101 » Wed Mar 25, 2009 7:35 pm

Ah okay. That helps.

I'm still a bit confused about how to "tell" a background to use a particular position (of the 16 available) inside an individual slot.

If an example using extended palettes for backgrounds could be added that would be great.

Thanks again.
-Sylus "Not Stylus..." McFrederickson

Come visit my web site.

dovoto
Developer
Posts: 43
Joined: Fri Aug 12, 2005 10:01 pm
Contact:

Re: Palette and PrintConsole and more...

Post by dovoto » Tue Apr 21, 2009 5:15 pm

its actually the tile which selects which palette to use. each tile index has four bits for choosing a palette so a single layer can actually contain 4k unique colors with each tile containing up to 256. finding map and tile tools to take advantage of this would be challenging though.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 5 guests