One Byte at a Time

March 23, 2025
GamingProgramming6502

Working on client projects occasionally means venturing beyond my usual web development and infrastructure domain.

Client: Can you reprogram an Atari 2600 game?
Me: Probably?!

My first Angelfire website (~1998) was dedicated to ROMs— how hard can this really be?

Research

Tools

  • DASM, a macro assembler that works like a compiler for our purposes.
  • Distella, a disassembler that “decompiles” original ROMs for the Atari 2600/7800.
  • Stella is an incredible Emulator with a built-in debugger.
  • SprEd A pixel/sprite editor that exports to various formats, making designing new graphics less tedious.

Hack the Frog

The client wanted to modify the original 1982 Frogger for the Atari 2600. The plan was to change a number of the sprites to spell out H-O-M-E; it will be featured in a performance art piece on an original Atari 2600.

The original ROM is easy to find, but the original source code is likely lost to time. The original code though is likely not too different from the disassembled dump that Distella produced.

## let's disassemble, assemble again and make sure we can still play the game.
$ distella -paf ./Frogger.bin > ./Frogger.asm
$ dasm Frogger.asm -f3 -oFrogger.bin
$ stella ./Frogger.bin

Opening the ASM file is a little daunting at first. Luckily, we weren’t planning on changing any logic in the game, so we’ll ignore those stanzas of code and focus on the sprites. Editing the ASM file is incredibly delicate. I recommend finding a good workflow and doing a few tests.

If like me, you can’t “see” most of the graphics via the ASCII representation. I started with changing one byte every 8 instructions to $FF (11111111 in binary).

This “fuzzing” technique allowed me to identify most of the graphics in the game.

End Result

After a lot of trial and error, we got the result we were looking for:

Hommer

The game is still completely playable and after mucking with a bunch of different hardware options, we were able to get the result loaded onto an original Atari 2600.

Real