A NES emulator from scratch in OCaml (and with sound). Still in development (see development status).
Assuming you have opam installed with an existing switch, either:
-
add a pin to this repo:
opam pin add nes-ml https://github.com/Firobe/nes-ml.git -
or clone and run
opam install .
This will fetch the libraries (two of them are unreleased and will need pins), build and install the emulator.
The executable name is nes-ml.
Note: I recommend using a build with flambda activated for more performance.
Use : nes-ml PATH_TO_ROM
See nes-ml --help for a list of useful options
| Function | Keyboard key |
|---|---|
| A button | S |
| B button | D |
| Left arrow | ← |
| Right arrow | → |
| Up arrow | ↑ |
| Down arrow | ↓ |
| Start | ⏎ (return) |
| Select | ⌫ (backspace) |
| Toggle GUI | Escape |
Save state in slot N |
N |
Load state from slot N |
Shift+N |
| Toggle debugging windows | Home |
Note that the N for save states must be 1, 2 or 3.
- Cycle-accurate CPU (see
6502-ml) - Cycle-accurate PPU (graphics) (with rough edges)
- Partially implemented cycle-accurate APU (sound) (with rough edges)
- Multiple save states
- Implemented mappers: 0, 2
- Barebones GUI (with debugging windows showing the internal PPU state)
- Movie (input log) recording and replaying (in custom format with subframe precision)
- Ability to record video (lossless
mp4) of runs with ffmpeg - Headless mode for automatic tests
- Implement mappers 1, 4
- separate CPU library:
6502-ml - fixed-size int literals:
stdint-literals


