hn.today

A NES emulator written in Odin

lucypero.com124 points52 comments
Screenshot of A NES emulator written in Odin

LucyNES is a solo NES emulator built in Odin between April 2024 and January 2025, when its creator paused development. The project became a hands-on education in console architecture, CPU instructions, timing, bitwise operations, memory management, and emulation. It supports several cartridge mappers - NROM, MMC1, UXROM, CNROM, MMC3, GxROM, and AxROM - and can run Battletoads and hundreds of other games reliably. It also includes a debugger, menus, save states, controller support, a CRT shader option, and partial sound. The developer describes Odin as a strong fit: its simple, C-like style and low-level control suited emulator work, though its lack of automatic integer promotion caused some bugs. Custom serialization and memory allocation were other practical challenges.

The central lesson is that getting a few games to run is relatively quick, but achieving broad compatibility takes far longer. The final stretch depends on reproducing hardware quirks and precise timing, especially the interaction between the CPU and graphics processor. Cartridge mappers add another layer because they contribute circuitry and resources that games rely on; incomplete mapper implementations still prevent some titles from working. Development took seven months, aided by online hardware documentation, test ROMs, and help from the NES development community. The emulator remains unfinished: its sound is unreliable, the DMC audio channel is absent, and some mappers need repair or implementation. These gaps illustrate why emulator development demands careful research and accuracy, not merely a working basic implementation.

Read on lucypero.com52 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

Aristotle Expands into Rust

Aristotle has expanded its formal verification platform to Rust, allowing developers to prove code meets specifications and contains no undefined behavior, including in unsafe blocks. It can also verify that Rust rewrites behave like their original C code, targeting critical software such as smart contracts and infrastructure. (harmonic.fun)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.