A cycle-accurate NES emulator written from scratch in TypeScript. This project implements the Ricoh 2A03 CPU (MOS 6502 variant) with dynamic instruction emission for JIT optimization, achieving high performance in a browser environment.
- Cycle-accurate CPU emulation (Ricoh 2A03)
- Dynamic instruction emission for V8/JavaScript JIT optimization
- 2C02 PPU (Picture Processing Unit) implementation with sprite rendering and background handling
- APU (Audio Processing Unit) with 2A03's 5 sound channels
- Mapper support (currently NROM, MMC1, limited MMC3)
- Cycle-accurate timing of CPU and PPU
- Hardware register emulation
- Memory mapper implementation
- Simulates raw PPU NTSC output
- Buffered audio generated by changing emulation speed to get smooth audio output
- Controller input handling
- Dual controller support
cd app
deno run devThis is an educational project under active development. While aiming for cycle accuracy, some timing edge cases and mapper implementations are still being refined.
It's fun! But mainly:
- We can run it anywhere in a browser
- The dynamic nature of JS allows us to do crazy things like change the emulation at run-time (instructions, timings, etc)
MIT License - See LICENSE for details
Daniel Pedersen