• facebook
  • twitter
  • linkedin
  • instagram

Atari 2600: Homebrew Programming

by Taylor

11th May, 2015

During the month of January, in the heart of the generally unbearable “Polar Vortex” of early 2014, I spent my days (and a few nights) inside, learning how to program for the Atari 2600. The Atari 2600 was a gaming system released by Atari in September of 1977, 38 years ago, and was one of the first successful mainstream home video consoles.

The Atari 2600 “Light Sixer”

The Atari 2600 (originally known as the Video Computer System) was released as a platform to bring popular arcade games of the time like “Pong” into the homes of consumers. However, it gradually built an iconic set of its own exclusive titles as time progressed.

Some of Atari’s developers were so successful and prolific at releasing original titles for the system that they decided to jump ship and start their own company, Activision. Activision (which is supposedly named so that it was above Atari in the phonebook) was the first independent game development company in the world. Atari initially tried to sue and prevent the selling of their games, but was unable to do so, allowing Activision a long and profitable existence in the game industry that (thankfully) continues today.

Demand for the Atari 2600 grew alongside rising consumer interest in home gaming consoles in general, however the term Atari became synonymous with gaming itself as its product the 2600 (aka Atari VCS) dominated the market.

Eventually the 2600 was replaced by later models, and the company failed to replicate its success it saw with their first mainstream product. The Atari 2600 lives on as one of the most popular gaming systems ever, being inducted into the Toy Hall of Fame in 2007 and having sold a total of 40 million units in its lifetime.

If you are interested in learning more about the Atari 2600, and perhaps programming for it, there are a lot of resources for you.

Atari Age is a great website to get started. They’ve got hundreds if not thousands of ROMs to play with, as well as the most thorough documentation and links for anyone to get involved in programming for the 2600.

Racing The Beam: The Atari Video Computer System (Platform Studies) by Ian Bogost (published: 2009) is a wonderful book, and I highly recommend it if you’d like to know about the history of the Atari 2600, as well as an in depth explanation of its technical design. Bogost does a great job describing the architecture of the 2600 and how that impacted the approach to development. I finished Racing the Beam feeling enlightened with the knowledge of the history of the gaming industry and an in depth understanding of the code, the hardware, and the people that made the Atari 2600 a key part of gaming history.

Fun Fact: The book is called Racing The Beam because programmers literally had to “race the beam” to get their programming logic to update the pixel values before the cathode ray tube (CRT–those old non-flat screens!) beamed electrons across each line in the TV!

Be sure to download and install Stella which is a great emulator for any Atari ROM if you intend to get out their and play some of these classic games (hint: you should). Look below for a .zip to games I’ve personally developed, as well as some information on programming for the 2600. Note that each game was programmed in about a week so they definitely have some bugs.

Today the Atari lives on in the hearts of retro gamers, and a thriving homebrew community. This is where my relationship with the Atari begins.

Prior to programming for the Atari 2600 I had done some assembly language, in your standard run-of-the-mill computer architecture class. I’d like to say it was helpful leading into this project, but besides the overarching concepts of registers and bitshifts, the only time 99% of developers touch assembly language is doing homework for run-of-the-mill computer architecture classes. There are a few perhaps that are optimizing compilers and design new architectures, but those roles are few and far between.

Learning 6502 assembly wasn’t overly difficult, especially considering it’s one of the more primitive instruction sets, but learning it in tandem for the Atari has ingrained knowledge in me that I’ll never forget. There’s something about being totally invested in the work you are doing that causes a learning experience to last a lifetime. Looking back I can recall doing bitshifts and calculation the outcome of the shift in class, but that activity was meaningless at the time. I was doing a math calculation. When doing a bit shift on the Atari, I could see the outcome of the shift displayed on the screen. That allowed for a lot of engagement, especially amongst those learning assembly for the first time, as we could all see what happened if we wrote too many commands into the horizontal blank (the period of time when the CRT beam runs off the screen but before it resets and starts the next line). Our line wouldn’t be updated and you would see something like the following, where Skate Board Steve’s colors aren’t updated:

When programming for 6502 and the Atari in general, developers are intimately tied to the hardware. Here’s a snippet from the start of Super Step Bro’s source code. Note that we define the pattern for the canyon in 1’s and 0’s.

[code lang=”py”]

; Super Step Bros. (The Adventure of Jo & Bo)
; Atari VCS Game
; Created by Taylor White & Daltin Loomis on 2014-01-11.
; Use with joystick controllers
processor 6502
include vcs.h
include macro.h

;***** COLORS
BACKGROUND_COLOR = #$AC ; Used for the background
HOUSE_COLOR = #$DE ; Used for the canyon walls
CANYON_GROUND_COLOR = #$DE ; Used for the bottom of the canyon

CANYON_WALL = #%00110000 ; Playfield pattern for pf0
CANYON_GROUND = #%11111111 ; Playfield pattern for pf1
CANYON_CTLPF = #%00000000 ; Setting the playfield to reflect
;col0 = #%11110000 ; Playfield pattern for pf0
;col1 = #%11000000 ; Playfield pattern for pf0

;***** BALL
PF_BALL_SIZE4 = %00110000 ; BALL SIZE 4
PF_BALL_SIZE2 = %00110000 ; BALL SIZE 4
BALL_ENABLE_MASK = %00000010 ; Ball Enabled
BALL_DISABLE_MASK = %00000000 ; Ball Disabled


Here’s an example of a routine in 6502 assembly:

[code lang=”groovy”]
; Check for changing the jump from up to down or down to stop
lda jump_counter ; load the jump timer
cmp #P0_JUMP_HEIGHT ; compare it to the time we want to be in the air
bne .jumpFlagChange ; if its not equal
lda #2 ; load 2 for jumping down
sta upJump ; store it into upJump flag

Games in .Zip developed by Taylor

  • Super Step Bros (Co-authored by Daltin Loomis)
  • The Adventures of Grumpy Gramps & Skateboard Steve (Co-authored by )
  • Simon Says

Atari 2600 Roms & Source Code

by Taylor