2600 101

The Development Environment

There's nothing like getting your feet wet with compiling and playing some real Atari programs to whet your appetite for making your own works. This page will tell you how to do that on a PC running Windows. (There's nothing to stop you from doing this on a Mac, but that's beyond the scope of this tutorial.)

Step One: The Emulation
One cool thing about making Atari games is that you get to play Atari games. A number of great emulators are available free for Windows that you play nearly any Atari game ever made. Here are the three I've played with: (You might want to stop and think about a logical layout for your stuff. I have a single "atari" directory, with different subdirectories for tools, emulators, bins, and misc. docs I've collected. Also, I made sure to name all directories with names less than 8 letters, with no spaces...this makes things a little simpler with Z26 and DASM (below), which have an old fashioned view of file systems... Life might be easier if you do something similar, but hey, it's your harddrive.)

Once you've downloaded your emulator, you should test to see that it works on your system. This can be a very pleasant task for obvious reasons (assuming there aren't any glitches, and there weren't for me), and also will familarize you with the keyboard/joystick setups. StellaX makes this very easy for you, with the ROMs (files that end in .BIN) preinstalled when you unpack the program. For the most part these are homebrew carts. (You can also point StellaX to a different directory from the Options menu, if you want to organize your life differently.)

There are also old Atari ROMs floating around. The strict legality of these is in question (as is the morality for games that have also had commercial rerelease on modern systems) so you're on your own for those.

Step Two: The Compilation
An assembler is a program that takes the Assembly source code and makes it into a binary image that an emulator can run. DASM V2.12.04 is the assembler of choice. I had trouble finding the latest version of this for DOS/Windows so I'm including this version here. Download it. Touch it. Love it.

You are now ready to compile and run your first Atari program. We'll use Chris "Crackers" Cracknell's 2600 Digital Clock (from hell!!!) Here is the source code for it. Either right click and save it as "clock003.asm" or cut and paste the code into notepad and save. (Don't use an editor like Word that will much up the textfile with all sorts of formatting crap.) Incidentally, the ".asm" isn't crucial, just a convention people follow.

Now we're really ready! I'm going to assume you saved it in the same directory as DASM, otherwise make the appropriate path changes when you enter the following line:
	dasm clock003.asm -f3 -oclock.bin
The -f3 is crucial--I learned that the hard way, and had to get help from the Stella list. (It has to do with the format of the resulting binary file.) The other parts of this line should be obvious: assemble the file "clock003.asm", put the resulting file in "clock.bin".

If neccesary, move the .bin to the appropriate directory and run it from your emulator. You should see a big friendly 12:00 staring you in the face. And if you wait around, 12:01. (You can set the time using the joystick.)

Great! You've now assembled and ran your first Atari program. You're now mostly ready to go to The Dig's Source Page and compile run some more demos...but there's one big catch, and its name is "vcs.h". VCS.H is a file that sets up many constants that the Atari relies on, letting programmers use codes like "WSYNC" rather than ugly hex numbers like "$02". (One of the reasons I picked the clock example was because it made these definitions within the file itself instead of depending on an external VCS.H) This file should sit in the same directory as DASM. But here's the problem: there are a few versions of this file floating around. They're mostly compatible with each other, but there are some differences. (Once you get your programming legs under you, you'll be better able to figure out and fix the difference problem when it arises.) Here's the VCS.H file I've been using, The Dig Docs have a few more.

Step Three
Now might be a good time to check out Adam Trionfo's Changing Atari VCS Graphics- The Easy Way (local mirror, or Google can get you an HTML version.) It's a painless way of learning how to hack the graphics in games like Space Invaders, and you'll be introduced to a few extra tools as well.

Next: Into The Breach

Introduction - The Development Environment - Into The Breach - My First Program -
Kernal Clink - The Joy of Sticks - Happy Face - PlayerBufferStuffer