# NES emulator built in Odin language documents parallel CPU-PPU timing challenges

> **Key takeaway:** A developer's detailed write-up of building an NES emulator in Odin reveals that cartridge mapper emulation and precise CPU-PPU synchronization consume most of the development effort, not the core processor simulation.

**Published:** 2026-11-16T19:43:57+00:00 
**Source:** Adafruit Electronics 
**Category:** open-hardware 
**Canonical URL:** https://fosswire.org/news/nes-emulator-built-in-odin-language-documents-parallel-cpu-p.html 

## Summary
Developer Lucy has published a comprehensive technical write-up of building a Nintendo Entertainment System emulator in Odin, a C-like systems programming language. The project, which spanned roughly seven months of intermittent work from June 2024 to January 2025, challenges the common assumption that NES emulators are simple weekend projects. While basic functionality like rendering Donkey Kong came together quickly, achieving full compatibility required months of refining the parallel execution model between the 6502-derived CPU and the Picture Processing Unit (PPU), plus emulating the varied mapper hardware found in different cartridges.

The emulator employs a multi-allocator memory strategy in Odin: a per-frame temporary allocator, a global heap, and a session-scoped arena. Save state serialization uses CBOR with custom handling for Odin's raw unions and bit fields. The project source code and additional documentation are available on GitHub, and a demonstration video accompanies the write-up.

## Odin language constraints and NES architecture emulation
- **CPU-PPU parallelism:** The 6502 CPU and PPU execute concurrently and communicate through memory-mapped registers, requiring cycle-accurate timing synchronization to prevent graphical corruption and gameplay misbehavior.
- **Mapper hardware emulation:** Cartridge mappers contain their own memory banking circuitry and behavior variations, making them a significant compatibility hurdle beyond the base console hardware.
- **Memory management strategy:** The emulator uses three distinct allocators—a frame-cleared temporary allocator, a global heap allocator, and a session-scoped arena—to handle Odin's lack of automatic memory management without garbage collection overhead.
- **Save state serialization:** Custom CBOR library integration handles Odin's raw unions and bit fields for save state functionality, requiring bespoke serialization logic for language-specific data structures.
- **Integer semantics:** Odin's absence of automatic integer promotion caused latent bugs during development, representing a language-level pitfall for systems programming projects ported from C conventions.

## Why it matters
This project contributes a documented, open-source reference implementation for NES emulation in a modern systems language, valuable for developers exploring alternatives to C and C++ in emulator development. The detailed timing and mapper analysis also serves as educational material for the open hardware and retrocomputing communities working with or documenting classic console architectures.