| 1769 | } |
| 1770 | |
| 1771 | int FCEUPPU_Loop(int skip) { |
| 1772 | if ((newppu) && (GameInfo->type != GIT_NSF)) { |
| 1773 | int FCEUX_PPU_Loop(int skip); |
| 1774 | return FCEUX_PPU_Loop(skip); |
| 1775 | } |
| 1776 | |
| 1777 | //Needed for Knight Rider, possibly others. |
| 1778 | if (ppudead) { |
| 1779 | memset(XBuf, 0x80, 256 * 240); |
| 1780 | X6502_Run(scanlines_per_frame * (256 + 85)); |
| 1781 | ppudead--; |
| 1782 | } else { |
| 1783 | X6502_Run(256 + 85); |
| 1784 | PPU_status |= 0x80; |
| 1785 | |
| 1786 | //Not sure if this is correct. According to Matt Conte and my own tests, it is. |
| 1787 | //Timing is probably off, though. |
| 1788 | //NOTE: Not having this here breaks a Super Donkey Kong game. |
| 1789 | PPU[3] = PPUSPL = 0; |
| 1790 | |
| 1791 | //I need to figure out the true nature and length of this delay. |
| 1792 | X6502_Run(12); |
| 1793 | if (GameInfo->type == GIT_NSF) |
| 1794 | DoNSFFrame(); |
| 1795 | else { |
| 1796 | if (VBlankON) |
| 1797 | TriggerNMI(); |
| 1798 | } |
| 1799 | X6502_Run((scanlines_per_frame - 242) * (256 + 85) - 12); |
| 1800 | if (overclock_enabled && vblankscanlines) { |
| 1801 | if (!DMC_7bit || !skip_7bit_overclocking) { |
| 1802 | overclocking = 1; |
| 1803 | X6502_Run(vblankscanlines * (256 + 85) - 12); |
| 1804 | overclocking = 0; |
| 1805 | } |
| 1806 | } |
| 1807 | PPU_status &= 0x1f; |
| 1808 | X6502_Run(256); |
| 1809 | |
| 1810 | { |
| 1811 | int x; |
| 1812 | |
| 1813 | if (ScreenON || SpriteON) { |
| 1814 | if (GameHBIRQHook && ((PPU[0] & 0x38) != 0x18)) |
| 1815 | GameHBIRQHook(); |
| 1816 | if (PPU_hook) |
| 1817 | for (x = 0; x < 42; x++) { |
| 1818 | PPU_hook(0x2000); PPU_hook(0); |
| 1819 | } |
| 1820 | if (GameHBIRQHook2) |
| 1821 | GameHBIRQHook2(); |
| 1822 | } |
| 1823 | X6502_Run(85 - 16); |
| 1824 | if (ScreenON || SpriteON) { |
| 1825 | RefreshAddr = TempAddr; |
| 1826 | if (PPU_hook) PPU_hook(RefreshAddr & 0x3fff); |
| 1827 | } |
| 1828 |
no test coverage detected