liveBook · Manning

Gpu video memory

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

Video memory (VRAM) is memory accessed by graphics hardware to store data needed to generate a display.

GPU video memory, or VRAM, is the memory a graphics processor uses for display data. On the NES, the Picture Processing Unit (PPU) owns 2K of VRAM, with some cartridges able to add more. Tile and sprite patterns come from an 8K cartridge area that may be fixed ROM, bank-switched ROM, or writable RAM. section 1.2

VRAM is not ordinary CPU memory. The 6502 cannot access it directly; it sends data through PPU control ports. This matters during initialization: graphics patterns may need copying from game ROM into PPU video memory before any screen can use them. section 1.5.1 section 1.5.4

The PPU repeatedly draws the screen from VRAM. It is safest to change VRAM during vBlank, after the PPU finishes the bottom of the screen and before drawing begins again. The PPU signals this period with an interrupt, so an NMI routine can perform the needed updates; writes at other times can produce incorrect output. section 1.5.4

Figure 1.6 NES PPU chip: What is a vBlank?

The raster-and-vBlank diagram shows why display updates must fit into the short interval between screen draws. section 1.5.4

Background screens use VRAM as name tables: 32 by 30 entries select 8 × 8 pixel tiles, making 960 tiles for a 256 × 240 display. NTSC systems refresh at 60 Hz but can hide the top and bottom tile rows; PAL systems show all rows at 50 Hz. Both the visible layout and refresh rate affect how much can be changed during vBlank. section 6.5

Because each frame permits only limited VRAM writes, practical animation favors small updates:

  • Replace the tiles displayed at selected screen locations. section 13.2
  • Change the colors used by background graphics. section 13.2
  • Use cartridge hardware when extra VRAM is needed for additional name tables. section 16.2

Loading a title screen

Before a title screen appears, load its 8 × 8 background and sprite patterns from game ROM into VRAM. The name table can then select those patterns to form the screen, while sprites use their own loaded patterns in front of or behind the background. section 1.5.2 section 6.5

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

How deep it goes
Explains VRAM ownership, PPU-port access, vBlank timing, and frame-limited update strategies without detailing port code.
Examples
Uses title-screen pattern loading, 32-by-30 tile name tables, and background tile or color animation.
What it assumes
Introduces VRAM through NES display setup without assuming prior programming or assembly knowledge.
What you can do after
Operate/configure it by loading patterns before display and scheduling small VRAM updates during vBlank.
How it connects
Connects VRAM to the PPU, tile patterns, sprites, name tables, vBlank, NMI, and cartridge expansion.

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.