src/mess/video/gb.c
| r1658 | r1659 | |
| 339 | 339 | UINT32 cycles_to_go = ATTOTIME_TO_CYCLES( 0, timer_timeleft( gb_lcd.lcd_timer ) ); |
| 340 | 340 | int l = 0; |
| 341 | 341 | |
| 342 | | if ( gb_lcd.start_x == 0 ) { |
| 342 | if ( gb_lcd.start_x < 0 ) { |
| 343 | 343 | /* Window is enabled if the hardware says so AND the current scanline is |
| 344 | 344 | * within the window AND the window X coordinate is <=166 */ |
| 345 | 345 | gb_lcd.layer[1].enabled = ( ( LCDCONT & 0x20 ) && ( gb_lcd.current_line >= WNDPOSY ) && ( WNDPOSX <= 166 ) ) ? 1 : 0; |
| r1658 | r1659 | |
| 374 | 374 | gb_lcd.layer[1].xend = 160; |
| 375 | 375 | gb_lcd.layer[0].xend = xpos; |
| 376 | 376 | } |
| 377 | gb_lcd.start_x = 0; |
| 377 | 378 | } |
| 378 | 379 | |
| 379 | 380 | if ( cycles_to_go < 160 ) { |
| r1658 | r1659 | |
| 626 | 627 | UINT32 cycles_to_go = ATTOTIME_TO_CYCLES( 0, timer_timeleft( gb_lcd.lcd_timer ) ); |
| 627 | 628 | int l = 0; |
| 628 | 629 | |
| 629 | | if ( gb_lcd.start_x == 0 ) { |
| 630 | | |
| 630 | if ( gb_lcd.start_x < 0 ) { |
| 631 | 631 | /* Window is enabled if the hardware says so AND the current scanline is |
| 632 | 632 | * within the window AND the window X coordinate is <=166 */ |
| 633 | 633 | gb_lcd.layer[1].enabled = ((LCDCONT & 0x20) && gb_lcd.current_line >= WNDPOSY && WNDPOSX <= 166) ? 1 : 0; |
| r1658 | r1659 | |
| 663 | 663 | gb_lcd.layer[1].xend = 160; |
| 664 | 664 | gb_lcd.layer[0].xend = xpos; |
| 665 | 665 | } |
| 666 | gb_lcd.start_x = 0; |
| 666 | 667 | } |
| 667 | 668 | |
| 668 | 669 | if ( cycles_to_go == 0 ) { |
| r1658 | r1659 | |
| 893 | 894 | UINT32 cycles_to_go = ATTOTIME_TO_CYCLES( 0, timer_timeleft( gb_lcd.lcd_timer ) ); |
| 894 | 895 | int l = 0; |
| 895 | 896 | |
| 896 | | if ( gb_lcd.start_x == 0 ) { |
| 897 | | |
| 897 | if ( gb_lcd.start_x < 0 ) { |
| 898 | 898 | /* Window is enabled if the hardware says so AND the current scanline is |
| 899 | 899 | * within the window AND the window X coordinate is <=166 */ |
| 900 | 900 | gb_lcd.layer[1].enabled = ( ( LCDCONT & 0x20 ) && ( gb_lcd.current_line >= WNDPOSY ) && ( WNDPOSX <= 166 ) ) ? 1 : 0; |
| r1658 | r1659 | |
| 930 | 930 | gb_lcd.layer[1].xend = 160; |
| 931 | 931 | gb_lcd.layer[0].xend = xpos; |
| 932 | 932 | } |
| 933 | gb_lcd.start_x = 0; |
| 933 | 934 | } |
| 934 | 935 | |
| 935 | 936 | if ( cycles_to_go < 160 ) { |
| r1658 | r1659 | |
| 1464 | 1465 | /* Check for compensations of x-scroll register */ |
| 1465 | 1466 | /* Mode 3 lasts for approximately 172+cycles needed to handle sprites clock cycles */ |
| 1466 | 1467 | 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; |
| 1468 | 1469 | break; |
| 1469 | 1470 | case GB_LCD_STATE_LY9X_M1: /* Switch to or stay in mode 1 */ |
| 1470 | 1471 | if ( CURLINE == 144 ) { |
| r1658 | r1659 | |
| 1712 | 1713 | /* Check for compensations of x-scroll register */ |
| 1713 | 1714 | /* Mode 3 lasts for approximately 172+cycles needed to handle sprites clock cycles */ |
| 1714 | 1715 | 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; |
| 1716 | 1717 | break; |
| 1717 | 1718 | case GB_LCD_STATE_LY9X_M1: /* Switch to or stay in mode 1 */ |
| 1718 | 1719 | if ( CURLINE == 144 ) { |