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 > fading text

#38528 - Piratero - Mon Mar 28, 2005 10:55 pm

the effect i want to accomplish is at the end of the demo, http://www.pdroms.de/file_details.php?fn=1762

the code i wrote works but i can't find a way to move it down and up like the demo above has.

here is the code:


Code:
#define START_SCANLINE 1
 
static void
credits_scroll(void)
{
    REG_BLDMOD = 0x2241; // Backdrop, 1st: bg0, 2nd: bg1
 
// bg0 = text
// bg1 = background
 
    switch(REG_VCOUNT)
    {
   case 1:
       REG_COLEV = MAP_COLEV(16,0);
 
       REG_DISPSTAT &= 0xFF;
       REG_DISPSTAT |= IRQ_SCANLINE(2);
       break;
   case 2:
       REG_COLEV = MAP_COLEV(14,2);
 
       REG_DISPSTAT &= 0xFF;
       REG_DISPSTAT |= IRQ_SCANLINE(3);
       break;
   case 3:
       REG_COLEV = MAP_COLEV(12,4);
 
       REG_DISPSTAT &= 0xFF;
       REG_DISPSTAT |= IRQ_SCANLINE(4);
       break;
   case 4:
       REG_COLEV = MAP_COLEV(10,6);
 
       REG_DISPSTAT &= 0xFF;
       REG_DISPSTAT |= IRQ_SCANLINE(5);
       break;
   case 5:
       REG_COLEV = MAP_COLEV(8,8);
 
       REG_DISPSTAT &= 0xFF;
       REG_DISPSTAT |= IRQ_SCANLINE(6);
       break;
   case 6:
       REG_COLEV = MAP_COLEV(8,10);
 
 
       REG_DISPSTAT &= 0xFF;
       REG_DISPSTAT |= IRQ_SCANLINE(7);
       break;
   case 7:
       REG_COLEV = MAP_COLEV(8,12);
 
       REG_DISPSTAT &= 0xFF;
       REG_DISPSTAT |= IRQ_SCANLINE(8);
       break;
   case 8:
       REG_COLEV = MAP_COLEV(0,16);
 
       REG_DISPSTAT &= 0xFF;
       REG_DISPSTAT |= IRQ_SCANLINE(1);
       break;
    }
}
 
 
int
main(void)
{
init_display_and_copy_tiles_and_palette();
 
 
    REG_DISPSTAT &= 0xFF;
    REG_DISPSTAT |= IRQ_SCANLINE(START_SCANLINE);
 
    irqtable[IRQ_VCOUNT] = credits_scroll;
 
 
 
while(1){
 
update();
}
 
 
}


any ideas?

btw, here is a link to the effect: http://mrkotfw.ribrdb.com/mana.gba
_________________
http://mrkotfw.ribrdb.com/

#38547 - tepples - Tue Mar 29, 2005 1:11 am

I think it might be easier to use an hblank DMA to set the opacity, unless you're already using all four DMA channels.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#38572 - Piratero - Tue Mar 29, 2005 5:37 am

dma0 is not being used, so i guess i can do that :) thanks for the info! i'll see if i can get this to work
_________________
http://mrkotfw.ribrdb.com/