Adventures in Atari BASIC: Lesson One – Programmer Kids and Plotting Stars

By Mikey Walters / September 6, 2016

This is the first in a series of articles about programming in Atari BASIC. Space Assault source code and references can be found here.

10 PRINT “Introduction”

Analog Space AssaultWhen someone chooses a computer to purchase today, they usually consider only what the computer can do based on available software. They’re thinking about what games they can play, what kinds of entertainment media they can enjoy, and how fast they can access the web. But in the 8-bit home computer boom of the late 1970s and early 1980s, choosing a new computer was based largely on what kind of software you wanted to create yourself. Kids who grew up in that era were part of a DIY software revolution that we may never see again, a time when nearly everyone with a PC at least dabbled in programming. We selected our computers based on what programming languages were available, based on graphics and sound capabilities, and worried if we needed to spring for 48K of RAM. I thoroughly enjoyed being part of that time, and it paved the way for my 25-plus-year career in software development.

My pride and joy computer of childhood was the Atari 800, and, after learning how to accomplish a few things in Atari BASIC (the programming language provided by Atari via cartridge), I decided to write my own games. I wrote quite a few, using techniques I learned from the many programming magazines and books of the time. All of my programs have been lost to time except one, because I was lucky enough to have the source code for my game Space Assault published in ANALOG Computing magazine in September 1983, which was quite exciting! In 2013 I was able to resurrect the game by using an Atari 800 emulator on my MacBook Air, which meant typing in the entire source code line by line, just like anyone who bought the magazine over 30 years ago had to do.

I recently realized, while talking shop with my younger coworkers, that most of them had no concept of what programming was like at that time. Even my boss didn’t realize that people would diligently type in source code from a magazine to try out someone else’s software masterpiece. Being a web developer now and relying on the browser to handle so much user interaction, I can certainly understand how my coworkers would be baffled by concepts like reading joystick positions in a main loop or drawing a game playfield by plotting it one pixel and line at a time. It made me think that a series of articles on “ancient programming” would be interesting to write and, hopefully, interesting for others to read.

In each segment of “Adventures in Atari BASIC,” I’ll dissect the source code of Space Assault to demonstrate what amateur game programming was like in the early 1980s. I’ll try to remember what I was thinking and what decisions I made while I was developing the game, and along the way we’ll learn about fun things like graphics modes, player sprites, and sound generation. I won’t actually be covering the fundamentals of the BASIC language or how to get an emulator running on today’s hardware platforms, but I’ll provide some references to some of the materials that helped me learn as a teenager. (A link to both the references and the Space Assault source code will appear at the beginning of each article.)

20 PRINT “About Space Assault”

Before we get started, it might be helpful to know a little about the game. You can read the backstory I came up with in the ANALOG article, but here’s a quick overview. The object is to protect several bases from enemies that fly horizontally across the playfield. You move a crosshair with the joystick, and fire a laser weapon to fight three kinds of ships. Enemies fire down on your bases, and when all of the bases are destroyed, the game is over.

Space Assault 2

Obviously I was a fan of Missile Command (1980), so I borrowed the city protection and crosshair aiming aspects, but I swapped out ICBMs for enemy ships since I wanted to create player sprites. I enjoyed the “tedious” work of drawing the playfield (stars, bases, and laser tower), designing sounds for lasers and explosions, and I even added a title screen with a snippet of music borrowed from Disney’s The Black Hole (1979). When the game was finished, I think I was most proud of the earthquake effect when a base is destroyed, which I’ll cover in a future article.

I think most amateur game designers at the time had similar goals in mind. First, create something you actually want to play. Second, keep the design simple but add a few technical challenges to improve your programming skills. And third, take advantage of shared techniques to make something better than you could on your own. Because I could play Missile Command at any time by popping in a cartridge, I wanted to try out my own unique variations on Space Assault to see if I could do it. I had a little experience with player sprites, so I knew I could make them work, but I wanted to make them faster using a routine I had read about in ANALOG Computing #10 (just a few issues before my game was published). Despite not having the internet, the amount of available reference material to teach and inspire was amazing. It did require, however, a healthy allowance and multiple trips to the local computer store!

30 PRINT “Random Stars”

Now, let’s actually look at some code. Before the action begins, the playfield must be created. Space Assault’s playfield is mostly black with a few purple stars. Today you might Google for a photograph taken by the Hubble telescope and reference that in your code, but in Atari BASIC, everything is drawn from scratch. Here’s the code that draws the stars:

Space Assault 1

First, the GRAPHICS command sets a display mode for the game, which gives us 160 by 96 pixels to work with (quite different from the fairly minimal 1024 by 768 average today). Next, the SETCOLOR commands set up three colors (gray, purple, green) for us to work with later, and the COLOR command selects a color (purple).

