Expand description
Objects: the 40 sprites the PPU draws over the background.
Each is four bytes in OAM at 0xFE00, described by OamEntry. Position is
offset so that a sprite can sit partly off screen: y of 16 and x of 8 put
it at the top left corner, and either axis at zero hides it.
Object tiles always read as Base8000,
whatever the background is set to. In Tall the low bit of the
index is ignored and the pair is drawn as one 8 by 16 sprite. See
https://gbdev.io/pandocs/OAM.html.
§What the hardware drops
Only PER_SCANLINE objects are drawn on any one scanline; the rest of that
line’s are skipped. Which ones survive is by x on the original Game Boy, lower first,
and by OAM index on the Game Boy Color. Nothing reports the loss.
§Writing OAM
Writing entries directly costs a blanking window per byte. The usual way is a
OamShadow page in work RAM, edited whenever, handed to the hardware in one
OamDma once a frame. See
https://gbdev.io/pandocs/OAM_DMA_Transfer.html.
Structs§
- OamDma
- The transfer routine, once it is in HRAM and callable.
- OamShadow
- A page of entries for
OamDmato hand over.
Enums§
- Size
- How tall an object is, from
LCDCbit 2. It applies to all of them at once.
Constants§
- DMA_LEN
- Bytes
OamDma::installneeds. Keep in step with theram_fnbelow. - ENTRY_
COUNT - Objects OAM holds.
- PER_
SCANLINE - Objects the PPU draws on one scanline.
- SPARE
- Bytes past the entries that the alignment pays for anyway.