Butterfly is an experiment in hardware and software design that aims to emulate a 6502-based computer system, similar in nature to systems like the Apple II and the Commodore 64. It is written in C# and is cross-platform.
Butterfly aims to be as extensible and customizable as possible, so that it can be modified to emulate real 6502-based computer systems.
The CPU (Sharp6502/CPU.cs) aims to be as accurate as possible, with complete cycle-accuracy being a future goal. It intends to support multiple variants of the 6502, including the original NMOS 6502 (complete with ROR bugs!), the CMOS 65C02 and the Ricoh 2A03 (found in the NES).
The Instruction Set aims to be extensible as well, allowing for the implementation of unofficial instructions, or even custom variants of the 6502 that don't have real hardware versions.
The Instruction Executor contains the actual code for all supported instructions. These methods are called using reflection, to make extending the CPU Easy and Fun(tm). The addressing modes are implemented in a similar way.
The Sharp6502 library included with Butterfly uses a flat 64KB memory buffer, with support for hooking reads and writes at various addresses. This is useful for implementing other devices that need to read/write in the 6502s 16-bit address space. See Sharp6502/Memory.cs for more details on how that works.
Run dotnet publish
from the root repository directory to build the Butterfly emulator and supporting libraries. Terminal.Gui and Raylib-CsLo provide the libraries used for the Monitor interface as well as (eventual) video output.
Enter the ButterflyCS directory and run dotnet run .
, this will start the monitor and the GUI.
Your contributions are welcome. Please feel free to fork this project and submit pull requests.
TODO: Write documentation.