Picture Processing Unit: Difference between revisions

Content deleted Content added
Backgrounds and sprites are not tiles - they're composed of them
No edit summary
Line 25:
Essentially, the PPU supports two different kinds of drawable objects: movable (sprites) and non-movable (background). Both kinds of objects are composed of tiles, and moreover a sprite and background object can use the same tile. The difference is that a tile used as a sprite can move around, whereas a tile used as a background cannot. There are no collision detection registers for sprites as was common on most game systems of the era.
 
Sprite data is stored in a special memory called the "Sprite-RAM" or "SPR-RAM" for short, which is a 256-byte memory built into the PPU core. The data stored here is 4 bytes;: the position, color and tile, for each of the 64 sprites. This data is used by the PPU to place the sprite when it [[Rendering (computer graphics)|renders]] the frame. Background objects, however, are stored in a much less exclusive way, which is more like the way characters are stored in [[text mode]] on [[Personal computer|PCs]]. A background is defined by a simple data structure called a nametable, which is essentially a two dimensional array. The integer value in each array slot corresponds to a tile number, and the index values of this slot correspond to the tile's intended x/y position on screen. The PPU has, without the use of memory mappers, two nametables, so smooth scrolling between backgrounds is possible.
 
Once tile data is set up in the pattern table, it is a simple matter of adjusting the PPU's X/Y scrolling registers to move the screen around.