(Recovered from SMWiki, improvements are welcome.)
Latest revision as of 00:42, 10 November 2019
Object Attribute Memory, also known as OAM, is a chunk of memory in the PPU that stores the data about the sprite tiles to draw onto screen. It contains 128 "sprite slots", each slot requiring 4 bytes in the main table and two additional bits stored separately in a smaller table towards the end of the OAM.
The primary table starts at OAM address 0x000 and, as previously stated, each slot is 4 bytes big, meaning that the second slot starts at 0x004, the third at 0x008, etc. The entire primary table is 0x200 bytes big.
The first byte of each slot is the X coordinate of the upper left corner of the sprite. The second byte is the Y coordinate. The third byte is the lower 8 bits of the tile number and the fourth is the YXPPCCCT data.
The secondary table starts at OAM address 0x200 and is merely 32 bytes large.
The first byte contains the two extra bits for slots 0-3, the second byte for 4-7, etc. The order within each byte is "lower slot at lower bits", meaning that the two lowest bits in the first byte are thus the extra bits for slot 0.
Of the two extra bits, the lowest is the 9th bit of the X position (which allows sprites to be shown partially outside the left edge of the screen. The highest of the two bits is the size bit. In SMW, this means that setting this to 0 makes it an 8x8 sprite while 1 makes it a 16x16 sprite.