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 > Change Control of Outside of Windows in HBLANK

#19185 - RaBBi - Tue Apr 13, 2004 4:38 pm

Hi all,

In order to add a scanline effect managed by a window to my project, I needed to change the enable bits of the 04Ah - WINOUT register.

But it seems that I can't during the HBLANK period.

Here's my code :

Code:

void gbl_Screen_Scanlines(u8 used_win, u8 starting_line, u8 ending_line, u8 clearline_height, u8 scanline_height)
{
   
   static u8 s_win_posY1 = 0;
   static u8 s_win_posY2 = 0;
/* Black line or Normal Line */
/* Black : outside window and Normal : inside window */
   static u8 s_next_mode_line = 0;
      
   
   /*if (LCD_Y == ending_line) return;*/
   
   /* start when Line Counter reaches the starting line or change mode line */
   if(LCD_Y == starting_line || (LCD_Y == s_next_mode_line && LCD_Y < ending_line))
   {
      /* Nothing Visible Outside the Window 1
      GBL_WINOUT_WIN0AND1_DISPLAY_SET(0,0,0,0,0,0);*/
      
      s_win_posY1 = LCD_Y + scanline_height;
      s_win_posY2 = s_win_posY1 + clearline_height;
      
      s_next_mode_line = s_win_posY2;
   }
   
   if (LCD_Y >= ending_line)
   {
      /* All Visible Outside the Window 1
      GBL_WINOUT_WIN0AND1_DISPLAY_SET(1,1,1,1,1,1); */
   }
   
   GBL_WINX_CREATE(used_win,0,240,s_win_posY1,s_win_posY2);   
}



I commented the lines where I try to set the display out of the window (cause it doesn't seem to work during HBLANK).

----
Other linked question :
Now, I'll try to do it using the Blend Mode and the blend coefficient, without window.

But before this, do you know if it's possible to change this coeff during HBLANK too?
Or if I'll get the same problem above.
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^

#19197 - ScottLininger - Tue Apr 13, 2004 11:41 pm

Well, this one is new to me. I've never tried to change windowing during HBLANK. (At least, I've never tried to enable/disable it)

But I have changed the blending register without trouble, so you could always go that way.

-Scott

#19202 - tepples - Wed Apr 14, 2004 1:27 am

If it turns out that the hardware doesn't let you change the on/off state of the windows during hblank without artifacting, you could always change the horizontal extents of the window to include no visible pixels.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.