/// <summary> /// Reads the PPU registers available in the addresses $2000-$2007 from the CPU memory map. /// </summary> /// <param name="address">The PPU register address.</param> /// <returns>The value allocated in the register identified by the given address.</returns> private byte ReadPpuRegister(ushort address) { CatchupPpu(); byte value = 0; switch (address) { // PPU Control register (write only) case 0x2000: break; // PPU Mask register (write only) case 0x2001: break; // PPU Status register case 0x2002: value = (byte)_ppu.Status.Status; // Side effects of reading the status register _ppu.Status.VerticalBlank = false; // Clears bit 7 (V-BLANK) flag after CPU read the status register _ppu.ResetAddressLatch(); break; // PPU OAM address register (write only) case 0x2003: break; // PPU OAM data register case 0x2004: //value = _ppu.OamData; value = _ppu.OamData; break; // PPU Scroll register (write only) case 0x2005: break; // PPU Address register (write only) case 0x2006: break; // PPU Data register case 0x2007: value = _ppu.PpuData; break; } return(value); }