OAM layout
From SNESdev Wiki
Jump to navigationJump to search
OAM is a total of 544 bytes in size, consisting of a 512 byte low table and a 32 byte high table. It holds the properties of up all 128 sprites.
Each of these cells represents one byte. The high table packs information on 4 sprites into each byte.
--+------------------+------------------+------------------+------------------------------------------------+ L | Sprite #0 | Sprite #0 | Sprite #0 | Sprite #0 | O | x pos (low bits) | y pos | tile (low bits) | flip v/h, priority, palette, high bit of tile) | W +------------------+------------------+------------------+------------------------------------------------+ | Sprite #1 | Sprite #1 | Sprite #1 | Sprite #1 | T | x pos (low bits) | y pos | tile (low bits) | flip v/h, priority, palette, high bit of tile) | A +------------------+------------------+------------------+------------------------------------------------+ B | Sprite #2 | Sprite #2 | Sprite #2 | Sprite #2 | L | x pos (low bits) | y pos | tile (low bits) | flip v/h, priority, palette, high bit of tile) | E +------------------+------------------+------------------+------------------------------------------------+ | | | | | | .... | ... | ... | ... | | | | | | +------------------+------------------+------------------+------------------------------------------------+ | Sprite #127 | Sprite #127 | Sprite #127 | Sprite #127 | | x pos (low bits) | y pos | tile (low bits) | flip v/h, priority, palette, high bit of tile) | --+------------------+------------------+------------------+------------------------------------------------+ H | Sprites #1-4 | Sprites #5-8 | Sprites #9-12 | Sprites #13-16 | I | | | | | G | | | | | H | size select bits | size select bits | size select bits | size select bits | | | | | | | | | | | | | | | | | | | | | | T | +--+--+--+--+ | +--+--+--+--+ | +--+--+--+--+ | +--+--+--+--+ | A | |s |s |s |s | | |s |s |s |s | | |s |s |s |s | | |s |s |s |s | | B | |#4|#3|#2|#1| | |#4|#3|#2|#1| | |#4|#3|#2|#1| | |#4|#3|#2|#1| | L | | x| x| x| x| | | x| x| x| x| | | x| x| x| x| | | x| x| x| x| | E | +--+--+--+--+ | +--+--+--+--+ | +--+--+--+--+ | +--+--+--+--+ | | ^ ^ ^ ^ | ^ ^ ^ ^ | ^ ^ ^ ^ | ^ ^ ^ ^ | | | | | | | | | | | | | | | | | | | | | | | hi x bits | hi x bits | hi x bits | hi x bits | +------------------+------------------+------------------+------------------------------------------------+ | | | | | | .... | ... | ... | ... | | | | | | +------------------+------------------+------------------+------------------------------------------------+ | Sprites #112-115 | Sprites #116-119 | Sprites #120-123 | Sprites #124-127 | | | | | | | | | | | | size select bits | size select bits | size select bits | size select bits | | | | | | | | | | | | | | | | | | | | | | | v v v v | v v v v | v v v v | v v v v | | +--+--+--+--+ | +--+--+--+--+ | +--+--+--+--+ | +--+--+--+--+ | | |s |s |s |s | | |s |s |s |s | | |s |s |s |s | | |s |s |s |s | | | |#4|#3|#2|#1| | |#4|#3|#2|#1| | |#4|#3|#2|#1| | |#4|#3|#2|#1| | | | x| x| x| x| | | x| x| x| x| | | x| x| x| x| | | x| x| x| x| | | +--+--+--+--+ | +--+--+--+--+ | +--+--+--+--+ | +--+--+--+--+ | | ^ ^ ^ ^ | ^ ^ ^ ^ | ^ ^ ^ ^ | ^ ^ ^ ^ | | | | | | | | | | | | | | | | | | | | | | | hi x bits | hi x bits | hi x bits | hi x bits | +------------------+------------------+------------------+------------------------------------------------+