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 > More Windows on DS

#165608 - MaesterRowen - Mon Dec 29, 2008 10:42 pm

I am having some trouble, that maybe someone here can help clarify for me.

Using Window 0, Bits 0 - 5 control each item that can be included in window0

Using Window 1, Bits 8-13 control each item that can be included in window1

Now to include everything in window 0, I create the define WIN0_ALL 0x3F

My experience tells me to include everything in window 1, without affecting window 0 would be to create the define WIN1_ALL 0x3F << 8

However, it only works when I create the define WIN1_ALL 0x3FFF. Now to me, it seems like that would affect any information in WIN0.

Here is a snippet of my code to see if its something in there that might be problematic:

Code:

#define WIN0_BG0 BIT(0)
#define WIN0_BG1 BIT(1)
#define WIN0_BG2 BIT(2)
#define WIN0_BG3 BIT(3)
#define WIN0_OBJ BIT(4)
#define WIN0_GFX BIT(5)
#define WIN0_ALL 0x3F

#define WIN1_BG0 BIT(8)
#define WIN1_BG1 BIT(9)
#define WIN1_BG2 BIT(10)
#define WIN1_BG3 BIT(11)
#define WIN1_OBJ BIT(12)
#define WIN1_GFX BIT(13)
#define WIN1_ALL 0x3F << 8

(code inside my init function below)

   videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE | DISPLAY_WIN1_ON);

   WIN1_X0 = 64;
   WIN1_X1 = 128;
   WIN1_Y0 = 64;
   WIN1_Y1 = 128;
   
   WIN_IN = WIN1_ALL ^ WIN1_GFX;
   WIN_OUT = WIN1_ALL;
   
   BLEND_CR = BLEND_SRC_BG3 | BLEND_FADE_BLACK;
   BLEND_Y = 12;


Now the Idea is to have my Background be faded with Window 1 showing a rectangular non-faded portion of the background.

When I change all of my WIN1's to WIN0 it works fine. Any help would be awesome!

Thanks.

#165609 - dovoto - Mon Dec 29, 2008 10:54 pm

Your way:

Code:

#define WIN1_ALL 0x3F << 8


BAD!!!!!!!!


My way:

Code:

#define WIN1_ALL (0x3F << 8)


GOOD!!!!!

Your way:
Code:

WIN_IN = WIN1_ALL ^ WIN1_GFX;

//aka
WIN_IN = 0x3F << 8 ^ BIT(13);

//aka
WIN_IN = 0x3F << (8200);  //probably not going to work


BAD!!!!
_________________
www.drunkencoders.com

#165610 - MaesterRowen - Mon Dec 29, 2008 10:55 pm

Nice, gotchya.

Let me try it out.

#165611 - MaesterRowen - Mon Dec 29, 2008 11:00 pm

Actually, that was a good catch and definitely problematic.

But it seems, after looking closely at the TONC guide for the bit layout of the WIN_IN and WIN_OUT I noticed it says that the upper bits for WIN_OUT are for WIN_OBJ.


I ended up making this change:

Code:


WIN_IN = WIN1_ALL ^ WIN1_GFX;
WIN_OUT = 0x3F;



Combined with your fix, and this change, it works now under Window 1.

Now to figure out how to get sprites to work as a window mask. ><.