VCS Technology

It is traditional for old timers to regale young-uns with improbable stories of the immense difficulties they faced as young-uns, the better to impress upon young-uns just how cushy their lives are. I shall not refrain from indulging myself in this matter, for indeed, my tales should give pause to younger game designers.

The VCS, internally known as "Stella" and designated the 2600, was not the first programmable home videogames machine Fairchild deserves the credit for that. Nor was it the best home videogame machine. However, it had the best combination of getting to market early with good technology, and with strong marketing, it dominated the market. However, its computing and display resources were appalling. Inside was a 6507 processor (a trimmed-down version of the classic 6502) running at 1.2MHz and a special interface chip called the TIA (Television Interface Adapter). It was also equipped with a luxurious 128 bytes not kilobytes, not megabytes, just plain old everyday bytes of RAM. There was no internal operating system of any kind; every scrap of code available to the system had to be inside the plug-in ROM inside the cartridge that the customer purchased and plugged into the VCS.

Are you choking on your coffee yet? The worst is yet to come: There was no bitmapped display system. You didn't simply write bits into some bitmap defining the display. Instead, Stella displayed one line at a time, and you changed the line display in real time.

To appreciate the trickiness of all this, you must understand the basics of CRT (cathode ray tube) operation. The CRT operates by shining a beam of electrons onto a special surface on the inside of the screen. The electrons hit the surface and excite the atoms there, causing them to emit light. The image is built up in three ways:

  • First, you control the intensity of the electron beam to make the spot brighter or dimmer.

  • Second, you sweep the electron beam across the screen in a special pattern called a raster (see Figure 15.1).

    15.1. Schematic representation of a raster scan display.

    graphics/15fig01.gif

    The electron beam starts at the upper-left corner of the screen and sweeps to the right, brightening and dimming to make the scan line of the screen brighter or dimmer. When it reaches the end of the scan line, it quickly jumps back to the left side of the screen and drops down by one scan line, as indicated by the gray arrow. Then it scans to the right again, repeating the process for each scan line in the display. Thus, if you have a 640x480 display, it uses 480 scan lines each broken into 640 separate pixels. At the bottom-right corner of the screen, the beam retraces its path to the upper left corner, as indicated by the diagonal gray arrow. During the periods where the beam is retracing, it is turned off so that nothing is drawn on the screen; those times when it is retracing horizontally are called horizontal blanking (HBLANK) and vertical blanking (VBLANK).

  • The third dimension of control is color; this is accomplished by making fine adjustments in the position of the electron beam so that it will hit the red, green, or blue portion of the pixel. Fortunately, at the programming level, this was not a direct concern; the TIA took care of this for you.

Now, the timing of all this is critical. In the VCS, each horizontal line took exactly 76 machine cycles of CPU execution time; vertical blanking was much longer, giving you about 3000 machine cycles. You programmed the display by loading up the TIA with data for the contents of one scan line. It transferred that data from its input registers to its internal buffer and then sent the signal out to the television. While it was busy doing this, you could reload the data registers with the display data for the next scan line. However, you had only 76 machine cycles to do so; this didn't permit a lot of time for snazzy display calculations. The entire display data structure for the VCS was as follows:

  • Playfield: 40 bits of simple on-off data, indicating whether the corresponding portion of the scan line was to be displayed in foreground color or background color. In other words, this was a black-and-white display, except that you could change the actual color values of black-and-white to, say, green and purple, or red and blue, or some other pair. But either way, you had only 40 horizontal pixels to work with.

  • Playfield colors: As I mentioned, you could specify the foreground and background colors from a set of 256 colors. You could also change the values of these colors from one scan line to the next, so that your black-and-white display could be green and purple for the first ten scan lines, red and blue for the next 40 scan lines, and so on. If you were really clever, you could change the values of these registers in the middle of the scan line, giving you not two but four glorious colors to work with! Of course, your timing had to be perfect to pull this off, and you also expended eight to twenty of your precious machine cycles pulling off this trick.

  • Players: This is confusing terminology. The player here was not the actual person playing the game: It was a graphic image meant to be highly maneuverable that would almost always be used to depict the player's piece on the playfield. You had two of these. Each was an eight-bit wide chunk of binary pixel data, with its own color registers for foreground and background, just as with playfield. Players were special in two ways: First, they were displayed at four times higher resolution than the playfield; and second, they could be moved around horizontally by changing the value in a single register.

  • Missiles: These were single-bit versions of players. They were meant to be the bullets that players shot at each other.

Thus, to put a display up on the screen, you had to write a tight little routine called the kernel that stuffed information into the various data registers of the TIA, keeping track of which scan line you were on and changing the values as the beam moved down the screen. If you wanted a more intricate display, you'd need to change the registers more often, which required more machine cycles. But if you took more than the maximum of 76 cycles per scan line, your display would get out of synch with the television, and the screen would turn into pixellated garbage. Most VCS programming was a battle to squeeze maximum display intricacy into 76 cycles, and VCS programmers knew the cycle counts of all the 6502 instructions by heart. It was part of the daily office routine to hear an anguished cry from an office down the hall: "77 cycles!" another programmer would have to completely redesign his kernel. (Actually, there were not one but two female VCS programmers at Atari during my tenure there: Carol Shaw and Carla Meninsky.)

So I hope that you're properly impressed with just how hard it was to design games back in those days. Did I mention that we had to walk twelve miles through the snow to get to work each morning?



Chris Crawford on Game Design
Chris Crawford on Game Design
ISBN: 0131460994
EAN: 2147483647
Year: 2006
Pages: 248

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net