Emulating a 6502 System in JavaScript
summary
A full cycle-accurate emulator of a BBC Micro runs in JavaScript, emulating the 6502 CPU, video chip, timers and interrupts well enough to load and play Elite and decode long-broken protected titles like Alien 8. Implementation uses per-cycle timing, cycle stretching, models undocumented opcodes (store AX), and leverages Visual 6502 die reverse-engineering to find read/write subcycles. Performance wins come from typed arrays, WebGL for output, avoiding huge switchTables, jump tables or binary search for opcodes and loop unrolling so the emulator actually runs.
AI-written summary · about
chapters (28)
- 0:00Intro
- 1:21First made in 1975
- 3:18Other 6502 computers
- 4:23The BBC Micro
- 7:17Getting kids into programming
- 9:03Elite
- 9:52Exile
- 10:05Why JavaScript
- 11:01About the 6502
- 12:52Instructions
- 13:11LoadA
- 14:24XY
- 15:52How to start
- 16:08What it looks like
- 18:10Video Chip
- 20:34Array
- 26:12Fix
- 28:01Debugging
- 30:06Opcodes
- 30:43Visual 6502
- 33:12StoreAx
- 33:31Alienation
- 34:28Protection
- 38:18Example
- 40:28Fixing the code
- 41:04Cycle stretching
- 41:53Performance
- 43:36Conclusion
related talks
29mEmulating With JavaScript
27mWriting an emulator in JavaScript?
32mMaking an Emulator in JavaScript?
18mEmulating the Nintendo Game Boy CPU with Elm
46mEmulating the NES/Famicom/Dendy with Web Technologies
30mControlling the NES with Javascript
24mVirtualization Games in JavaScript, or How I Rewrote an Emulator
45mJavaScript all the things
