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.

Coding > More REG_BLDMOD Fun!

#30514 - JVCase - Wed Dec 01, 2004 7:46 pm

Sorry, I know this topic seems to have been beaten to death in the forums and elsewhere, but something still isn't clicking for me... I've got plenty of specs on the topic (e.g. where the registers are, what bits are what, etc.), but no matter what I do, I can't seem to make anything work where this is concerned.
I'm in Mode 3, with BG2 on and painted with a fullscreen graphic. That part works fine.
I set REG_BLDMOD for BG2 on Top, BD on Bottom, and Fade to Black mode... don't know if that's the problem.
Then, I loop from 16 to 0, and put the value into REG_COLEY.
Nothing happens.
All I'm looking to do is fade the Mode 3 BG2 to black...
Any suggestions?

#30515 - Lupin - Wed Dec 01, 2004 7:52 pm

REG_BLDMOD = (3 << 6) | BIT2;
REG_COLEY=a;
a++;

you can put this into a timer and make "a" global.

don't put this into your VBLANK without adding some kind of delay because that would go way too fast..
_________________
Team Pokeme
My blog and PM ASM tutorials


Last edited by Lupin on Wed Dec 01, 2004 7:54 pm; edited 1 time in total

#30516 - ScottLininger - Wed Dec 01, 2004 7:53 pm

Mode 3 doesn't respond to this register as far as I've found. Only tiled backgrounds can be blended. (Sprites in Mode 3 can be blended, but not the background.)

Doing a smooth fade to black in mode 3 means darkening every pixel over and over again, or maybe setting up a grid of large sprites that block out the entire background and "fade to solid" to cover everything up.

-Scott

#30518 - Lupin - Wed Dec 01, 2004 7:59 pm

I forgot, i am not sure if it is needed but before you start to blend add this if it doesn't work at all:

REG_BG2CNT = 3;


arrr sorry, that will just change the priority of the background layer =)

I guess the code i posted first should do what you want...
_________________
Team Pokeme
My blog and PM ASM tutorials

#30523 - JVCase - Wed Dec 01, 2004 8:24 pm

Ok, many thanks - it's working now.
Fading definately works in Mode 3 - it does go quick, though :)
Why is it, though, that increasing weight fades out, while decreasing fades in?

#30526 - Lupin - Wed Dec 01, 2004 8:43 pm

well that's how it is... you increase the weight of the black backplane and not of your background layer
_________________
Team Pokeme
My blog and PM ASM tutorials

#30528 - JVCase - Wed Dec 01, 2004 8:48 pm

Ah, I see. Cool, thanks!