run6502, lib6502 — 6502 microprocessor emulator

run6502 command emulates the execution of a 6502 microprocessor. It creates a memory image from the contents of one or more files on the command line and then simulates a power-on hardware reset to begin execution.

The emulator provides two system models:

Limited interaction with the former is possible; see the manual page for details.

lib6502 is a C library that provides the actual emulation. A program can use it to create and execute any number of 6502 processors simultaneously.

Download the source code: lib6502-1.3.tar.gz
Browse the source code: lib6502-1.3
Read the manual pages: run6502.1.html, lib6502.3.html

lib6502 is distributed under the MIT license: it will not infect your project with a contagious disease the instant you decide to use it.

If you find bugs or have suggestions, please send them to Ian at the domain name of this web site. Thanks!


2013-06-08 (v1.3) Many thanks to Brit Butler for pointing out that PHP should set the B and X bits in the flags byte.

2011-02-14 (v1.2) Many thanks to Lee Davison for suggesting "b" in fopen() mode for portability.

2010-07-23 (v1.1) Many thanks to Steve Flintham for spotting a bug in SBC that set C and V incorrectly.