Running .NET on the NES - Jonathan Peppers - NDC Oslo 2024

See how .NET developer Jonathan Peppers pushes the boundaries by running C# code on the original Nintendo Entertainment System (NES) hardware at NDC Oslo 2024.

Key takeaways
  • Project demonstrates running C# code on the Nintendo Entertainment System (NES) through a custom build process that converts .NET IL to 6502 assembly

  • NES technical constraints include:

    • Less than 2MHz processor
    • 52 available colors (25 simultaneously)
    • Maximum cartridge size ~512KB
    • No garbage collection
    • Big endian architecture
  • Implementation approach:

    • Created reference assembly with 44 core methods to match NES-lib C library
    • Uses MSBuild tasks to convert IL to 6502 assembly during build
    • Hooks into standard .NET build process (dotnet build/run)
    • Custom project template for developer experience
  • Current capabilities:

    • Basic Hello World examples working
    • Simple sprite manipulation
    • Color palette changes
    • Limited method/subroutine support
    • No support yet for classes, garbage collection, or complex C# features
  • Development workflow:

    • Write C# code in normal IDE
    • Build converts to NES ROM format
    • Launches in emulator automatically
    • Fast iteration cycle for development
  • Key technologies used:

    • System.Reflection.Metadata for IL parsing
    • MSBuild task APIs for build integration
    • Native AOT concepts similar to iOS/Android
    • 8bitworkshop.com for reference/testing
  • Main educational value in understanding:

    • IL to assembly conversion
    • Build system integration
    • Retro computing history
    • Low-level programming constraints