Teaching an Old Dog New Tricks - A Tale of Two Emulators
summary
Implements the original ZX Spectrum twice: a straightforward C++11 emulator (~3,000 LOC, instruction decoder and codegen) and a modern C++ version that uses constexpr, concepts, templates and a 256-entry compile-time dispatch table to instantiate per-opcode code. The modern build produces much tighter assembly and runs up to ~100× faster at runtime, but moves template work into headers so incremental test turns take ~2–4s on the old style versus ~10–20s with headers/modules. Covers ~700 documented opcodes (≈1,400 opcode sequences), flag quirks, and module/tooling friction.
AI-written summary · about
chapters (13)
- 0:00Childhood emulator project
- 3:37Modern C++ preconceptions
- 14:05Emulating 1,400 Z80 instructions
- 21:12Spectrum emulator demo
- 27:10Modern C++ transition
- 32:22Compile-time instruction dispatch
- 39:06Decoding Z80 instructions
- 42:15Compile-time table solution
- 45:04Modern C++ results
- 47:14Build times vs performance
- 48:17C++20 modules experiment
- 52:47WebAssembly compilation
- 55:15Lessons learned
related talks
01h 21mKeynote: Teaching an Old Dog New Tricks
46mLet's Resurrect the Ordinosaur! 🦖 💻
40mLessons from two decades of writing bad code
01h 03m“The MAME story: From C to Modern C++"
01h 03mApplied Best Practices
37mBehind Enemy Lines - Reverse Engineering C++ in Modern Ages
57mA Tour of Polymorphism Techniques in C++
01h 06m“C++ Metaprogramming: Journey from simple to insanity and back"
