  C. PPU Notes
  ------------
    Reading and writing to VRAM consists of a multi-step process:

      Writing to VRAM                    Reading from VRAM
      ---------------                    -----------------
      1) Wait for VBlank                 1) Wait for VBlank
      2) Write upper VRAM address        2) Write upper VRAM address
         byte into $2006                    byte into $2006
      3) Write lower VRAM address        3) Write lower VRAM address
         byte into $2006                    byte into $2006
      4) Write data to $2007             4) Read $2007 (invalid data once)
                                         5) Read data from $2007

    NOTE: Step #4 when reading VRAM is only necessary when reading
          VRAM data not in the $3F00-3FFF range.

    NOTE: Accessing VRAM should only be performed during VBlank. Attempts
          to access VRAM outside of VBlank will usually result in garbage
          showing up on the screen. See Section 4, Subsection N for more
          information regarding why this occurs.

    Waiting for VBlank is quite simple:

      8000: LDA $2002
            BPL $8000

    Reading $2002 will result in all bits being returned; however, D7
    will be reset to 0 after the read is performed.

    The actual on-screen palette used by the NES, as stated prior, is not
    RGB. However, a near-exact replica can be found in common NES emulators
    today. Contact the appropriate authors of these emulators to obtain
    a valid RGB palette.

    Be sure to clear the internal VRAM address via $2006 semi-often. You
    will often encounter a situation where a palette fade or a VRAM update
    will cause the screen "to be trashed" (squares on the screen, or what
    seem to be graphical "glitches"). The reason for this is that your code
    took longer than a VBlank. When the VBlank goes to refresh the screen
    with the data in the PPU, it takes whatever value is in the internal
    VRAM address and uses that as the starting base for Name Table #0.
    The solution is to fix your code by re-assigning the VRAM address to
    $0000 (or $2000), so that the refresh may occur successfully. Such
    code would be:

      LDA #$00
      STA $2006
      STA $2006

    You will find code like this in commercial games quite often.
