OAM layout: Difference between revisions
From SNESdev Wiki
Jump to navigationJump to search
m (Jeffythedragonslayer moved page OAM ASCII TABLE to OAM ASCII Table: "TABLE" was all caps) |
(number of bits for properties in last byte of dword in low table) |
||
(9 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
OAM is a total of 544 bytes in size, consisting of a 512 byte low table and a 32 byte high table. | [[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. | It holds the properties of up to all 128 sprites. | ||
Each of these cells represents one byte. The high table packs information on 4 sprites into each byte. | Each of these cells represents one byte. The low table spreads information on each sprite across 4 bytes, and the high table packs information on 4 sprites into each byte. | ||
<pre> | <pre> | ||
--+------------------+------------------+------------------+------------------------------------------------+ | --+------------------+------------------+------------------+------------------------------------------------+ | ||
L | Sprite #0 | Sprite #0 | Sprite #0 | Sprite #0 | | 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) | | O | x pos (low bits) | y pos | tile (low bits) | flip v/h, priority, palette, high bit of tile | | ||
W | | | | (2 bits) (2 bits) (3 bits) | | |||
+------------------+------------------+------------------+------------------------------------------------+ | |||
T | Sprite #1 | Sprite #1 | Sprite #1 | Sprite #1 | | |||
A | x pos (low bits) | y pos | tile (low bits) | flip v/h, priority, palette, high bit of tile | | |||
B +------------------+------------------+------------------+------------------------------------------------+ | |||
L | Sprite #2 | Sprite #2 | Sprite #2 | Sprite #2 | | |||
E | x pos (low bits) | y pos | tile (low bits) | flip v/h, priority, palette, high bit of tile | | |||
+------------------+------------------+------------------+------------------------------------------------+ | |||
| | | | | | | | | | | | ||
| .... | ... | ... | ... | | | .... | ... | ... | ... | | ||
Line 20: | Line 21: | ||
+------------------+------------------+------------------+------------------------------------------------+ | +------------------+------------------+------------------+------------------------------------------------+ | ||
| Sprite #127 | Sprite #127 | Sprite #127 | Sprite #127 | | | 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 | | x pos (low bits) | y pos | tile (low bits) | flip v/h, priority, palette, high bit of tile | | ||
--+------------------+------------------+------------------+------------------------------------------------+ | --+------------------+------------------+------------------+------------------------------------------------+ | ||
H | Sprites # | H | Sprites #0-3 | Sprites #4-7 | Sprites #8-11 | Sprites #12-15 | | ||
I | | | | | | I | | | | | | ||
G | | | | | | G | | | | | | ||
H | size select bits | size select bits | size select bits | size select bits | | H | 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 | | |||
T | +--+--+--+--+ | +--+--+--+--+ | +--+--+--+--+ | +--+--+--+--+ | | T | +--+--+--+--+ | +--+--+--+--+ | +--+--+--+--+ | +--+--+--+--+ | | ||
A | |s |s |s |s | | |s |s |s |s | | |s |s |s |s | | |s |s |s |s | | | A | |s |s |s |s | | |s |s |s |s | | |s |s |s |s | | |s |s |s |s | | | ||
Line 32: | Line 34: | ||
L | | x| x| x| x| | | x| x| x| x| | | x| x| x| x| | | x| x| x| x| | | L | | x| x| x| x| | | x| x| x| x| | | x| x| x| x| | | x| x| x| x| | | ||
E | +--+--+--+--+ | +--+--+--+--+ | +--+--+--+--+ | +--+--+--+--+ | | E | +--+--+--+--+ | +--+--+--+--+ | +--+--+--+--+ | +--+--+--+--+ | | ||
| ^ ^ ^ ^ | | ^ ^ ^ ^ | ^ ^ ^ ^ | ^ ^ ^ ^ | ^ ^ ^ ^ | | ||
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ||
| hi x bits | hi x bits | hi x bits | hi x bits | | | hi x bits | hi x bits | hi x bits | hi x bits | | ||
+------------------+------------------- | +------------------+------------------+------------------+------------------------------------------------+ | ||
| | | | | | | | | | | | ||
| .... | ... | ... | ... | | | .... | ... | ... | ... | | ||
Line 41: | Line 43: | ||
+------------------+------------------+------------------+------------------------------------------------+ | +------------------+------------------+------------------+------------------------------------------------+ | ||
| Sprites #112-115 | Sprites #116-119 | Sprites #120-123 | Sprites #124-127 | | | Sprites #112-115 | Sprites #116-119 | Sprites #120-123 | Sprites #124-127 | | ||
| | | | | | | | | | | | ||
| | | | | | | | | | | | ||
| size select bits | size select bits | size select bits | size select bits | | | 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 | | | | |s |s |s |s | | |s |s |s |s | | |s |s |s |s | | |s |s |s |s | | | ||
Line 51: | Line 53: | ||
| | x| x| x| x| | | x| x| x| x| | | x| x| x| x| | | x| x| x| x| | | | | 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 | | | hi x bits | hi x bits | hi x bits | hi x bits | | ||
+------------------+------------------+------------------+------------------------------------------------+ | +------------------+------------------+------------------+------------------------------------------------+ | ||
</pre> | </pre> |
Latest revision as of 22:52, 22 July 2022
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 to all 128 sprites.
Each of these cells represents one byte. The low table spreads information on each sprite across 4 bytes, and 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 | | | | (2 bits) (2 bits) (3 bits) | +------------------+------------------+------------------+------------------------------------------------+ T | Sprite #1 | Sprite #1 | Sprite #1 | Sprite #1 | A | x pos (low bits) | y pos | tile (low bits) | flip v/h, priority, palette, high bit of tile | B +------------------+------------------+------------------+------------------------------------------------+ L | Sprite #2 | Sprite #2 | Sprite #2 | Sprite #2 | E | x pos (low bits) | y pos | tile (low bits) | flip v/h, priority, palette, high bit of tile | +------------------+------------------+------------------+------------------------------------------------+ | | | | | | .... | ... | ... | ... | | | | | | +------------------+------------------+------------------+------------------------------------------------+ | 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 #0-3 | Sprites #4-7 | Sprites #8-11 | Sprites #12-15 | I | | | | | G | | | | | H | 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 | 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 | +------------------+------------------+------------------+------------------------------------------------+