Pandowdy.Cpu 2.0.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Pandowdy.Cpu --version 2.0.0
                    
NuGet\Install-Package Pandowdy.Cpu -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pandowdy.Cpu" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pandowdy.Cpu" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Pandowdy.Cpu" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Pandowdy.Cpu --version 2.0.0
                    
#r "nuget: Pandowdy.Cpu, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Pandowdy.Cpu@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Pandowdy.Cpu&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Pandowdy.Cpu&version=2.0.0
                    
Install as a Cake Tool

Pandowdy.CPU Emulator

A cycle-accurate 6502/65C02 CPU emulator written in C# 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 IPandowdyCpuBus interface for custom memory maps and I/O
  • Pure C# — Single NuGet package with no F# dependencies

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 library (CPU, MicroOps, Pipelines, CpuState, CpuStateBuffer)
Pandowdy.Cpu.Tests/        # xUnit test suite (2,149 tests)
Pandowdy.Cpu.Dormann-Tests/ # Klaus Dormann functional test runner
Pandowdy.Cpu.Harte-SST-Tests/ # Tom Harte SingleStepTests runner

Installation

dotnet add package Pandowdy.Cpu

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

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

v2.0.0: Pure C# implementation. Pandowdy.Cpu.Core has been merged into Pandowdy.Cpu.