Atari 2600 Assembly · the code
Every program in the book
202 sources and 204 programs, in folders named exactly as the book names them. Free to use in your own work, commercial or not, under the MIT licence.
Assemble and run a chapter
You need DASM (assembler) and Stella (emulator and debugger). Open a terminal in the folder and type:
cd ch34
dasm score.asm -f3 -oscore.bin
stella score.binCheck everything
From the top folder of the full download, this assembles every source again and compares the result with the reference bytes:
python3 verify.py- Every source says its own assemble line in the comment at the top. -f3 is the format the 2600 wants, a flat image with nothing else in the file.
- A chapter folder is self-contained. It has its sources, its binaries, the headers those sources include and, where the chapter measured something, the measurements as plain text.
- Most folders also have a make_cartridges.py, the program that wrote the sources in that folder. Its comments explain the reasoning behind the chapter's cartridges in more detail than the printed page has room for.
- Chapters 4, 6 and 7 have no folder of their own. Chapter 4 sets up the toolchain on ch01/skyline.asm, and chapters 6 and 7 work on ch05/rainbow.asm.
Chapter by chapter
| Ch. | Title | Folder | Download |
|---|---|---|---|
| Part I · Before the first byte | |||
| 1 | The machine with no screen | ch01/ | ch01.zip 3 KB |
| 2 | Numbers a computer understands | ch02/ | ch02.zip 3 KB |
| 3 | Inside the console | ch03/ | ch03.zip 3 KB |
| 4 | Setting up the development environment | — | |
| 5 | Your first cartridge | ch05/ | ch05.zip 3 KB |
| 6 | The Stella debugger | — | |
| Part II · The language of the 6507 | |||
| 7 | Registers, memory, and the shape of an instruction | — | |
| 8 | Moving data | ch08/ | ch08.zip 3 KB |
| 9 | Arithmetic | ch09/ | ch09.zip 3 KB |
| 10 | Logic and bits | ch10/ | ch10.zip 5 KB |
| 11 | Making decisions | ch11/ | ch11.zip 3 KB |
| 12 | Subroutines and the stack | ch12/ | ch12.zip 3 KB |
| 13 | Tables, indexes, and pointers | ch13/ | ch13.zip 4 KB |
| 14 | Counting cycles | ch14/ | ch14.zip 4 KB |
| 15 | Working with DASM | ch15/ | ch15.zip 4 KB |
| Part III · Racing the beam | |||
| 16 | How a television frame is built | ch16/ | ch16.zip 6 KB |
| 17 | The frame skeleton | ch17/ | ch17.zip 5 KB |
| 18 | Colour | ch18/ | ch18.zip 5 KB |
| 19 | The playfield | ch19/ | ch19.zip 6 KB |
| 20 | Asymmetric playfields | ch20/ | ch20.zip 15 KB |
| 21 | Players | ch21/ | ch21.zip 14 KB |
| 22 | Horizontal positioning | ch22/ | ch22.zip 13 KB |
| 23 | A positioning routine you can trust | ch23/ | ch23.zip 15 KB |
| 24 | NUSIZ: copies and sizes | ch24/ | ch24.zip 9 KB |
| 25 | Missiles and the ball | ch25/ | ch25.zip 16 KB |
| 26 | Collisions: the CX registers and hit logic that holds up | ch26/ | ch26.zip 20 KB |
| 27 | The two-line kernel and sprite animation | ch27/ | ch27.zip 17 KB |
| 28 | Multicoloured sprites, object reuse, flicker, and priority | ch28/ | ch28.zip 13 KB |
| Part IV · Making it a game machine | |||
| 29 | The RIOT timers: the professional vertical blank | ch29/ | ch29.zip 12 KB |
| 30 | Reading the world: joysticks, buttons, paddles, and switches | ch30/ | ch30.zip 12 KB |
| 31 | Sound: the two channels of the TIA | ch31/ | ch31.zip 14 KB |
| 32 | One hundred and twenty-eight bytes: RAM discipline and variable layout | ch32/ | ch32.zip 10 KB |
| 33 | An engine for sound effects and music | ch33/ | ch33.zip 17 KB |
| 34 | The score kernel: six digits, BCD, and pointer tables | ch34/ | ch34.zip 21 KB |
| 35 | Random numbers and the linear-feedback shift register | ch35/ | ch35.zip 15 KB |
| 36 | Game states: title screen, play, pause, and game over | ch36/ | ch36.zip 14 KB |
| Part V · Two complete games | |||
| 37 | Klakwall: paddle, ball, an advancing wall, and the physics of a bounce | ch37/ | ch37.zip 23 KB |
| 38 | Tunnelkin I: rooms, map data, and a kernel that scrolls | ch38/ | ch38.zip 22 KB |
| 39 | Tunnelkin II: a map in RAM, a digger, and a kernel with a sprite in it | ch39/ | ch39.zip 29 KB |
| 40 | Where to go next: three games, costed before they are written | ch40/ | ch40.zip 13 KB |
| Part VI · Beyond four kilobytes | |||
| 41 | Bank switching: F8, F6, and the Superchip | ch41/ | ch41.zip 14 KB |
| 42 | PAL, PAL-60, and SECAM: converting your game | ch42/ | ch42.zip 14 KB |
| 43 | Optimisation: cycles, bytes, and the tricks that buy both | ch43/ | ch43.zip 11 KB |
| 44 | Testing on real hardware: flash carts, real consoles, real televisions | ch44/ | ch44.zip 16 KB |
| 45 | Releasing your game: ROM, cartridge, manual, and the homebrew scene | ch45/ | ch45.zip 11 KB |
| Part VII · Four things that are left in it | |||
| 46 | Fitting it in: compressing data for a four-kilobyte cartridge | ch46/ | ch46.zip 32 KB |
| 47 | The forty-eight pixel display: title screens, logos, and big text | ch47/ | ch47.zip 37 KB |
| 48 | Making things behave: state machines, tables, and cheap pursuit | ch48/ | ch48.zip 16 KB |
| 49 | Difficulty, balance, and the attract loop | ch49/ | ch49.zip 18 KB |
| Everything else in the repository | |||
| appendices | appendices/ | appendices.zip 14 KB | |
| tools | tools/ | tools.zip 14 KB | |
Packed on 2026-10-08 from the repository. Every zip contains the licence.