• Stars
    star
    758
  • Rank 57,535 (Top 2 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An NES emulator written in Rust

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.

More Repositories

1

bytehound

A memory profiler for Linux.
C
3,848
star
2

stdweb

A standard library for the client-side Web
Rust
3,433
star
3

cargo-web

A Cargo subcommand for the client-side Web
Rust
1,095
star
4

not-perf

A sampling CPU profiler for Linux
Rust
849
star
5

speedy

A fast binary serialization framework
Rust
331
star
6

schnellru

A fast and flexible LRU map.
Rust
167
star
7

polkavm

A fast and secure RISC-V based virtual machine
Rust
152
star
8

parcel-plugin-cargo-web

JavaScript
48
star
9

libretro-backend

Libretro API bindings for Rust
Rust
46
star
10

sarek

A work-in-progress, experimental neural network library for Rust
Rust
44
star
11

polkadot-starship

Ruby
23
star
12

polkavm-experiment

An experimental RISC-V recompiler
Rust
18
star
13

hooky

A convenient LD_PRELOAD hooker
Rust
11
star
14

rustc-rv32e

Rust toolchain for RV32E
Shell
8
star
15

libretro-sys

Raw FFI bindings to the libretro API
Rust
6
star
16

static_test

Attribute macro for writing tests which check that a given condition ALWAYS holds true or that a given code path is ALWAYS unreachable
Rust
6
star
17

rwkv_tokenizer

Python
6
star
18

serde-bench

A simple benchmark of various Rust serialization frameworks
Rust
6
star
19

polkadoom

Yet another DOOM port
C++
4
star
20

nsctrld

Nintendo Switch Pro Controller userspace driver
Rust
4
star
21

memory-pool

A global, thread-safe memory pool.
Rust
4
star
22

linux-input

Rust
4
star
23

dspr

A DSP plugin server
C++
3
star
24

unsafe_target_feature

A more convenient `#[target_feature]` replacement
Rust
3
star
25

cargo-shim

A helper library for Cargo subcommands
Rust
2
star
26

mmalloc

A simple mmap-based allocator
Rust
2
star
27

chromium-build

Shell
1
star
28

softfloat

Rust
1
star
29

koute.github.io

JavaScript
1
star
30

linux-elf-loading-bug

Rust
1
star