6502 Emulator

Summary

This is an emulator core of the MOS 6502 Processor implemented as microcode state machine. Initially, I wanted to use the original microcodes from the actual 6502, and in doing so, I stumbled upon the C74-6502 Project (A modern recreation of the processor) which detailed their own microcodes. This unintentionally turned this project into an emulator for the C74-6502, but I am still happy with the outcome nontheless.

The emulator works well, but it is missing Decimal Mode and proper unit tests for certain scenarios (i.e. branching on page boundaries).

An image of a bash terminal with the outputs of two commands: the test_fibonacci program with the argument 10 and the test_fibonacci program with the argument 31. The first command runs in 341 cycles outputting the number 55. The second command runs in 1034 cycles and outputs the number 221.

This is a sample test program which calculates the nth term in the Fibonacci Sequence. This specific program considers the first 0 in the sequence as term 0, thus term 10 would be 55. The result of the program is pulled directly from the CPU's accumulator.

Source Code