SNES Sprites
The Super Nintendo draws sprites in hardware. Its picture processing unit keeps a dedicated object layer with up to 128 sprites, each placed, sized, coloured and flipped from a small table the program fills in. The PPU composites them over the background layers every frame, so movement costs the CPU almost nothing.
Overview
An SNES sprite is called an object, or OBJ. The PPU can show up to 128 objects on screen at once, each a small tile-based bitmap positioned anywhere on the 256×224 display. All 128 objects are described by object attribute memory, or OAM, a small private RAM inside the PPU. Each frame the program writes the objects it wants into OAM and the PPU draws them, with hardware flipping, priority and palette selection.
| Property | Value |
|---|---|
| Objects on screen | Up to 128 |
| Sizes | Two, chosen from a global size set |
| Colour depth | 4bpp, 16 colours per object |
| Object palettes | 8 palettes of 16 colours |
| OAM size | 512 + 32 bytes |
| Flips | Horizontal and vertical, in hardware |
Object sizes
Every object is one of two sizes, a small and a large. Which two are available is set once for the whole screen by a three-bit size field in the PPU object register, choosing one row from a fixed table of size pairs. Each object then picks small or large with a single bit in the high OAM table. Sizes range from 8×8 at the smallest up to 64×64 at the largest.
| Size select | Small | Large |
|---|---|---|
| 0 | 8 × 8 | 16 × 16 |
| 1 | 8 × 8 | 32 × 32 |
| 2 | 8 × 8 | 64 × 64 |
| 3 | 16 × 16 | 32 × 32 |
| 4 | 16 × 16 | 64 × 64 |
| 5 | 32 × 32 | 64 × 64 |
| 6 | 16 × 32 | 32 × 64 |
| 7 | 16 × 32 | 32 × 32 |
A large object is built from a block of tiles taken from object VRAM. Its top-left tile is the tile number in OAM; the tiles to its right and below follow in the tile map, so a 16×16 object uses a 2×2 group and a 32×32 object an 8×8 group.
The OAM table
OAM is 544 bytes in two parts. The main table is 512 bytes, four bytes per object for all 128 objects. Each four-byte entry holds the position, tile and attributes:
| Byte | Contents |
|---|---|
| 0 | X position, low 8 bits (0–255) |
| 1 | Y position (0–255) |
| 2 | Tile number, low 8 bits |
| 3 | Attributes: flips, priority, palette, tile high bit |
Byte 3 packs the per-object flags. The most significant bit is vertical flip, the next horizontal flip, then two bits of priority against the background, three bits of palette select, and the top bit of the tile number, giving a 9-bit tile index into object VRAM:
| Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Meaning | V flip | H flip | Priority | Palette (0–7) | Tile bit 8 | |||
The high OAM table
The second part of OAM is 32 bytes, two bits per object. It holds the ninth bit of each object's X position, so a sprite can reach the whole 512-wide coordinate range and slide off the left edge, plus the size bit that picks small or large for that object.
| Field | Bits per object | Meaning |
|---|---|---|
| X high bit | 1 | Bit 8 of the X position (sign, for off-screen left) |
| Size | 1 | 0 = small, 1 = large from the size set |
Four objects share each byte of the high table, so all 128 objects fit in 32 bytes. Together the main and high tables give the full 512 + 32 = 544 bytes of OAM.
Colour and priority
Objects are always 4 bits per pixel, so each sprite draws from a 16-colour palette. Eight object palettes are available, selected by the three palette bits in the attribute byte, and they occupy the upper half of CGRAM, colours 128 to 255. Colour index 0 in every object palette is transparent, letting the background show through.
The two priority bits in the attribute byte set where an object sits against the four background layers. The PPU resolves object priority against background priority so sprites can appear in front of or behind chosen layers, which is how a character walks behind a foreground element.
Per-scanline limits
Although 128 objects can exist at once, the PPU has a fixed budget per scanline. On any one line it can begin at most 32 objects and fetch at most 34 tiles (8×8 slices) of object data. Objects beyond those limits on a line drop out, the classic sprite flicker or dropout when too many objects crowd one row. Spreading objects vertically, or using larger tiles, keeps them within the line budget.
| Limit | Per scanline |
|---|---|
| Objects | 32 |
| Tiles (8×8 slices) | 34 |