Brush off the dust and have some fun!

Distellamap: Tracing logic in Atari games

Somebody get that freaking duck away from me!Back when I was first learning procedural programming with C, I remember “gotos are evil! Never use them!” being drilled into my head over and over. I would shrug it off, telling myself that I can easily keep track of where I’m going and what the logic is doing. I really wasn’t writing anything complex at the time, and the goto statement in C came in handy for several sticky situations. As my programming grew more and more complex and the need for long debug sessions grew, I started to understand my instructor’s reservations about the goto. Stepping through pages and pages of code line-by-line to find the crippling bug was made more and more difficult as each goto blasted the code pointer to far-off places, jumping around like a game of hopscotch, with no easy way to find my way back.

Ben Fry, who has spent many years at MIT combining computer science, statistics, graphic design and data visualization, has traced the operation of several classic Atari games in an exhibit titled Distellamap, including Adventure, pictured to the right. Each game’s code has been presented as Atari 2600 assembly code, with arcs drawn between the two points of a goto statement. Pac-Man and Q-Bert are apparently more complex than the other three games analyzed.

Like any other game console, Atari 2600 cartridges contained executable code also commingled with data. This lists the code as columns of assembly language. Most of it is math or conditional statements (if x is true, go to y), so each time there’s “go to” a curve is drawn from that point to its destination.

Looking at all the logic traces from just these simple games should easily demonstrate why gotos and other such logic jumps are a pain in the neck to debug and should be avoided wherever possible!

You must be logged in to post a comment.