Atari 2600 ROM Cartridge

by 12-chairs in Circuits > Computers

2128 Views, 16 Favorites, 0 Comments

Atari 2600 ROM Cartridge

IMG_2646.jpeg
IMG_2661.jpeg
Screenshot 2024-05-04 at 18.20.10.png
Screenshot 2024-06-29 at 22.42.55.png

Let's build a modern Atari 2600 ROM, physical cartridge, and simple graphics demo!

Oh boy, where to start! First you will probably need to have a strong desire to dive into some retro computer tech. You will likely wish to have the yearning to learn a bit of low-level Assembly code as well. If that doesn't quite suit your fancy, you can still follow along to create a custom Atari 2600 cartridge, using the suggested supplies and code samples. There are many options available online for the 3D-printed cartridge case, the PCB designs, and the process for creating and testing your own code and ROMs. This tutorial is meant solely to demonstrate one approach to creating your own Atari 2600 physical cartridge and program. Also, this is an entry-level project, since I had never worked with the Atari 2600 before. More advanced topics to follow. Best of luck!

Supplies

Code Development Tools

FY1D39OLVJJKS9F copy.jpg

In 2024, you no longer need to have physical Atari 2600 hardware to run your Atari software. You can easily get away with software emulation, in the form of something like Stella - a cross-platform emulator with excellent debugging features to help you study the code of your favorite games. In order to create your own code, you may wish to utilize the assistance of VS Code, and the Atari Dev Studio plugin, to help you write your own programs.

On a MacOS system, we will be installing the necessary software via Homebrew. Once Homebrew is installed, we get our software as such:

brew install --cask visual-studio-code stella
brew install minipro dasm

With VS Code installed, we can also add the Atari Dev Studio plugin from the Extensions Marketplace. Please see screenshot above. Now we should be ready to write and compile some code.

Code

F70VICHLVMXESKA.png

Assembly is not the only option for creating Atari 2600 code, but it is the approach chosen to study and code the Atari 2600 hardware in this tutorial. Do not be discouraged by the low-level programming Assembly instructions, but do keep in mind that the Atari 2600 was very different from modern game consoles in that it required the engineer (programmer) to fully embrace the hardware and its limitations (including the TV display chip, and TV beam timing) in order to create something even remotely entertaining. There were no luxuries of in-built maths coprocessors, nor graphics chips and the advantage of frame buffers. No, you were quite literally programming a chip to show limited colors on a TV screen, one scan line at a time. Additionally, the 2600 was heavily limited by the amount of available RAM (128 bytes). There was the possibility of going beyond the 2K/4K limitation of standard program ROMs via bank-switching, thus allowing for larger program size, but that is beyond the scope of this tutorial. However, I would like to call out this video series, which dives into some very low-level technical considerations, and provides a great explanation of the challenges. Given the hardware limitations, Assembly is the perfect choice for programming the 2600, and very impressive results have been achieved by clever programmers.

All that said, let's give it a shot. As mentioned in the "Supplies" section, we relied heavily on the knowledge and code examples from the accompanying website for one of the programming books. The 8bitworkshop IDE site is an amazing resource to practice your programming in a web environment. Once you are feeling more confident, you can simply copy the code into VS Code and compile it to a .bin file.

Save the code to a .a or .asm file, then press Shift+CMD+P to open the commands menu, and start typing in "ads" to get to the Atari Dev Studio commands to compile your code. If the code formatting looks strange, or the code doesn't compile - make sure that DASM is selected as the assembler in the lower-right section of VS Code.

Testing in Stella Emulator

Screenshot 2024-05-01 at 19.53.44.png
Screenshot 2024-05-01 at 19.53.50.png
Screenshot 2024-05-01 at 19.54.04.png

Stella accepts .bin files to load them into the emulator. There are many amazing features to explore, and we will leave that to the Stella manuals. For now, we just want to make sure that the .bin file is working as expected.

A few useful shortcuts:

  • Exit the loaded program: <ESC>
  • Open the debugger: <`>

ROM

IMG_2650.jpeg
Screenshot 2024-06-29 at 22.42.55.png

We will be using rewritable EPROM chips with binary code from our compiled Assembly programs. Simple enough, right?

Once we have our code, and it has been tested in Stella, we can begin the process of directly writing the binary file to a ROM. When compiled, Assembly, as a generalization, becomes binary code. In a system like the 2600 this binary code is immediately usable by the hardware. The 2600 interacts via cartridges fitted with a ROM, to read the instructions for immediate implementations by the hardware. So, the process here will be to compile our Assembly code to a .bin file, and write that file to the ROM. If all goes well, the program should run upon the insertion of the PCB, and starting of the 2600.

In order to get the .bin file over to a ROM, we will be using open-source ROM programming software, and a ROM programmer. The actual steps are EPROM-specific, but should be similar in nature, should you choose a different EPROM for your project.

In using minipro as our chosen ROM programming software, the command would look something like:

minipro -p "M2732@DIP24" -w test.bin

-p: specifies the type of EPROM chip, in this case a 4KB M2732 with 24 pins

-w: write the specified .bin file to ROM

As a complete novice to EPROM progamming, I ended up creating a GUI for the minipro CLI in order to, hopefully, help others simplify the learning process. Completely optional, but feel free to grab it here.

Note: depending on the EPROM and PCB type, please be mindful of the number of pins on the EPROM, and thus the chosen optional socket

PCB

IMG_2670.jpeg
IMG_2671.jpeg
IMG_2645.jpeg

There are many YouTube videos describing how to use original Atari 2600 game cartridge PCBs to plug in custom ROMs, with a little bit of electronics fiddling of the PCB itself. However, we will take a shortcut and use a modern, EPROM-centric, prefabricated PCB by 8bitclassics.com for this project. This negates the need to add a separate NOR gate chip, and makes everything look much more presentable. If you would like to learn a lot more about building a PCB from scratch, I highly urge you to visit the aforementioned video series by Memelvar.

The PCB we will be using, will house the EPROM chip. For the sake of testing, we will use a chip socket to easily switch out the EPROM chip as needed during testing.

Again, if all goes well, we should see the program run on the 2600 once the PCB is inserted and the system is turned on. If not, we may need to do some troubleshooting.

Case

IMG_2642.jpeg
IMG_2636.jpeg
IMG_2637.jpeg

I used a Prusa MK3S 3D printer with PETG filament, but any 3D printer and filament should be sufficient to print the cartridge case. Strictly speaking, a case is not even needed to test your PCB on physical hardware. I ended up picking this 3D model due it's compact size and good fit of the PCB.

Putting It All Together and Testing

IMG_2643.jpeg
IMG_2659.jpeg
IMG_2660.jpeg
IMG_2673.jpeg

Hardware testing was conducted on an Atari 2600+, which is a modern rendition of the original 2600, plus an HDMI output port. We will be disassembling the 2600+ to take a look at the actual insides, but it is said to support many 2600/7800 cartridges, meaning that it is a strict emulator (based on Stella) of the original hardware. Eventually, real vintage hardware will be used to test. However, the current code does not implement any fancy hacks, so the 2600+ should be perfectly suitable for the propose of this tutorial.

That's it! This is a basic introductory tutorial to creating an Atari 2600 ROM cartridge. I hope to create more advanced versions, with more extensive code examples in the future. Feel free to post any questions in the comments section, and I will do my best to provide any clarification or guidance. Best of luck!