[][src]Module gba_addresses::oam

Object Attribute Memory (OAM).

This portion of memory intermixes the Object (OBJ) Attributes, as well as the Affine Parameters.

  • Object Attributes:
    • You get 128 object entries.
    • Each complete entry is three 16-bit values. These pseudo-fields are referred to as "attr0", "attr1", and "attr2".
    • There's also a 16-bit span that's not part of the object attributes after each set of attributes, before the next attribute entry begins.
  • Affine Parameters
    • You get 32 affine parameter entries.
    • Each complete entry is four 16-bit values. These pseudo-fields are referred to as "pa", "pb", "pc", and "pd".
    • The parameters use the memory in between the object attribute memory entries described above. The the first pa is 6 bytes in from the start of OAM, then pb, pc, and pd are strided 8 bytes at a time from there, then the next affine parameter entry begins 8 bytes after that.

You cannot validly write a single byte to OAM. If you do so, the 8-bits are written to both the upper and lower 8-bits of the given 16-bit segment of memory. This isn't a big deal, since all the pseudo-fields of the stuff in OAM uses 16-bits anyway.

  • Size: 1kb
  • Wait states: 0
  • Bus Size: 32-bit
  • Read/Write: 16/32

Constants

OBJ_AFFINE_COUNT

There are 32 affine parameter entries.

OBJ_AFFINE_PA_BASE_ADDR

Base address of the affine parameter pa fields.

OBJ_AFFINE_PB_BASE_ADDR

Base address of the affine parameter pb fields.

OBJ_AFFINE_PC_BASE_ADDR

Base address of the affine parameter pc fields.

OBJ_AFFINE_PD_BASE_ADDR

Base address of the affine parameter pd fields.

OBJ_AFFINE_STRIDE

Stride of each affine parameter entry.

OBJ_ATTR0_BASE_ADDR

Base address of the object attribute attr0 fields.

OBJ_ATTR1_BASE_ADDR

Base address of the object attribute attr1 fields.

OBJ_ATTR2_BASE_ADDR

Base address of the object attribute attr2 fields.

OBJ_ATTR_COUNT

There are 128 object attribute entries.

OBJ_ATTR_STRIDE

Stride of each object attribute entry.

Functions

index_obj_affine_param

Index the affine parameters to a given entry.

index_obj_attr

Index the object attributes to a given entry.