src/mess/video/gb.c
| r1646 | r1647 | |
| 1140 | 1140 | }; |
| 1141 | 1141 | |
| 1142 | 1142 | static TIMER_CALLBACK( gb_video_init_vbl ) { |
| 1143 | | cpunum_set_input_line(machine, 0, VBL_INT, ASSERT_LINE ); |
| 1143 | cpunum_set_input_line( machine, 0, VBL_INT, ASSERT_LINE ); |
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | 1146 | void gb_video_init( int mode ) { |
| r1646 | r1647 | |
| 1328 | 1328 | if ( ! gb_lcd.mode_irq ) { |
| 1329 | 1329 | if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq ) { |
| 1330 | 1330 | gb_lcd.mode_irq = 1; |
| 1331 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1331 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1332 | 1332 | } |
| 1333 | 1333 | } else { |
| 1334 | 1334 | gb_lcd.mode_irq = 0; |
| r1646 | r1647 | |
| 1364 | 1364 | /* Generate lcd interrupt if requested */ |
| 1365 | 1365 | if ( ! gb_lcd.mode_irq && ( LCDSTAT & 0x08 ) && |
| 1366 | 1366 | ( ( ! gb_lcd.line_irq && gb_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) { |
| 1367 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1367 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1368 | 1368 | } |
| 1369 | 1369 | timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(196 - gb_lcd.scrollx_adjust - gb_lcd.sprite_cycles,0), GB_LCD_STATE_LYXX_M0_PRE_INC, attotime_never ); |
| 1370 | 1370 | break; |
| r1646 | r1647 | |
| 1376 | 1376 | if ( ! gb_lcd.mode_irq ) { |
| 1377 | 1377 | if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq ) { |
| 1378 | 1378 | gb_lcd.mode_irq = 1; |
| 1379 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1379 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1380 | 1380 | } |
| 1381 | 1381 | } else { |
| 1382 | 1382 | gb_lcd.mode_irq = 0; |
| r1646 | r1647 | |
| 1392 | 1392 | gb_lcd.line_irq = 0; |
| 1393 | 1393 | if ( ! gb_lcd.mode_irq && ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq && ! gb_lcd.triggering_mode_irq ) { |
| 1394 | 1394 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1395 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1395 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1396 | 1396 | } |
| 1397 | 1397 | /* Reset LY==LYC STAT bit */ |
| 1398 | 1398 | LCDSTAT &= 0xFB; |
| r1646 | r1647 | |
| 1406 | 1406 | if ( ! gb_lcd.mode_irq && gb_lcd.triggering_mode_irq && |
| 1407 | 1407 | ( ( ! gb_lcd.triggering_line_irq && ! gb_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) { |
| 1408 | 1408 | gb_lcd.mode_irq = 1; |
| 1409 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1409 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1410 | 1410 | } |
| 1411 | 1411 | timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M2, attotime_never ); |
| 1412 | 1412 | } |
| r1646 | r1647 | |
| 1418 | 1418 | gb_lcd.oam_locked = LOCKED; |
| 1419 | 1419 | /* Generate lcd interrupt if requested */ |
| 1420 | 1420 | if ( ( LCDSTAT & 0x20 ) && ! gb_lcd.line_irq && ! gb_lcd.line_irq ) { |
| 1421 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1421 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1422 | 1422 | } |
| 1423 | 1423 | /* Check for regular compensation of x-scroll register */ |
| 1424 | 1424 | gb_lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0; |
| r1646 | r1647 | |
| 1432 | 1432 | /* Generate lcd interrupt if requested */ |
| 1433 | 1433 | if ( ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq && ! ( LCDSTAT & 0x20 ) ) || |
| 1434 | 1434 | ( ! gb_lcd.mode_irq && ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq && gb_lcd.triggering_mode_irq ) ) { |
| 1435 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1435 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1436 | 1436 | } |
| 1437 | 1437 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1438 | 1438 | gb_lcd.triggering_mode_irq = 0; |
| r1646 | r1647 | |
| 1460 | 1460 | case GB_LCD_STATE_LY9X_M1: /* Switch to or stay in mode 1 */ |
| 1461 | 1461 | if ( CURLINE == 144 ) { |
| 1462 | 1462 | /* Trigger VBlank interrupt */ |
| 1463 | | cpunum_set_input_line(machine, 0, VBL_INT, HOLD_LINE ); |
| 1463 | cpunum_set_input_line( machine, 0, VBL_INT, HOLD_LINE ); |
| 1464 | 1464 | /* Set VBlank lcdstate */ |
| 1465 | 1465 | gb_lcd.mode = 1; |
| 1466 | 1466 | LCDSTAT = (LCDSTAT & 0xFC) | 0x01; |
| 1467 | 1467 | /* Trigger LCD interrupt if requested */ |
| 1468 | 1468 | if ( LCDSTAT & 0x10 ) { |
| 1469 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1469 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1470 | 1470 | } |
| 1471 | 1471 | } |
| 1472 | 1472 | /* Check if LY==LYC STAT bit should be set */ |
| r1646 | r1647 | |
| 1474 | 1474 | LCDSTAT |= 0x04; |
| 1475 | 1475 | } |
| 1476 | 1476 | if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) { |
| 1477 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1477 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1478 | 1478 | } |
| 1479 | 1479 | timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(452,0), GB_LCD_STATE_LY9X_M1_INC, attotime_never ); |
| 1480 | 1480 | break; |
| r1646 | r1647 | |
| 1485 | 1485 | gb_lcd.line_irq = 0; |
| 1486 | 1486 | if ( ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) { |
| 1487 | 1487 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1488 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1488 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1489 | 1489 | } |
| 1490 | 1490 | /* Reset LY==LYC STAT bit */ |
| 1491 | 1491 | LCDSTAT &= 0xFB; |
| r1646 | r1647 | |
| 1499 | 1499 | /* Check LY=LYC for line #153 */ |
| 1500 | 1500 | if ( gb_lcd.delayed_line_irq ) { |
| 1501 | 1501 | if ( gb_lcd.triggering_line_irq ) { |
| 1502 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1502 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1503 | 1503 | } |
| 1504 | 1504 | } |
| 1505 | 1505 | gb_lcd.delayed_line_irq = gb_lcd.delayed_line_irq | gb_lcd.line_irq; |
| r1646 | r1647 | |
| 1515 | 1515 | case GB_LCD_STATE_LY00_M1_1: |
| 1516 | 1516 | if ( ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) { |
| 1517 | 1517 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1518 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1518 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1519 | 1519 | } |
| 1520 | 1520 | timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY00_M1_2, attotime_never ); |
| 1521 | 1521 | break; |
| 1522 | 1522 | case GB_LCD_STATE_LY00_M1_2: /* Rest of line #0 during VBlank */ |
| 1523 | 1523 | if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) { |
| 1524 | 1524 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1525 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1525 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1526 | 1526 | } |
| 1527 | 1527 | if ( CURLINE == CMPLINE ) { |
| 1528 | 1528 | LCDSTAT |= 0x04; |
| r1646 | r1647 | |
| 1559 | 1559 | if ( ! gb_lcd.mode_irq ) { |
| 1560 | 1560 | if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq ) { |
| 1561 | 1561 | gb_lcd.mode_irq = 1; |
| 1562 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1562 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1563 | 1563 | } |
| 1564 | 1564 | } else { |
| 1565 | 1565 | gb_lcd.mode_irq = 0; |
| r1646 | r1647 | |
| 1596 | 1596 | /* Generate lcd interrupt if requested */ |
| 1597 | 1597 | if ( ! gb_lcd.mode_irq && gb_lcd.triggering_mode_irq && |
| 1598 | 1598 | ( ( ! gb_lcd.line_irq && gb_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) { |
| 1599 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1599 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1600 | 1600 | gb_lcd.triggering_mode_irq = 0; |
| 1601 | 1601 | } |
| 1602 | 1602 | if ( ( SCROLLX & 0x03 ) == 0x03 ) { |
| r1646 | r1647 | |
| 1623 | 1623 | if ( ! gb_lcd.mode_irq ) { |
| 1624 | 1624 | if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq ) { |
| 1625 | 1625 | gb_lcd.mode_irq = 1; |
| 1626 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1626 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1627 | 1627 | } |
| 1628 | 1628 | } else { |
| 1629 | 1629 | gb_lcd.mode_irq = 0; |
| r1646 | r1647 | |
| 1639 | 1639 | gb_lcd.line_irq = 0; |
| 1640 | 1640 | if ( ! gb_lcd.mode_irq && ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq && ! ( LCDSTAT & 0x20 ) ) { |
| 1641 | 1641 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1642 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1642 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1643 | 1643 | } |
| 1644 | 1644 | gb_lcd.hdma_possible = 0; |
| 1645 | 1645 | /* Check if we're going into VBlank next */ |
| r1646 | r1647 | |
| 1652 | 1652 | if ( ! gb_lcd.mode_irq && ( LCDSTAT & 0x20 ) && |
| 1653 | 1653 | ( ( ! gb_lcd.triggering_line_irq && ! gb_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) { |
| 1654 | 1654 | gb_lcd.mode_irq = 1; |
| 1655 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1655 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1656 | 1656 | } |
| 1657 | 1657 | timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LYXX_M2, attotime_never ); |
| 1658 | 1658 | } |
| r1646 | r1647 | |
| 1664 | 1664 | gb_lcd.oam_locked = LOCKED; |
| 1665 | 1665 | /* Generate lcd interrupt if requested */ |
| 1666 | 1666 | if ( ( LCDSTAT & 0x20 ) && ! gb_lcd.line_irq && ! gb_lcd.line_irq ) { |
| 1667 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1667 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1668 | 1668 | } |
| 1669 | 1669 | /* Check for regular compensation of x-scroll register */ |
| 1670 | 1670 | gb_lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0; |
| r1646 | r1647 | |
| 1678 | 1678 | /* Generate lcd interrupt if requested */ |
| 1679 | 1679 | if ( ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq && ! ( LCDSTAT & 0x20 ) ) || |
| 1680 | 1680 | ( !gb_lcd.mode_irq && ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq && ( LCDSTAT & 0x20 ) ) ) { |
| 1681 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1681 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1682 | 1682 | } |
| 1683 | 1683 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1684 | 1684 | /* Check if LY==LYC STAT bit should be set */ |
| r1646 | r1647 | |
| 1708 | 1708 | case GB_LCD_STATE_LY9X_M1: /* Switch to or stay in mode 1 */ |
| 1709 | 1709 | if ( CURLINE == 144 ) { |
| 1710 | 1710 | /* Trigger VBlank interrupt */ |
| 1711 | | cpunum_set_input_line(machine, 0, VBL_INT, HOLD_LINE ); |
| 1711 | cpunum_set_input_line( machine, 0, VBL_INT, HOLD_LINE ); |
| 1712 | 1712 | /* Set VBlank lcdstate */ |
| 1713 | 1713 | gb_lcd.mode = 1; |
| 1714 | 1714 | LCDSTAT = (LCDSTAT & 0xFC) | 0x01; |
| 1715 | 1715 | /* Trigger LCD interrupt if requested */ |
| 1716 | 1716 | if ( LCDSTAT & 0x10 ) { |
| 1717 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1717 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1718 | 1718 | } |
| 1719 | 1719 | } |
| 1720 | 1720 | /* Check if LY==LYC STAT bit should be set */ |
| r1646 | r1647 | |
| 1724 | 1724 | LCDSTAT &= ~0x04; |
| 1725 | 1725 | } |
| 1726 | 1726 | if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) { |
| 1727 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1727 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1728 | 1728 | } |
| 1729 | 1729 | timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(452,0), GB_LCD_STATE_LY9X_M1_INC, attotime_never ); |
| 1730 | 1730 | break; |
| r1646 | r1647 | |
| 1735 | 1735 | gb_lcd.line_irq = 0; |
| 1736 | 1736 | if ( ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) { |
| 1737 | 1737 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1738 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1738 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1739 | 1739 | } |
| 1740 | 1740 | if ( gb_lcd.current_line == 153 ) { |
| 1741 | 1741 | timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY00_M1, attotime_never ); |
| r1646 | r1647 | |
| 1747 | 1747 | /* Check LY=LYC for line #153 */ |
| 1748 | 1748 | if ( gb_lcd.delayed_line_irq ) { |
| 1749 | 1749 | if ( gb_lcd.triggering_line_irq ) { |
| 1750 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1750 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1751 | 1751 | } |
| 1752 | 1752 | } |
| 1753 | 1753 | gb_lcd.delayed_line_irq = gb_lcd.delayed_line_irq | gb_lcd.line_irq; |
| r1646 | r1647 | |
| 1765 | 1765 | case GB_LCD_STATE_LY00_M1_1: |
| 1766 | 1766 | if ( ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) { |
| 1767 | 1767 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1768 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1768 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1769 | 1769 | } |
| 1770 | 1770 | timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(4,0), GB_LCD_STATE_LY00_M1_2, attotime_never ); |
| 1771 | 1771 | break; |
| 1772 | 1772 | case GB_LCD_STATE_LY00_M1_2: /* Rest of line #0 during VBlank */ |
| 1773 | 1773 | if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) { |
| 1774 | 1774 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1775 | | cpunum_set_input_line(machine, 0, LCD_INT, HOLD_LINE ); |
| 1775 | cpunum_set_input_line( machine, 0, LCD_INT, HOLD_LINE ); |
| 1776 | 1776 | } |
| 1777 | 1777 | if ( CURLINE == CMPLINE ) { |
| 1778 | 1778 | LCDSTAT |= 0x04; |
| r1646 | r1647 | |
| 1809 | 1809 | LCDSTAT |= 0x04; |
| 1810 | 1810 | /* Generate lcd interrupt if requested */ |
| 1811 | 1811 | if ( LCDSTAT & 0x40 ) { |
| 1812 | | cpunum_set_input_line(Machine, 0, LCD_INT, HOLD_LINE ); |
| 1812 | cpunum_set_input_line( Machine, 0, LCD_INT, HOLD_LINE ); |
| 1813 | 1813 | } |
| 1814 | 1814 | } |
| 1815 | 1815 | gb_lcd.state = GB_LCD_STATE_LY00_M2; |
| r1646 | r1647 | |
| 1890 | 1890 | ( ( LCDSTAT & 0x60 ) == 0x00 && ( data & 0x60 ) == 0x20 ) || |
| 1891 | 1891 | ( ( LCDSTAT & 0x60 ) == 0x20 && ( data & 0x40 ) ) |
| 1892 | 1892 | ) ) { |
| 1893 | | cpunum_set_input_line(Machine, 0, LCD_INT, HOLD_LINE); |
| 1893 | cpunum_set_input_line( Machine, 0, LCD_INT, HOLD_LINE ); |
| 1894 | 1894 | } |
| 1895 | 1895 | /* |
| 1896 | 1896 | - 0x20 -> 0x08/0x18/0x28/0x48 (mode 0, after m2int) - trigger |
| r1646 | r1647 | |
| 1898 | 1898 | - 0x00 -> 0xXX (mode 0) - trigger stat bug |
| 1899 | 1899 | */ |
| 1900 | 1900 | if ( gb_lcd.mode_irq && gb_lcd.mode == 0 ) { |
| 1901 | | cpunum_set_input_line(Machine, 0, LCD_INT, HOLD_LINE); |
| 1901 | cpunum_set_input_line( Machine, 0, LCD_INT, HOLD_LINE ); |
| 1902 | 1902 | } |
| 1903 | 1903 | } |
| 1904 | 1904 | break; |
| r1646 | r1647 | |
| 1911 | 1911 | LCDSTAT |= 0x04; |
| 1912 | 1912 | /* Generate lcd interrupt if requested */ |
| 1913 | 1913 | if ( LCDSTAT & 0x40 ) { |
| 1914 | | cpunum_set_input_line(Machine, 0, LCD_INT, HOLD_LINE ); |
| 1914 | cpunum_set_input_line( Machine, 0, LCD_INT, HOLD_LINE ); |
| 1915 | 1915 | } |
| 1916 | 1916 | } |
| 1917 | 1917 | } else { |
| r1646 | r1647 | |
| 2011 | 2011 | - 0x20 -> 0x08/0x18/0x28/0x48 (mode 0, after m2int) - trigger |
| 2012 | 2012 | */ |
| 2013 | 2013 | if ( gb_lcd.mode_irq && gb_lcd.mode == 0 && ( LCDSTAT & 0x28 ) == 0x20 && ( data & 0x08 ) ) { |
| 2014 | | cpunum_set_input_line(Machine, 0, LCD_INT, HOLD_LINE); |
| 2014 | cpunum_set_input_line( Machine, 0, LCD_INT, HOLD_LINE ); |
| 2015 | 2015 | } |
| 2016 | /* Check if line irqs are being disabled */ |
| 2017 | if ( ! ( data & 0x40 ) ) { |
| 2018 | gb_lcd.delayed_line_irq = 0; |
| 2019 | } |
| 2020 | /* Check if line irqs are being enabled */ |
| 2021 | if ( ! ( LCDSTAT & 0x40 ) && ( data & 0x40 ) ) { |
| 2022 | if ( CMPLINE == CURLINE ) { |
| 2023 | gb_lcd.line_irq = 1; |
| 2024 | cpunum_set_input_line( Machine, 0, LCD_INT, HOLD_LINE ); |
| 2025 | } |
| 2026 | } |
| 2016 | 2027 | } |
| 2017 | 2028 | break; |
| 2018 | 2029 | case 0x05: /* LYC */ |
| r1646 | r1647 | |
| 2022 | 2033 | LCDSTAT |= 0x04; |
| 2023 | 2034 | /* Generate lcd interrupt if requested */ |
| 2024 | 2035 | if ( LCDSTAT & 0x40 ) { |
| 2025 | | cpunum_set_input_line(Machine, 0, LCD_INT, HOLD_LINE ); |
| 2036 | cpunum_set_input_line( Machine, 0, LCD_INT, HOLD_LINE ); |
| 2026 | 2037 | } |
| 2027 | 2038 | } else { |
| 2028 | 2039 | LCDSTAT &= 0xFB; |