Game Boy Color Sprite
The Game Boy Color keeps the Game Boy's forty hardware objects, each an 8×8 or 8×16 tile positioned by object attribute memory. Colour is the change: an object draws one of eight object palettes of four fifteen-bit colours, its palette, its tile bank and its flips chosen by the object's own attribute byte. Colour 0 of a palette is transparent.
Overview
An object is a movable tile, drawn over the background. Its tiles are 8×8 or 8×16 pixels, two bits a pixel, the same format as the background tiles, read from either video RAM bank. The object's colour comes from one of eight object palettes; the background pages cover the tile format and the palettes in more depth.
| Property | Value |
|---|---|
| Objects | 40 |
| Object size | 8 × 8 or 8 × 16 (all objects share the choice) |
| Tile depth | 2 bits a pixel (3 colours + transparent) |
| Object palettes | 8, of 4 colours each |
| Colour space | 15-bit, 32768 colours |
| Per scanline | 10 objects |
Object attribute memory
OAM holds forty entries of four bytes: the Y position, the X position, the tile index, and the attribute byte. Y and X are offset (an object at screen 0,0 is stored as 16,8), so an object can slide off any edge. In 8×16 mode the tile index's low bit is ignored and the object draws two stacked tiles.
| Byte | Meaning |
|---|---|
| 0 | Y position + 16. |
| 1 | X position + 8. |
| 2 | Tile index. |
| 3 | Attribute byte. |
Object attributes
The attribute byte colours and orients the object. On the Color the low three bits pick one of eight object palettes and bit 3 picks the tile's video RAM bank, where on the mono Game Boy only bit 4 (one of two palettes) and bits 5–7 were used.
| Bit | Meaning |
|---|---|
| 0–2 | Object palette 0–7. |
| 3 | Tile VRAM bank, 0 or 1. |
| 5 | Horizontal flip. |
| 6 | Vertical flip. |
| 7 | Priority behind the background's non-zero pixels. |
Object palettes
Eight object palettes hold four colours each, kept in a palette memory separate from the background's. Colour 0 of every object palette is transparent, so an object shows three colours over the scene. Each colour is fifteen bits, five a channel, written through the object palette index and data ports.
Per-scanline limits
The hardware draws at most ten objects on any one scanline; further objects on that line are dropped. When objects overlap, the Color resolves them by their order in OAM, the earlier entry in front, rather than by the X position the mono Game Boy compares first.