Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| ppu [2021/09/05 14:59] – [Layer 1 and 2 registers] simer | ppu [2021/09/05 16:10] (current) – [Layer 1 and 2 registers] simer | ||
|---|---|---|---|
| Line 78: | Line 78: | ||
| * Bit 2: Mirror the tiles horizontally | * Bit 2: Mirror the tiles horizontally | ||
| * Bit 3: Mirror the tiles vertically | * Bit 3: Mirror the tiles vertically | ||
| - | * Bits 4 and 5: Width of tiles | + | * Bits 4-5: Width of tiles | 
| * 00 - 8 pixels | * 00 - 8 pixels | ||
| * 01 - 16 pixels | * 01 - 16 pixels | ||
| * 10 - 32 pixels | * 10 - 32 pixels | ||
| * 11 - 64 pixels | * 11 - 64 pixels | ||
| - | * Bits 6 and 7: Height of tiles | + | * Bits 6-7: Height of tiles | 
| * Same format as width register | * Same format as width register | ||
| - | * Bits 8 to 11: Palette bank to use | + | * Bits 8-11: Palette bank to use | 
| - | * Bits 12 and 13: Layer depth (wether it is under or over sprites and the other layer) | + | * Bits 12-13: Layer depth (wether it is under or over sprites and the other layer) | 
| * 00 - bottom layer | * 00 - bottom layer | ||
| * 01 - second-bottom layer | * 01 - second-bottom layer | ||
| * 10 - second-top layer | * 10 - second-top layer | ||
| * 11 - top layer | * 11 - top layer | ||
| - | * Bits 14 and 15: unused (in later PPU generations it sets the layer size) | + | * Bits 14-15: unused (in later PPU generations it sets the layer size) | 
| The control register can do the following: | The control register can do the following: | ||
| Line 106: | Line 106: | ||
| When the attribute map mode is used, each word stores attributes for one tile in each byte in the following format: | When the attribute map mode is used, each word stores attributes for one tile in each byte in the following format: | ||
| - | * Bits 0 to 3: Palette bank to use | + | * Bits 0-3: Palette bank to use | 
| * Bit 4: Mirror the tiles horizontally | * Bit 4: Mirror the tiles horizontally | ||
| * Bit 5: Mirror the tiles vertically | * Bit 5: Mirror the tiles vertically | ||
| Line 127: | Line 127: | ||
| The sprite position refers to the center of the sprite (rather than top left corner) and contains signed values with pixel position x=160,y=128 as the origin of the coordinate system and positive Y going upwards. | The sprite position refers to the center of the sprite (rather than top left corner) and contains signed values with pixel position x=160,y=128 as the origin of the coordinate system and positive Y going upwards. | ||
| - | Unlike for layers, there is no tile and attribute map: a sprite is made of one single tile, which ID is stored directly in the corresponding register for the sprite. | + | Unlike for layers, there is no tile and attribute map: a sprite is made of one single tile, with the character | 
| + | The sprite attribute register format is the same as the one for tile layers, with the exception of bit 14 being assigned to blend enable. | ||
| ===== Colors and palettes ===== | ===== Colors and palettes ===== | ||
| Line 139: | Line 140: | ||
| In the 16-bit color mode, the value of each pixel in the segment memory directly stores a color, otherwise the value refers to a palette index. | In the 16-bit color mode, the value of each pixel in the segment memory directly stores a color, otherwise the value refers to a palette index. | ||
| The palette memory is mapped to 0x2B00-0x2BFF and stores 256 different colors in the format mentioned above. | The palette memory is mapped to 0x2B00-0x2BFF and stores 256 different colors in the format mentioned above. | ||
| - | This memory can be split into multiple | + | This memory can be split into multiple | 
| The chosen color from the palette memory is determined by the chosen color depth and palette of each tile/sprite and value of each pixel as follows: | The chosen color from the palette memory is determined by the chosen color depth and palette of each tile/sprite and value of each pixel as follows: | ||
| - | ^ Color depth ^ Chosen color ^ | + | ^ Color depth ^ Chosen color memory index ^ | 
| | 2-bit | Palette * 16 + Index | | | 2-bit | Palette * 16 + Index | | ||
| | 4-bit | Palette * 16 + Index | | | 4-bit | Palette * 16 + Index | | ||




