perfect6502, a MOS 6502 CPU emulator that performs a simulation of the original NMOS 6502 netlist
Switch branches/tags
Nothing to show
Clone or download
mist64 Merge pull request #5 from drfiemost/master
Avoid memory pollution
Latest commit 224ac90 Jan 22, 2017
Permalink
Failed to load latest commit information.
.gitattributes Introduce end-of-line normalization Sep 18, 2010
.gitignore added object files to .gitignore Nov 28, 2014
Makefile split code into generic netlist simulation and 6502-specific code Dec 1, 2014
Makefile.apple1basic added apple1basic Oct 12, 2010
README.md added README Nov 28, 2014
apple1basic.bin added apple1basic Oct 12, 2010
apple1basic.c ... Oct 20, 2010
cbmbasic.bin cbmbasic does stuff! panics at FF9C (which does not exist!) Sep 22, 2010
cbmbasic.c The state pointer is no longer global, but passed down to every funct… Dec 1, 2014
compare.c cleanup Oct 5, 2010
console.c added KERNAL runtime Sep 22, 2010
console.h added KERNAL runtime Sep 22, 2010
emu.c optimizations (~25%) and cleanup Nov 28, 2014
glue.h added KERNAL runtime Sep 22, 2010
measure.c rename Oct 6, 2010
netlist_6502.h moved nodes names into netlist_6502.h Dec 1, 2014
netlist_sim.c Fix UBSan error Jan 22, 2017
netlist_sim.h split code into generic netlist simulation and 6502-specific code Dec 1, 2014
perfect6502.c moved nodes names into netlist_6502.h Dec 1, 2014
perfect6502.h split code into generic netlist simulation and 6502-specific code Dec 1, 2014
plugin.c added KERNAL runtime Sep 22, 2010
plugin.h added KERNAL runtime Sep 22, 2010
readdir.c added KERNAL runtime Sep 22, 2010
readdir.h added KERNAL runtime Sep 22, 2010
runtime.c fixed line endings Nov 28, 2014
runtime.h debug code; eliminate more duplicate transistors (with c1 and c2 reve… Oct 7, 2010
runtime_init.c The state pointer is no longer global, but passed down to every funct… Dec 1, 2014
runtime_init.h debug code; eliminate more duplicate transistors (with c1 and c2 reve… Oct 7, 2010
stat.h added KERNAL runtime Sep 22, 2010
types.h split code into generic netlist simulation and 6502-specific code Dec 1, 2014

README.md

perfect6502

perfect6502 is a MOS 6502 CPU emulator that performs a simulation of the original NMOS 6502 netlist that was extracted by the visual6502.org project.

Consequently, perfect6502 is

  • perfect: It is not a reimplementation of the 6502, but a simulation of the original transistors. Its complete behavior, its internal state and its outputs are half-cycle exact.
  • slow: Even though perfect6502 is highly optimized C code, achieves only 1/150 of the speed of a 1 MHz 6502 on a high-end CPU of 2014.

perfect6502 is useful for

  • understanding and reverse engineering the 6502
  • debugging 6502 emulators by running them side by side with perfect6502

Usage

As a demonstration and as a performance/regression test, perfect6502 is hooked up to Commodore BASIC (cbmbasic).

You can compile the project with

$ make

and run it with

$ ./cbmbasic

You should get the following output:

	**** COMMODORE 64 BASIC V2 ****

 64K RAM SYSTEM  38911 BASIC BYTES FREE

READY.

Credits

perfect6502 is is written by Michael Steil and derived from the JavaScript visual6502 implementation by Greg James, Brian Silverman and Barry Silverman.

Contributing

Further performance optimizations are gladly accepted.