Game Boy Sprites

Sprites on the Game Boy are called objects. The hardware tracks up to forty of them in a small block of memory called object attribute memory, each one placed anywhere on screen over the background. An object is either 8×8 or 8×16 pixels and draws from the same tile data the background uses. This page covers where objects live, how their four bytes are read, and the limits the display applies as it scans each line.

Game Boy Sprites

Overview

An object is a movable tile the display draws on top of the background and window. Unlike the background, objects are positioned by pixel, so they move smoothly and are not tied to the 8×8 cell grid. The display holds up to forty objects at once, each described by four bytes. Objects share the tile store in video RAM with the background, but they always read tiles by the unsigned method starting at $8000, so tile 0 is the first tile in the store.

PropertyValue
Objects40
Bytes per object4
Object size8 × 8 or 8 × 16 pixels
OAM location$FE00 – $FE9F (160 bytes)
Objects per scanline10 maximum
Object palettes2 (OBP0, OBP1)

Object attribute memory

The forty objects live in object attribute memory, or OAM, a 160-byte region at $FE00 to $FE9F. Each object takes four bytes, so object n starts at $FE00 + n * 4. The four bytes are the Y position, the X position, the tile number, and a flags byte.

ByteNameMeaning
0Y positionScreen row of the object's top, plus 16. A value of 16 puts the top at the top edge; 0 hides it above the screen.
1X positionScreen column of the object's left, plus 8. A value of 8 puts the left at the left edge; 0 hides it off the left.
2Tile numberIndex into the tile store at $8000. In 8×16 mode the low bit is ignored and the pair of tiles is used.
3FlagsPriority, flips and palette, described below.

The 16- and 8-pixel offsets on Y and X let an object scroll fully off any edge of the screen. OAM is normally filled by a fast DMA copy from a page of RAM once per frame, because direct access to OAM is blocked while the display is drawing.

Object attributes

The fourth byte of each object packs its drawing flags. The lower bits are unused on the original Game Boy.

Bit76543210
MeaningPriorityY flipX flipPaletteUnused (0)
FlagEffect
Priority (bit 7)0 draws the object over the background. 1 draws it behind background colours 1 to 3, showing only over colour 0.
Y flip (bit 6)1 mirrors the object top to bottom.
X flip (bit 5)1 mirrors the object left to right.
Palette (bit 4)0 selects palette OBP0 ($FF48), 1 selects OBP1 ($FF49).

Objects have two palettes to choose from, set in registers OBP0 and OBP1. In both, colour 0 is always transparent, so an object shows the background through its colour-0 pixels regardless of the palette entry.

Object size and tiles

A single bit of the display control register LCDC ($FF40) sets the size of every object at once. Bit 2 clear gives 8×8 objects; bit 2 set gives 8×16 objects. The size is global: all forty objects are the same size in a given frame.

LCDC bit 2SizeTiles used
08 × 8The single tile named in byte 2.
18 × 16Tile with low bit cleared (top) and low bit set (bottom).

In 8×16 mode the tile number's lowest bit is ignored: the even tile is the top half and the following odd tile is the bottom half. Object tiles are always fetched from $8000 upward using the tile number as an unsigned index, the same 2 bits-per-pixel format the background uses.

Per-scanline limits

As the display draws each of the 144 visible lines it scans OAM for objects that cover that line. It can draw at most ten objects on any one scanline; the eleventh and beyond on that line are dropped. Programs work within this by spreading objects vertically, and some flicker objects between frames so more than ten can appear at a horizontal band over time.

LimitValue
Total objects40
Objects per scanline10
Colours per object3 plus transparent

When two objects overlap, the one with the smaller X position is drawn on top on the original Game Boy; if their X positions are equal, the one earlier in OAM wins. This ordering, together with the per-line count, shapes how designers lay out large characters built from several objects.