has posted an interview with Andrew Davie, a fellow who has created a game for the Atari 2600 recently called QB. They prodded him for some details as to what it’s like to program for the 2600 and he told them of the “synching with the electron gun” bit. I’d heard of this, but never seen it explained anywhere before. Here’s what he had to say:

A typical TV picture is composed of many horzontal lines (have a close look at any TV image). When a TV is drawing the picture that you see, it draws it line by line, very quickly. There are 262 lines in a typical NTSC TV image, and each image (“frame”) is displayed for just 1/60th of a second. So, in other words, the entire picture is redrawn 60 times per second. In all modern video game systems, there is a bit of hardware which “feeds” the correct picture to the TV, line by line, so that it draws the image you want. Typically, some memory on the console is used to contain the data for generating the TV image, and the hardware just looks at the memory to see what to send to the TV.

Now, in the Atari 2600, there is NO video memory. And there is NO hardware to tell the TV exactly what to display for the entire frame! All that the machine does have is a few registers (memory locations) to which you write single-bytes (8 pixels) of data. The hardware sends the contents of these registers to the TV. To get any meaningful pictures on the TV, you have to make your program write to these registers very very quickly, so that the changing pattern in the registers will draw the picture on your TV as the TV electron-beam sweeps line-by-line down the screen.

The only way to do this effectively is to know exactly how long it takes the TV to draw a single line, and exactly where the electron-beam is on the line, so that you can change the registers at exactly the right time. And the only way to be exactly sure of the time is to “cycle-count” your code. Basically, you have to know EXACTLY how long each instruction takes, and make sure that when you write data to the registers, you are “at” the correct place in the TV picture. In other words, not only does the code do all the drawing of the TV picture, it is actually totally in-synch with the So, Atari 2600 programmers are not just limited by the small amount of RAM (128 bytes) and ROM, but also by the need to do the work of a video-chip, by controlling the data that is sent to the TV for display. To get complex graphics on the screen, it is often necessary to change the registers in the MIDDLE of scan lines, at exactly the right point in time. It is quite challenging, and quite foreign most modern console programmers.

Holy shit! You have to give it the pixels as the TV is drawing them! How did anyone make a game for this console? Better yet, how did they make E.T. in 2 weeks, even as crappy as it was? No wonder people take up programming for the 2600 these days – if you can pull anything off on it you’re worth your salt. I’ll have to put this on my “to do” list – due date in the next five years or so…