OAM Memory


OAM Memory is extremely simple. There are 24 sprites, each with 4 bytes of attributes, with a decending priority (sprite 0 is drawn first, 23 is drawn last). There are 256 tiles worth of sprite memory, each being 16x16. Each sprite tile consists of 64 bytes of data... totalling in 16KB worth of graphics information. Asside from needing to be enabled per sprite, the VPU needs to be instructed to render sprites when nessessary. go to LCD Control for more information.

Sprite Memory Addresses
0x1300 Sprite 0
0x1304 Sprite 1
... ...
0x135C Sprite 23


Sprite Structure
Byte offset Description
+0 Sprite X location
+1 Sprite Y location
+2 Sprite Tile
+3 Sprite flags


Note that all sprite locations are relative to (-16,-16). This allows sprites to be positioned slightly off screen. I belive only the lower 7 bits are used. If the MSB is set, sprites most likely wrap.

Sprite 0 has the highest priority, it will be on top of all the others.

Sprite Attributes
Bit Description
0 Horizontal flip
1 Vertical flip
2 Invert Color
3 Enable (active high)
4 Unknown
5 Unknown
6 Unknown
7 Unknown


Sprite tiles themselves are stored in the format of 8 tiles, sequentially. The tiles are formatted the same way as the standard tile maps.

Mask (0,0) Mask (0,16) Color (0,0) Color (0,16) Mask (16,0) Mask (16,16) Color (16,0) Color (16,16)

Image

A mask affects both the color and the screen data. If a mask bit is 1, the respective color pixel is ignored. If the mask bit is 0, than the color pixel is copied over the screen pixel. This allows for transparent pixels.

See Hardware Registers for the sprite tile base.

Return to Pokemon Mini.