MCPcopy Create free account
hub / github.com/TASEmulators/fceux / FCEUPPU_Loop

Function FCEUPPU_Loop

src/ppu.cpp:1771–1902  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1769}
1770
1771int 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

Callers 1

FCEUI_EmulateFunction · 0.85

Calls 9

FCEUX_PPU_LoopFunction · 0.85
X6502_RunFunction · 0.85
DoNSFFrameFunction · 0.85
TriggerNMIFunction · 0.85
ResetRLFunction · 0.85
DoLineFunction · 0.85
MMC5_hbFunction · 0.85
SetNESDeemph_OldHackyFunction · 0.85
FCEUD_UpdatePPUViewFunction · 0.50

Tested by

no test coverage detected