binji/smolnes logo

binji/smolnes

Free

NES emulator in <5000 bytes of C

FreeFree tier
Type
Open Source

About binji/smolnes

smolnes is an open-source NES emulator written in C with a code size of approximately 5000 significant bytes. It is designed to be minimal and educational, supporting a subset of popular mappers (0, 1, 2, 3, 4, and 7) to play a variety of NES games. The emulator builds and runs on Linux and macOS using SDL for video output. Its tiny footprint makes it a popular starting point for learning about emulation, code golf, vulnerability research, and porting to other platforms.

Key Features

Ultra-compact code size (~5000 significant bytes of C)
Plays NES games using mapper types 0, 1, 2, 3, 4, and 7
Open source under MIT license
Builds on Linux and macOS with GCC or Clang
Uses SDL for video output
Customizable keyboard key bindings via source code modification
Supports command-line ROM loading

Pros & Cons

Pros
  • Extremely small codebase makes it easy to understand and modify
  • MIT license allows free use, modification, and distribution
  • Supports multiple common mappers for broader game compatibility
  • Customizable controls without recompiling (by editing source)
Cons
  • Limited game compatibility — only mapper 0/1/2/3/4/7 games
  • No audio emulation (video-only output via SDL)
  • Only officially builds on Linux and macOS; Windows not directly supported
  • Requires SDL library for display, adding external dependency
  • No graphical user interface; command-line only

Best For

Playing classic NES games with limited mapper supportLearning about NES hardware emulation and minimal designCode golf and size-constrained programming examplesVulnerability research and reverse engineering (e.g., with Ghidra)Porting emulation to other platforms or languages (e.g., Squirrel for Portal 2)

FAQ

Which NES mappers does smolnes support?
smolnes supports mapper types 0, 1, 2, 3, 4, and 7.
How do I build and run smolnes?
Build with 'make' using gcc or clang on Linux or macOS. Run with './smolnes rom.nes'.
How can I customize the keyboard controls?
Edit line 20 in the source code to change the key mapping table. Use SDL scancode values as ASCII character codes.
Is smolnes free to use?
Yes, it is released under the MIT license, free for any purpose.
Does smolnes support audio?
No, smolnes does not emulate audio; it only provides video output via SDL.