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.bin

Check 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.TitleFolderDownload
Part I · Before the first byte
1The machine with no screench01/ch01.zip 3 KB
2Numbers a computer understandsch02/ch02.zip 3 KB
3Inside the consolech03/ch03.zip 3 KB
4Setting up the development environment—
5Your first cartridgech05/ch05.zip 3 KB
6The Stella debugger—
Part II · The language of the 6507
7Registers, memory, and the shape of an instruction—
8Moving datach08/ch08.zip 3 KB
9Arithmeticch09/ch09.zip 3 KB
10Logic and bitsch10/ch10.zip 5 KB
11Making decisionsch11/ch11.zip 3 KB
12Subroutines and the stackch12/ch12.zip 3 KB
13Tables, indexes, and pointersch13/ch13.zip 4 KB
14Counting cyclesch14/ch14.zip 4 KB
15Working with DASMch15/ch15.zip 4 KB
Part III · Racing the beam
16How a television frame is builtch16/ch16.zip 6 KB
17The frame skeletonch17/ch17.zip 5 KB
18Colourch18/ch18.zip 5 KB
19The playfieldch19/ch19.zip 6 KB
20Asymmetric playfieldsch20/ch20.zip 15 KB
21Playersch21/ch21.zip 14 KB
22Horizontal positioningch22/ch22.zip 13 KB
23A positioning routine you can trustch23/ch23.zip 15 KB
24NUSIZ: copies and sizesch24/ch24.zip 9 KB
25Missiles and the ballch25/ch25.zip 16 KB
26Collisions: the CX registers and hit logic that holds upch26/ch26.zip 20 KB
27The two-line kernel and sprite animationch27/ch27.zip 17 KB
28Multicoloured sprites, object reuse, flicker, and prioritych28/ch28.zip 13 KB
Part IV · Making it a game machine
29The RIOT timers: the professional vertical blankch29/ch29.zip 12 KB
30Reading the world: joysticks, buttons, paddles, and switchesch30/ch30.zip 12 KB
31Sound: the two channels of the TIAch31/ch31.zip 14 KB
32One hundred and twenty-eight bytes: RAM discipline and variable layoutch32/ch32.zip 10 KB
33An engine for sound effects and musicch33/ch33.zip 17 KB
34The score kernel: six digits, BCD, and pointer tablesch34/ch34.zip 21 KB
35Random numbers and the linear-feedback shift registerch35/ch35.zip 15 KB
36Game states: title screen, play, pause, and game overch36/ch36.zip 14 KB
Part V · Two complete games
37Klakwall: paddle, ball, an advancing wall, and the physics of a bouncech37/ch37.zip 23 KB
38Tunnelkin I: rooms, map data, and a kernel that scrollsch38/ch38.zip 22 KB
39Tunnelkin II: a map in RAM, a digger, and a kernel with a sprite in itch39/ch39.zip 29 KB
40Where to go next: three games, costed before they are writtench40/ch40.zip 13 KB
Part VI · Beyond four kilobytes
41Bank switching: F8, F6, and the Superchipch41/ch41.zip 14 KB
42PAL, PAL-60, and SECAM: converting your gamech42/ch42.zip 14 KB
43Optimisation: cycles, bytes, and the tricks that buy bothch43/ch43.zip 11 KB
44Testing on real hardware: flash carts, real consoles, real televisionsch44/ch44.zip 16 KB
45Releasing your game: ROM, cartridge, manual, and the homebrew scenech45/ch45.zip 11 KB
Part VII · Four things that are left in it
46Fitting it in: compressing data for a four-kilobyte cartridgech46/ch46.zip 32 KB
47The forty-eight pixel display: title screens, logos, and big textch47/ch47.zip 37 KB
48Making things behave: state machines, tables, and cheap pursuitch48/ch48.zip 16 KB
49Difficulty, balance, and the attract loopch49/ch49.zip 18 KB
Everything else in the repository
appendicesappendices/appendices.zip 14 KB
toolstools/tools.zip 14 KB

Packed on 2026-10-08 from the repository. Every zip contains the licence.