Now we use a FOR loop to do something 50 times. In this case, the PLOT command says to fill in a single pixel at an X,Y coordinate, and we use the RND command to select random horizontal (X) values from 0 to 159 (the full width of the playfield) and random vertical (Y) values from 40 to 95. Since 0,0 is the top left of the screen, we are avoiding putting stars in the upper half of the playfield. I originally had stars filling the entire screen, but, as we’ll see eventually, we’re going to be drawing and erasing a laser beam in the top half of the screen, which accidentally erased stars and looked funny. This is a great example of a design decision made during development in which “good enough” was fine with me.

Space Assault 3

So far the playfield isn’t very impressive, but we did manage to draw 50 stars with only a couple of lines of code. In my next article, we’ll flesh out the playfield with our bases and some terrain.


Walters AvatarMikey Walters lives in Austin, Texas, and has an entire room devoted to toys, including Mego figures, Japanese kaiju, and over 1,000 PEZ dispensers. He spends his time thinking about how great it is to be a geek who grew up in the 1970s.

14 thoughts on “Adventures in Atari BASIC: Lesson One – Programmer Kids and Plotting Stars

  1. Wow… you’re taking me way back. I had an 800XL and I programmed the heck out of it. I still remember the line by line method and always having to look for typos. 🙂 Today I’m a STEM teacher in public school and still try to get students excited about coding. Great article! I look forward to the follow ups.

  2. Twenty years on I’ll still sometimes find myself daydreaming about how I would program something in Atari BASIC (getting caught up on weird details like collision detection between a sprite and the background graphics, or how I would work around the color register limitations of Mode 5, etc.). I can still recite certain POKE/PEEK values from memory the way some people quote Bible verses (POKE 752,1: Thou shalt hideth the text-mode cursor)

    • After reading through my old code, I’m having those daydreams too! It’s amazing after so many years I could read an old PEEK statement and realize I was checking for the Start button. I’ll definitely cover Player/Missile collision detection sometime in the future!

  3. So great to see you here again, Mike … and it certainly seems like you’ve been given a lot more leg room to stretch out in. I love this place!

    I actually played your Space Assault game on my own Atari 800XL emulator and, believe me, had my buddy Sid and I met you 30+ years ago, you would’ve totally blown our minds. We were both racking up library copies of Compute! magazine back then and thumbing through them to find the most exciting games to code in on our 800XLs. Boy, what a treat, lol. Unlike you, though, we weren’t adventurous enough to try to develop our own games.

    Anyways, I mentioned this before on 2W2N and perhaps you’d remember—there was one “Lunar lander” type of game from Compute! that used a 3D isometric-view grid and landscape (1-color vector graphics) that was super hard to play…you know I still haven’t found the issue with that game in it. I guess I have to dig deeper.

    I’m totally looking forward to your dissection in the next coming articles. It’ll definitely bring back some bittersweet memories of all that coding we had to do until our eyes burned out of our sockets—and this time, with your explanation(s), it’ll make sense! Thanks for your time and effort!

    • Thanks for the kind words! As part of the series, I’m going to be enhancing Space Assault to make it a better game, so maybe eventually you can “play test” it again! Regarding the game you mentioned, the first thing that comes to mind is Rescue on Fractalus, which had some awesome effects for the time, but that was a commercial game. That Compute! article has to be out there somewhere!

      • lol Rescue on Fractalus!! Lucasfilm Games 1984! That was one of my favorite games to play on the 800XL actually, part of a big bundle of “cracked” games that an older gamer gave me back then. I can still remember that perfect span of silence between the steps up the ladder and finding out whether or not it was an alien boarding the spacecraft! It was totally unnerving—I’d seriously get goosebumps every time.

        Hmm. Looking back…would that silence have housed the RND function which determined whether or not the alien appeared?

        Lol. It’s so funny how clunky those graphics looked compared to the standard hyper-realism present in games today…but the gameplay was awesome!

        As far as Space Assault goes, you’ve got yer Beta Tester right here, so bring it on down! =D

  4. Pingback: Another Blast from the Past | Transformation Through Web Development

  5. Pingback: Adventures in Atari BASIC: Lesson Two – Graph Paper and Pixels | We Are the Mutants

  6. Pingback: Adventures in Atari BASIC: Lesson Three – Enemy Ships and Player/Missile Graphics | We Are the Mutants

  7. Pingback: Adventures in Atari BASIC: Lesson Four – Manipulating Memory and Moving Players | We Are the Mutants

  8. Pingback: Adventures in Atari BASIC: Lesson Seven – Music and Mission Briefings

  9. Pingback: TI-99/4A Computer Books, 1983 – 1987

  10. Pingback: Adventures in Atari BASIC: Lesson Eight – Multiple Graphics Modes and Marquee Text

Please Leave a Responsible Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s