liveBook · Manning

PPU status register

As explained in Classic Game Programming on the NES: Make your own retro video game

The PPU status register is an NES hardware register containing display and rendering status bits.

The PPU status register reports NES display and rendering state. During startup, read it with the 6502 BIT instruction to wait for the first vBlank before continuing. section 5.12

A vBlank wait uses the register’s bit 7:

  • Read PPU_STATUS once to clear any previous “vBlank has happened” flag. section 5.12
  • Use BIT PPU_STATUS so bit 7 controls the processor’s negative flag; the accumulator value does not matter. section 5.12
  • Loop with BPL while bit 7 is clear, exiting when the PPU signals vBlank. section 5.12

Waiting for the first vBlank

bit PPU_STATUS wait_vblank: bit PPU_STATUS bpl wait_vblank The initial read clears a stale flag; the loop then waits for a complete rendered frame. section 5.12

Listing 5.13 Waiting for the first vBlank (example.s)
                   #1
bit PPU_STATUS
wait_vblank:
    bit PPU_STATUS
    bpl wait_vblank

View the complete assembly listing for the first-vBlank wait. section 5.12

How Classic Game Programming on the NES: Make your own retro video game covers it

How deep it goes
Explains bit 7, BIT flag behavior, stale-flag clearing, and the BPL polling loop without detailing other status bits.
Examples
Uses a reset-time assembly loop that reads PPU_STATUS and branches until bit 7 becomes set.
What it assumes
Assumes familiarity with 6502 registers and branches while teaching status-bit polling through a concrete startup task.
What you can do after
Operate NES startup by implementing a reliable first-vBlank polling loop.
How it connects
Connects PPU status to vBlank, BIT, BPL, and NES hardware initialization.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Classic Game Programming on the NES: Make your own retro video game. The section links point to the parts of the book it draws on.