$ Go-6502 Emulator
A cycle-accurate emulator for the MOS6502 and WDC65C02 8-bit microprocessors, written in Go. This project provides high-fidelity emulation of two classic 8-bit processors that powered many iconic computers and gaming systems.
install
go get github.com/andrewthecodertx/go-6502-emulator ### features
- - Cycle-accurate execution — Faithfully reproduces timing behavior including page-crossing penalties
- - Complete instruction set — All 56 documented MOS6502 instructions plus 27 additional WDC65C02 instructions
- - All addressing modes — 13 addressing modes for 6502, plus 2 new modes for 65C02
- - Hardware quirks — Implements the JMP indirect page boundary bug on MOS6502 (fixed in 65C02)
- - Interrupt support — NMI, IRQ, and RESET vectors with proper handling
- - Flexible bus interface — Pluggable memory system supporting RAM, ROM, and memory-mapped I/O
### usage
The emulator is designed to be embedded in your own projects. Add the module to your project and use either the MOS6502 or WDC65C02 CPU implementations.
- Implement the
Businterface for your memory system - Instantiate your preferred CPU variant (
mos6502.NewCPU()orwdc65c02.NewCPU()) - Load machine code and call
Step()orRun()to execute
### project structure
pkg/core/ — Shared components (BaseCPU, Bus interface, addressing modes) pkg/mos6502/ — NMOS 6502 CPU implementation pkg/wdc65c02/ — WDC 65C02 CPU implementation docs/ — Documentation ### testing
go test ./... — Run all tests go test -v ./... — Run with verbose output go test -cover ./... — Run with coverage ### learn more
Full documentation, examples, and detailed instructions are available in the README.