Atari (Lightgun) Homebrews

Introduction

My first gaming console was an Atari 2600 Junior. Although it is not very powerful, i loved the device. When i became older, it was replaced by an Nintendo Entertainment System, SNES, etc. Decades later, i bought my first modem and entered the internet. I also remembered my old Atari 2600 and looked for emulators. I found Stella and was able to play my favorites old games like Pacman, Moon Patrol, Phoenix, Asteroids, etc.In

Besides playing games, I am an embedded developer and always interested in “new” platforms. Therefore, i searched for Atari 2600 hardware specifications and programming tutorials on the net. I found AtariAge. It is a huge Atari platform containing games and hardware data bases, a forum with developer tutorials, etc. I started here (search for “Atari Programming Workshop Chapter links” if the URL does not work anymore) and wrote some simple Atari 2600 test code. I used the DASM Assembler to create the corresponding binaries because it runs natively on my Linux box. There is also a BASIC compiler but I haven’t tried it (yet). Debugging can be done with the Stella emulator because it provides a game debug mode for game developers.

Breakout

My first project was a breakout clone. The result is shown in the image below. I could not find a breakout game for the Atari 2600 with a round ball (existing games use a cube), so I decided to write my own. Source code and binary (PAL only) can be downloaded here. The player has to beat ten levels using three extra lifes (which can be seen in the upper-left corner). One interesting aspect is the memory limitation of the Atari 2600: The blocks and their color have to fit into 128 bytes of RAM. The game itself is hardcoded PAL-only because I was not aware of best-practices using “#define” switches which allow a developer to create PAL and NTSC versions of his game.


Bobby is Hungry

When Breakout was finished, I wrote a second homebrew game which uses a lightgun. I could not find an original XG-1 for the Atari 2600, so i bought a Sega Master System lightgun. Luckily, they are almost compatible. A simple adapter is still necessary but it is very easy to build one (i plan to blog about my adapter in my nest postings). Basically, it consists of a trigger and a photodiode. When the trigger is pulled, the Atari 2600 displays a white frame on its TV. Each frame is painted line by line, pixel by pixel. Therefore, the device counts in background until the photodiode reports white light. Using this information, an Atari 2600 can calculate the coordinates at which the player points the gun. My game can be seen here:

The game is called “Bobby is hungry” and can be downloaded here. It is about hunting birds and can be played via joystick or lightgun. The player shoots at birds. The crosshair changes its color randomly: Red means you have to shoot at red birds, green means you have to shoot at green birds. After four shots, ammunition is empty and needs to be reloaded. Time is represented by a sinking sun in the background. The game can be build as PAL or NTSC version. I tested it on real hardware too and it is kinda fun. 🙂

Both games were written using 6502 assembler. Feel free to contact me if you have questions or improvements.

You might be interested in …