Pandowdy.Cpu.Core
1.0.0
This package has been merged into Pandowdy.Cpu 2.0.0
dotnet add package Pandowdy.Cpu.Core --version 1.0.0
NuGet\Install-Package Pandowdy.Cpu.Core -Version 1.0.0
<PackageReference Include="Pandowdy.Cpu.Core" Version="1.0.0" />
<PackageVersion Include="Pandowdy.Cpu.Core" Version="1.0.0" />
<PackageReference Include="Pandowdy.Cpu.Core" />
paket add Pandowdy.Cpu.Core --version 1.0.0
#r "nuget: Pandowdy.Cpu.Core, 1.0.0"
#:package Pandowdy.Cpu.Core@1.0.0
#addin nuget:?package=Pandowdy.Cpu.Core&version=1.0.0
#tool nuget:?package=Pandowdy.Cpu.Core&version=1.0.0
Pandowdy.CPU Emulator
A cycle-accurate 6502/65C02 CPU emulator written in C# and F# for .NET 8.
Features
- Cycle-Accurate Emulation — Micro-op pipeline architecture provides true cycle-level timing
- Stateless Core — CPU execution engine is stateless; all state lives in
CpuStateBuffer, enabling save states, multiple instances, and easy testing - Multiple CPU Variants — NMOS 6502, 65C02, and Rockwell 65C02 with bit manipulation instructions
- Double-Buffered State — Clean instruction boundaries for debugging, single-stepping, and state comparison
- Interrupt Support — IRQ, NMI, and Reset with proper priority handling
- Extensible Bus Interface — Simple
IPandowdyCpuBusinterface for custom memory maps and I/O
Validation
All CPU variants pass Klaus Dormann's 6502/65C02 Functional Tests, a standard test suite for 6502 emulator validation:
| Test | NMOS6502 | NMOS6502_NO_ILLEGAL | WDC65C02 | ROCKWELL65C02 |
|---|---|---|---|---|
| 6502 Functional Test | ✓ | ✓ | ✓ | ✓ |
| 6502 Decimal Test | ✓ | ✓ | ✓ | ✓ |
| 65C02 Extended Opcodes Test | — | — | ✓ | ✓ |
Cycle-Accurate Validation
All CPU variants are cycle-accurate and pass the Tom Harte SingleStepTests, which validate not only final register state but also cycle-by-cycle bus activity for every opcode:
| Variant | Pass Rate | Coverage |
|---|---|---|
| NMOS6502 | 100% (256 opcodes × 10,000 tests each) | All opcodes tested |
| NMOS6502_NO_ILLEGAL | 100% (151 opcodes × 10,000 tests each) | Only documented opcodes tested |
| WDC65C02 | 100% (254 opcodes × 10,000 tests each) | All opcodes except WAI & STP tested |
| ROCKWELL65C02 | 100% (256 opcodes × 10,000 tests each) | All opcodes tested |
See Pandowdy.Cpu.Harte-SST-Tests/README.md for instructions on running these tests.
Supported CPU Variants
| Variant | Description |
|---|---|
NMOS6502 |
Original NMOS 6502 with illegal opcodes |
NMOS6502_NO_ILLEGAL |
NMOS 6502 with undefined opcodes as NOPs |
WDC65C02 |
Later WDC 65C02 (W65C02S) with all CMOS instructions including RMB/SMB/BBR/BBS |
ROCKWELL65C02 |
Rockwell 65C02 (same as WDC but WAI/STP are NOPs) |
Quick Start
using Pandowdy.Cpu;
// Create memory bus and CPU state
var bus = new RamBus();
var cpuBuffer = new CpuStateBuffer();
// Load program and set reset vector
byte[] program = { 0xA9, 0x42, 0x8D, 0x00, 0x02 }; // LDA #$42, STA $0200
bus.LoadProgram(0x0400, program);
bus.SetResetVector(0x0400);
// Reset and execute
Cpu.Reset(cpuBuffer, bus);
int cycles = Cpu.Step(CpuVariant.WDC65C02, cpuBuffer, bus);
Console.WriteLine($"A = ${cpuBuffer.Current.A:X2}"); // A = $42
Project Structure
Pandowdy.Cpu/ # Core types (CpuState, CpuStateBuffer, IPandowdyCpuBus)
Pandowdy.Cpu.Core/ # F# CPU implementation (micro-ops, pipelines)
Pandowdy.Cpu.Tests/ # xUnit test suite
Pandowdy.Cpu.Example/ # Example usage application
Documentation
- CPU Usage Guide — Detailed usage instructions and examples
- API Reference — Complete API documentation for Cpu, CpuState, and CpuStateBuffer
- Building — Build instructions, running tests, and project structure
Quick Build
dotnet build
dotnet test
For detailed build instructions, external test suites, and troubleshooting, see BUILDING.md.
License
Licensed under the Apache License, Version 2.0. See LICENSE for details.
Author
Copyright 2026 Mark D. Long
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- FSharp.Core (>= 10.0.102)
- Pandowdy.Cpu (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|