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

Function FCEUPPU_Power

src/ppu.cpp:1734–1769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1732}
1733
1734void FCEUPPU_Power(void) {
1735 int x;
1736
1737 // initialize PPU memory regions according to settings
1738 FCEU_MemoryRand(NTARAM, 0x800, true);
1739 FCEU_MemoryRand(PALRAM, 0x20, true);
1740 FCEU_MemoryRand(SPRAM, 0x100, true);
1741 // palettes can only store values up to $3F, and PALRAM X4/X8/XC are mirrors of X0 for rendering purposes (UPALRAM is used for $2007 readback)
1742 for (x = 0; x < 0x20; ++x) PALRAM[x] &= 0x3F;
1743 UPALRAM[0] = PALRAM[0x04];
1744 UPALRAM[1] = PALRAM[0x08];
1745 UPALRAM[2] = PALRAM[0x0C];
1746 PALRAM[0x0C] = PALRAM[0x08] = PALRAM[0x04] = PALRAM[0x00];
1747 PALRAM[0x1C] = PALRAM[0x18] = PALRAM[0x14] = PALRAM[0x10];
1748 FCEUPPU_Reset();
1749
1750 for (x = 0x2000; x < 0x4000; x += 8) {
1751 ARead[x] = A200x;
1752 BWrite[x] = B2000;
1753 ARead[x + 1] = A200x;
1754 BWrite[x + 1] = B2001;
1755 ARead[x + 2] = A2002;
1756 BWrite[x + 2] = B2002;
1757 ARead[x + 3] = A200x;
1758 BWrite[x + 3] = B2003;
1759 ARead[x + 4] = A2004;
1760 BWrite[x + 4] = B2004;
1761 ARead[x + 5] = A200x;
1762 BWrite[x + 5] = B2005;
1763 ARead[x + 6] = A200x;
1764 BWrite[x + 6] = B2006;
1765 ARead[x + 7] = A2007;
1766 BWrite[x + 7] = B2007;
1767 }
1768 BWrite[0x4014] = B4014;
1769}
1770
1771int FCEUPPU_Loop(int skip) {
1772 if ((newppu) && (GameInfo->type != GIT_NSF)) {

Callers 1

PowerNESFunction · 0.85

Calls 2

FCEU_MemoryRandFunction · 0.85
FCEUPPU_ResetFunction · 0.85

Tested by

no test coverage detected