CTIA and GTIA - Player/Missile Graphics (sprites)

Player/Missile Graphics (sprites)

A hardware sprite system is handled by CTIA/GTIA. The official ATARI name for the sprite system is "Player/Missile Graphics", since it was designed to reduce the need to manipulate display memory for fast-moving objects, such as the "player" and his weapons, "missiles", in a shoot 'em up game.

A Player is essentially a glyph 8 pixels wide and 256 TV lines tall, and has two colors: the background (transparent) (0 in the glyph) and the foreground (1). A Missile object is simmilar, but only 2 pixels wide. CTIA/GTIA mixes the "foreground" color with the pixel beneath it, and displays the pixel "behind" the background color (that is, the main display) without change. A register value can set the Player or Missile pixels width to 1, 2, or 4 color clocks wide.

The Player/Missile implementation by CTIA/GTIA is similar to the TIA's. A Player is an 8-bit value or pattern at a specified horizontal position which repeats for each scan line or until the pattern is changed by the CPU. Missiles are 2-bits wide and share the pattern register, so that four, 2-bit wide values occupy the 8-bit wide pattern register, but each missile has an independent horizontal position. Player/Missiles extend the height of the display including the screen border. That is, the default implementation of Player/Missile graphics by CTIA/GTIA is a stripe down the screen. While seemingly limited this method allows Player/Missile graphics to be used as alternate colored vertical borders or separators on a display, and when priority values are set to put Player/Missile pixels behind playfield pixels they can be used to add additional colors to a display.

The conventional idea of a sprite with an image/pattern that varies vertically is also built into the Player/Missile graphics system. The ANTIC chip includes a feature to perform DMA automatically feeding new pixel patterns to CTIA/GTIA as the display is generated. This can be done for each scan line or every other scan line resulting in Player/Missile pixels one or two scan lines tall. In this way the Player/Missile object could be considered an extremely tall character in a font, 8 bits/pixels wide, by the height of the display.

There are eight objects; four "Players" each eight pixels wide and four "Missiles" each two pixels wide. Each Player and Missile has its own horizontal position register. While the four missiles have independent horizontal position registers, they share one 8-bit data register for the image pattern. The four "Missiles" can be grouped together to create a fifth, eight pixel wide "Player". CTIA/GTIA has a color control register that causes the pixels of two Players to generate a third color where the pixels overlap allowing multi-colored Player objects at the expense of reducing the number of available objects.

Moving the Player/Missile objects horizontally is as simple as changing a register in the CTIA/GTIA (in Atari BASIC, a single POKE statement moves a player or missile horizontally). Moving an object vertically is achieved by block moving (or rotating) the definition of its glyph in memory which is quite fast in 6502 machine language, even though the 6502 lacks a block-move instruction like the 8080, because the sprite is exactly 128 or 256 bytes long and so the indexing can be easily accommodated in a byte-wide register on the 6502. However, block memory moves are painfully slow in Atari BASIC, and so BASIC programs using Player/Missile graphics will ordinarily include short USR routines to perform the memory moves, or utilize a large string as the Player/Missile memory map and perform string move commands to accomplish the high speed memory moves.

Careful use of Player/Missile graphics with the other graphics features of the Atari hardware can make graphics programming, particularly games, significantly simpler.

Read more about this topic:  CTIA And GTIA

Famous quotes containing the words player and/or missile:

    The best chess-player in Christendom may be little more than the best player of chess; but proficiency in whist implies capacity for success in all these more important undertakings where mind struggles with mind.
    Edgar Allan Poe (1809–1845)

    ... the truth is the hardest missile one can be pelted with.
    George Eliot [Mary Ann (or Marian)