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 > Windowing Woes

#151536 - krozen - Thu Feb 28, 2008 6:10 pm

Hi guys,
I'm having some issues with getting windowing working on the DS. I've tried it out on hardware and emulator with no avail.

So, I've set up window 0 to display a background, and have set the extents using the following code:

Code:

WIN0_X0 = 0;
WIN0_Y0 = 0;
WIN0_X1 = 100;
WIN0_Y1 = 130;


This works fine. However, if I enable window 1 (alone) with the very same extents as follows:
Code:

WIN1_X0 =0;
WIN1_Y0 =0;
WIN1_X1 =100;         
WIN1_Y1 =130;


The background will be displayed about 100 pixels to the right of where it should be. Any suggestions would be great!
Cheers

#151538 - Cearn - Thu Feb 28, 2008 6:27 pm

From video.h:

Code:

// Window 0
#define WIN0_X0        (*(vuint8*)0x04000041)
#define WIN0_X1        (*(vuint8*)0x04000040)
#define WIN0_Y0        (*(vuint8*)0x04000045)
#define WIN0_Y1        (*(vuint8*)0x04000044)

// Window 1
#define WIN1_X0        (*(vuint8*)0x04000042)
#define WIN1_X1        (*(vuint8*)0x04000043)
#define WIN1_Y0        (*(vuint8*)0x04000047)
#define WIN1_Y1        (*(vuint8*)0x04000046)

Notice the difference in the order of the addresses. The WIN0 registers are correct, but WIN1_X0 and WIN1_X1 have had their addresses swapped, as have SUB_WIN1_X0 and SUB_WIN1_X1.

#151539 - krozen - Thu Feb 28, 2008 6:44 pm

Thanks a million, Cearn. I had noticed an issue with the addresses alright, but had swapped both the X values and the Y values.

Is there any logical or technical reason for the swapping of the values. It seems very counter intuitive.

#151540 - eKid - Thu Feb 28, 2008 7:01 pm

The registers are also called WINxH, WINxV, where the low 8 bits are the right/bottom coordiate, and the higher 8 bits are the left/top coordinate (16-bit registers). It seems a bit like big endian, where the first value is in the higher part.

#162317 - a128 - Sun Aug 31, 2008 9:26 am

Anyone got this working?

I tried it but with no effect on hardware/emu I setup
window0....used 3d as bg0