Picture Processing Unit: Difference between revisions

Content deleted Content added
Microprocessors must contain arithmetic and logic capabilities, as well as the ability to execute preprogrammed instructions on their own from RAM without any other supporting chips, something the NES PPU was clearly not capable of doing.
Technical information: The address space only allocates 8 KB for CHR ROM/RAM (the other 8 KB are for nametables). OAM was the official name for sprite memory and is now the most common term. The description of palettes was wrong.
Line 19:
The lowest graphical components the PPU operates with are [[tile]]s, which are blocks of 8×8 or 8×16 pixels. The tiles are stored in a [[Read-only memory|ROM]] chip on the game cartridge. They are the basic building blocks, used to create larger moving objects, or large static backgrounds.
 
Due to the small size of NES sprites, most moving objects are made of multiple onessprites. Only 8 sprites can be drawn per scanline, and so the PPU contains an "overflow" flag that is set if more than 8 sprites appear on a scanline. However, this flag is buggy and generates both false positives and false negatives, so it was seldom used.
 
As noted above, some games (mostly early MMC1 titles such as ''Legend of Zelda'' and ''Castlevania'') store their graphics data in the main PRG ROM. These have a CHR RAM chip instead of a ROM and pass the data from the PRG ROM to the CHR RAM, the main purpose of this being to produce animated background tiles. The arrival of the MMC3 mapper in 1988 eliminated the need for this as animated tiles could now be banked from the CHR ROM on the fly. As theThe PPU has a 14-bit address bus, it can access up to 16k8 KB of CHR ROM or RAM at once.
 
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-RAMObject Attribute Memory", or "SPR-RAMOAM" 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 tablenametable, it is a simple matter of adjusting the PPU's X/Y scrolling registers to move the screen around.
 
A color palette must be defined in order to show graphics on the screen. It is stored in a separate 32 byte ___location in RAM, known as "palette- RAM". Each entry here picks a color from the hardware color palette, which are the predefined colors to choose betweenfrom. 16There colorsare canfour bebackground chosenpalettes forand four sprite spritespalettes, andwith 16three colors for backgrounds. Howevereach, bytesplus 4,transparency. 8There andis 12also ofa thebackground sprite palettecolor, andwhich bytesis 0,normally 4,seen 8,behind andtransparent 12areas of the background palette, are not in use by the PPUtiles. ThereforeThus, the numberPPU ofcan actuallynormally usable colors is reduced todraw 25 insteadunique ofcolors 32. The first byte ofon the sprite palette also defines the global background color for both sprites and the backgroundscreen.
 
==See also==