FuNes

A NES emulator in Haskell, built to test functional style on a virtual machine

Image 1 of 1: AccuracyCoin test ROM running in the emulator window: 83 of 131 tests passed

A NES emulator written in Haskell on SDL2: NTSC timing, the NROM mapper, audio and keyboard controls, built as an experiment in whether the functional paradigm suits virtual machines, with the CPU, PPU and bus as isolated monadic computations, checked against nestest and AccuracyCoin.

  • 83 / 131AccuracyCoin score

Trade-offs

  • CPU, PPU and bus are isolated, with their computations in monads: testing was a pleasure, and types caught bit-level mistakes with 2-byte addresses and 1-byte data.
  • Beyond that, the functional paradigm brought little over an object-oriented design, though it never got in the way.
  • Accuracy isn't the goal: it is a research emulator with one mapper and imperfect audio, not a daily driver.

Q&A3

Against the nestest ROM and its reference trace; AccuracyCoin then scores broader hardware behaviour.

Reviews

Loading reviews

    More in Haskell

    See all 4 →
    • arbiterPostgreSQL job queue for Haskell, with no broker and no leader
    • VoLCAA Life Cycle Assessment engine in Haskell: LCA databases as queryable answers
    • hideA Haskell IDE in Haskell, in a terminal, a native window or a browser
    • ScrodA fast Haskell documentation generator that parses modules without type checking

    More in Emulators

    See all 6 →
    • RetroTickClassic Windows and DOS programs run in the browser on a TypeScript x86 emulator
    • Anemoia-ESP32NES emulator running at native speed on a plain ESP32
    • GeckoA GameCube and Wii emulator and debugger written in Rust
    • TheseusA compiler that turns DOS and Win32 executables into Rust source
    • Brovanx86_64 emulator for tracing, reversing and sandboxing Windows and Linux binaries
    • nuPSXExperimental PlayStation 1 emulator and debugger written in Zig