Previous 15994 Revisions Next

r1659 Tuesday 5th February, 2008 at 19:50:52 UTC by Wilbert Pol
[GAMEBOY] Small fix to make sure a scanline is started off with the correct y-scroll value.
[src/mess/video]gb.c

src/mess/video/gb.c
r1658r1659
339339      UINT32 cycles_to_go = ATTOTIME_TO_CYCLES( 0, timer_timeleft( gb_lcd.lcd_timer ) );
340340      int l = 0;
341341
342      if ( gb_lcd.start_x == 0 ) {
342      if ( gb_lcd.start_x < 0 ) {
343343         /* Window is enabled if the hardware says so AND the current scanline is
344344          * within the window AND the window X coordinate is <=166 */
345345         gb_lcd.layer[1].enabled = ( ( LCDCONT & 0x20 ) && ( gb_lcd.current_line >= WNDPOSY ) && ( WNDPOSX <= 166 ) ) ? 1 : 0;
r1658r1659
374374            gb_lcd.layer[1].xend = 160;
375375            gb_lcd.layer[0].xend = xpos;
376376         }
377         gb_lcd.start_x = 0;
377378      }
378379
379380      if ( cycles_to_go < 160 ) {
r1658r1659
626627      UINT32 cycles_to_go = ATTOTIME_TO_CYCLES( 0, timer_timeleft( gb_lcd.lcd_timer ) );
627628      int l = 0;
628629
629      if ( gb_lcd.start_x == 0 ) {
630
630      if ( gb_lcd.start_x < 0 ) {
631631         /* Window is enabled if the hardware says so AND the current scanline is
632632          * within the window AND the window X coordinate is <=166 */
633633         gb_lcd.layer[1].enabled = ((LCDCONT & 0x20) && gb_lcd.current_line >= WNDPOSY && WNDPOSX <= 166) ? 1 : 0;
r1658r1659
663663            gb_lcd.layer[1].xend = 160;
664664            gb_lcd.layer[0].xend = xpos;
665665         }
666         gb_lcd.start_x = 0;
666667      }
667668
668669      if ( cycles_to_go == 0 ) {
r1658r1659
893894      UINT32 cycles_to_go = ATTOTIME_TO_CYCLES( 0, timer_timeleft( gb_lcd.lcd_timer ) );
894895      int l = 0;
895896
896      if ( gb_lcd.start_x == 0 ) {
897
897      if ( gb_lcd.start_x < 0 ) {
898898         /* Window is enabled if the hardware says so AND the current scanline is
899899          * within the window AND the window X coordinate is <=166 */
900900         gb_lcd.layer[1].enabled = ( ( LCDCONT & 0x20 ) && ( gb_lcd.current_line >= WNDPOSY ) && ( WNDPOSX <= 166 ) ) ? 1 : 0;
r1658r1659
930930            gb_lcd.layer[1].xend = 160;
931931            gb_lcd.layer[0].xend = xpos;
932932         }
933         gb_lcd.start_x = 0;
933934      }
934935
935936      if ( cycles_to_go < 160 ) {
r1658r1659
14641465         /* Check for compensations of x-scroll register */
14651466         /* Mode 3 lasts for approximately 172+cycles needed to handle sprites clock cycles */
14661467         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(168 + gb_lcd.scrollx_adjust + gb_lcd.sprite_cycles,0), GB_LCD_STATE_LYXX_PRE_M0, attotime_never );
1467         gb_lcd.start_x = 0;
1468         gb_lcd.start_x = -1;
14681469         break;
14691470      case GB_LCD_STATE_LY9X_M1:      /* Switch to or stay in mode 1 */
14701471         if ( CURLINE == 144 ) {
r1658r1659
17121713         /* Check for compensations of x-scroll register */
17131714         /* Mode 3 lasts for approximately 172+cycles needed to handle sprites clock cycles */
17141715         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(168 + gb_lcd.scrollx_adjust + gb_lcd.sprite_cycles,0), GB_LCD_STATE_LYXX_PRE_M0, attotime_never );
1715         gb_lcd.start_x = 0;
1716         gb_lcd.start_x = -1;
17161717         break;
17171718      case GB_LCD_STATE_LY9X_M1:      /* Switch to or stay in mode 1 */
17181719         if ( CURLINE == 144 ) {

Previous 15994 Revisions Next


© 1998-2018 The MESS Team