A 6502 CPU emulator for .NET
.NET cross platform libraries and applications for executing 6502 CPU machine code, and emulating specific computer systems (such as Commodore 64) in different UI contexts. Links below for details on each library/app.
Important
This is mainly a programming exercise, that may or may not turn into something more. See Limitations below.
Blazor WebAssembly app | SilkNet native app | SadConsole native app |
---|---|---|
C64 Basic AI code completion | Run 6502 machine code in your own .NET apps | Machine code monitor |
---|---|---|
Highbyte.DotNet6502
- Core library for executing 6502 machine code, not bound to any specific emulated system/computer, and does not have any UI or I/O code.
Highbyte.DotNet6502.Monitor
- Machine code monitor library used as a base for host apps using the
Highbyte.DotNet6502
library.
- Machine code monitor library used as a base for host apps using the
Highbyte.DotNet6502.Systems
- Library for common interfaces and implementations for running computers ("systems") that uses the
Highbyte.DotNet6502
library.
- Library for common interfaces and implementations for running computers ("systems") that uses the
Contains core system/computer emulation logic, but with no UI or I/O dependencies.
Implements abstractions in Highbyte.DotNet6502.Systems
.
-
Highbyte.DotNet6502.Systems.Commodore64
- Logic for emulating a Commodore 64 (C64).
- Runs C64 ROMs (Kernal, Basic, Chargen).
- List of apps/games listed that's been tested to work here (and how to load them).
-
Highbyte.DotNet6502.Systems.Generic
- Logic for emulating a generic computer based on 6502 CPU.
Implements rendering, input handling, and audio using different technologies per emulated system/computer. Implements abstractions in Highbyte.DotNet6502.Systems
. These libraries are used from relevant UI host apps (see below).
Highbyte.DotNet6502.Impl.AspNet
- System-specific input and audio code for AspNet Blazor
WASM
app.
- System-specific input and audio code for AspNet Blazor
Highbyte.DotNet6502.Impl.NAudio
- System-specific audio code for NAudio for
SilkNetNative
andSadConsole
apps.
- System-specific audio code for NAudio for
Highbyte.DotNet6502.Impl.SadConsole
- System-specific rendering and input code for
SadConsole
app.
- System-specific rendering and input code for
Highbyte.DotNet6502.Impl.SilkNet
- System-specific rendering (OpenGL shaders) and input code for
SilkNetNative
app.
- System-specific rendering (OpenGL shaders) and input code for
Highbyte.DotNet6502.Impl.Skia
- System-specific rendering with SkiaSharp for
SilkNetNative
, and BlazorWASM
apps.
- System-specific rendering with SkiaSharp for
UI host apps for emulating the systems/computers above, using different I/O techniques (rendering, input, audio).
A ASP.NET Blazor
WebAssembly UI.
- Rendering:
Highbyte.DotNet6502.Impl.Skia
- Input:
Highbyte.DotNet6502.Impl.AspNet
- Audio:
Highbyte.DotNet6502.Impl.AspNet
Live version: https://highbyte.se/dotnet-6502/app
A Silk.NET
native UI.
- Rendering:
Highbyte.DotNet6502.Impl.Skia
orHighbyte.DotNet6502.Impl.SilkNet
- Input:
Highbyte.DotNet6502.Impl.SilkNet
- Audio:
Highbyte.DotNet6502.Impl.NAudio
A SadConsole
(a ascii/console/game engine) native UI.
- Rendering:
Highbyte.DotNet6502.Impl.SadConsole
- Input:
Highbyte.DotNet6502.Impl.SadConsole
- Audio:
Highbyte.DotNet6502.Impl.NAudio
A console application with a only UI being a machine code monitor.
- Rendering: standard .NET console
- Input: standard .NET console
- Audio: none
See here
Important
- Correct emulation of all aspects of computers such as Commodore 64 is not likely.
- Not the fastest emulator.
- A real Commodore 64 uses the 6510 CPU and not the 6502 CPU. But for the purpose of this emulator the 6502 CPU works fine as they are generally the same (same instruction set).
- Code coverage is currently limited to the core
Highbyte.DotNet6502
library.
Missing features (but not limited to):
- 6502 CPU
- Support for unofficial opcodes.
- Systems
- Commodore 64: cycle-exact rendering, disk/tape drive support, accurate/stable audio, etc.
See here
See here.
- Kristoffer Strube for the original Blazor WASM async interop code for WebAudio, DOM, and IDL that was the basis for a synchronous implementation in this repo. Copyright notice here.