“Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17”
summary
Uses C++17 and Compiler Explorer to compile idiomatic C++ into 386 assembly then translate that into 6510/6502 code with an x86-to-6502 reassembler, building a complete Pong: ball, two paddles, sprites and joystick input. The compiled game is tiny (about 105 bytes), the 6502 output is ~419 instructions (x86 ~231), sprite generation is a 64‑deep constexpr recursion with 505 parameters, and the program runs on a real Commodore 64 via SD2IEC—Pong actually works.
AI-written summary · about
chapters (12)
- 0:00Introduction and goals
- 3:48Hardware and environment
- 9:09Memory-mapped I/O basics
- 13:21Abstractions and performance
- 19:08Working with colors
- 24:14Compile-time optimization
- 30:12Joystick and user input
- 35:30RAII for game logic
- 43:31Sprite management
- 52:58Final game implementation
- 1:01:46Live hardware demonstration
- 1:06:41Summary and Q&A
related talks
19mTales of C, the 6502 and the BBC (with added python)
01h 00mJust Enough Assembly for Compiler Explorer
18mWriting a Game Boy compiler in Forth
45mC++ is a Metacompiler
40mHow to Write a Retro Arcade Emulator
41mEverything you want to know about C/C++ pre-processor but couldn't ask
44mBuild Your Own VM with JIT Compilation for Dummies
38mPersistent Representation of C++ for Fun and Profit
