Atari 2600

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search

The Atari 2600 is the first successful programmable games console; having been introduced in 1977 it was not discontinued until 1992.

It is therefore notable for the extremely limited hardware provided and for the extent to which programmers were incentivised to try to exploit it and their prolonged opportunity for doing so.

The 2600's video chip, the Television Interface Adaptor ('TIA') has no memory access interface. It provides registers to which the programmer can push 20 pixels of background graphics data (either repeated or mirrored for a 40-pixel background scaled up to fill all 160 pixels of the display), two sets of 8 pixels of sprite data and enable/disable selections for three further fixed-rectangular entites: two 'shots' and one 'ball'. Various options exist for scaling the movable objects (e.g. displaying a sprite's 8 pixels as 16 by doubling each) and for repeating them (e.g. having a sprite painted both at its current position and also sixteen pixels to the right).

Further complexity comes from the fact that the TIA does not request that a programmer specify where a movable object should appear, but when it should appear. Each movable object is represented by a counter that runs for a 160-pixel period and then resets. The movable object is drawn when the counter resets. The programmer can also reset it at any time, thereby setting the horizontal position of the sprite. In practice the programmer needs to do so only coarsely, since the TIA also provides some help in moving an existing object left or right by optionally also clocking it in the border period. It extends the border by eight pixels on the left edge to buy the correct amount of time to do so — this leads to a trademark feature of many Atari games that small horizontal chunks are cut out of the left side of the display and move up and down with sprites.

Given the requirements of sprite positioning, that the TIA has only enough storage for a single line of information, and that it generates horizontal sync automatically but not vertical, Atari 2600 games tend to be based around a display kernel, which simply runs in parallel with the raster and pushes new information to the TIA as the display paints. This is the famous 'racing the beam'.

This isn't quite as hard as it might sound since the TIA offers a sync feature, whereby the programmer can retire the processor until the next horizontal sync. So a simple kernel's job is: wake up, set the values for the current line and/or enable sync, go to sleep again until next horizontal sync.

A complicated kernel is aware of exactly when different pushed values will be referenced and updates them live — e.g. dynamically changing the contents of a sprite that is repeated three times to make it look like three different sprites with a fixed spacing. Using the two sprites together in this manner is commonly used to produce a six-digit score line. Changing the 20 pixels of provided background information so that all 40 pixels of drawn background are distinct is also relatively common.

The Atari uses a cut-down version of the 6502 with a restricted number of address lines. As a result the window for cartridges is only 4kb. Therefore several on-cartridge banking schemes exist. Only one cartridge is known to try to extend the hardware beyond greater addressing: Pitfall II provides some additional timers and an additional built-in sound generator. The processor copies one PCM sample from the cartridge to the TIA each line.

An advantage of the primitive hardware that ties the TIA directly to the task of composite video generation is an unexpectedly large colour palette: 128 colours in its native NTSC. This is because each 7-bit colour selection is converted directly to a 4-bit phase offset applied to the colour subcarrier and a 3-bit amplitude applied to the luminance output, allowing two very cheap bits of electronics to produce a wide range of colours at the cost of those colours being dictated by the mathematics rather than by any human judgement.