An NES emulator written in Rust
Go to file
2023-11-27 23:30:02 +09:00
emumisc Add workspace and #[no_std] support 2023-03-12 01:21:05 +09:00
mos6502 Support non-nightly no_std builds 2023-10-20 15:12:47 +09:00
nes Generate the palette lookup table at compile time 2023-11-27 23:30:02 +09:00
nes-testsuite Enable holy_diver_batman/M1_P128K_C128K_W8K test ROM. 2016-11-01 14:46:48 +01:00
pinky-devui Support playing back recordings in the devui 2023-09-30 20:12:00 +09:00
pinky-libretro Add workspace and #[no_std] support 2023-03-12 01:21:05 +09:00
pinky-web Add workspace and #[no_std] support 2023-03-12 01:21:05 +09:00
rp2c02-testsuite Update phantom2c02 2023-09-30 18:18:37 +09:00
.gitignore Add workspace and #[no_std] support 2023-03-12 01:21:05 +09:00
.gitmodules Add a new PPU testsuite based on a transistor level simulation of RP2C02. 2016-10-30 00:16:54 +02:00
.travis.yml Add a missing '..' in .travis.yml. 2016-11-01 16:53:50 +01:00
Cargo.toml Add workspace and #[no_std] support 2023-03-12 01:21:05 +09:00
LICENSE-APACHE.txt Initial commit 2016-10-23 19:50:32 +02:00
LICENSE-MIT.txt Initial commit 2016-10-23 19:50:32 +02:00
README.md Update README 2018-11-24 23:29:48 +01:00

Build Status

Pinky

Pinky is an NES emulator written in Rust completely from scratch based only on publicly available documentation.

You can run it in your Web browser!

Features

  • Accurate-ish (cycle accurate) 6502, PPU and APU emulation.
  • A testsuite based on test ROMs.
  • A PPU testsuite automatically generated from a transistor-level simulation of a real PPU.
  • Supports NROM (0), MMC1 (1), UxROM (2), AxROM (7) and UNROM 512 (30) mappers.
  • Can be compiled as a libretro core.
  • Can be compiled into WebAssembly.

There are still many things missing, including:

  • Most unofficial 6502 instructions.
  • Support for other mappers.
  • Accurate PPU sprite overflow.
  • Savestate support.
  • PAL support.

Currently this is not a production quality emulator, though whatever games it can play (due to limited mapper support) it can play quite well (e.g. such games as Super Mario Brothers, Donkey Kong or Tetris; you can check out nesmapper.txt which will tell you which game use which mapper).

Getting started

Internally this project is split into multiple crates.

The pinky-libretro contains the libretro core of this emulator, which is the intended way to run it. It should be compatible with any libretro frontend, but it was only tested with RetroArch.

To compile the libretro core go into the pinky-libretro directory and type:

cargo build

This should build a shared object in target/debug called libpinky_libretro.so (on non-Linux systems the extension might be different, e.g. on Windows it'll be a .dll) which then you can use with RetroArch like this:

retroarch -L libpinky_libretro.so your_rom.nes

You can also run cargo build --release to build a significantly better optimized version (the debug build should run full speed on modern systems though).

There's also a simple standalone SDL2-based frontend in the pinky-devui directory; running it is just a matter of passing it a path to your game ROM on the command line.

The nes-testsuite contains an emulator agnostic testsuite of NES roms, which could be easily hooked to any other emulator simply by implementing a single trait (see nes/src/testsuite.rs).

The rp2c02-testsuite contains a PPU testsuite which is autogenerated with the help of Visual2C02, which is a transistor-level simulator of an actual NES PPU.

The nes contains the emulator itself. mos6502 has the 6502 interpreter, which could be useful for emulating other 6502-based machines.

There are already hundreds of NES emulators out there; why another?

Because why not? Writing a game console emulator is one of the most fun and rewarding projects out there, and nothing can compare with the feeling of beating one of your favorite games on an emulator you've wrote yourself.

The choice of NES is also an obvious one - it's the least time consuming console to emulate simply due to the fact that it's extremely well documented.