Famicom / NES emulator written in Go (1.24.3)
Tip
This emulator was created for my own study purposes, and abstraction has been made at the sacrifice of some accuracy or efficiency.
To run this program, execute the following command
cd src && go run .If "autoLoading" option in config.json is true, rom file load from default rom directory automatically.
Otherwise, to launch the game, you'll need to D&D the file into the window after run, or specify the rom file name (relative path from the rom directory) as a startup argument.
Note
By default, the last *.nes file in the rom directory is loaded.
If you use specific Rom file, you can pass Rom path (from default rom directory) first argument.
cd src && go run . example_rom.nescd src && go run . tests/example_rom.nes| Famicom / NES (1P/2P) | 1P | 2P | |
|---|---|---|---|
| Button A | A | K | / (Slash) |
| Button B | B | J | . (Period) |
| Button Up | ↑ | W | G |
| Button Down | ↓ | S | B |
| Button Right | → | D | N |
| Button Left | ← | A | V |
| Button Start | Start | Enter | Enter |
| Button Select | Select | BackSpace | BackSpace |
Note
To change key bindings, edit "key1p/2p" field in config.json
| Key | |
|---|---|
| Exit | ESC |
| Toggle Fullscreen | F12 |
| Show / Hide nametable viewer | F2 |
| Show / Hide CHR ROM viewer | F3 |
| Show / Hide audio visualizer | F4 |
| Expand debug window | - |
| Shrink debug window | + |
| Enable / Disable APU log | F10 |
| Enable / Disable CPU log (very processing intensive) | F11 |
| Reset | Y |
| volume up | ↑ |
| volume down | ↓ |
| Mute / Unmute APU 1ch | 1 |
| Mute / Unmute APU 2ch | 2 |
| Mute / Unmute APU 3ch | 3 |
| Mute / Unmute APU 4ch | 4 |
| Mute / Unmute APU 5ch | 5 |
github.com/veandco/go-sdl2
To run this program, you need to install SDL2 on your computer. (Windows / mac / linux)
The directory structure for this program is as follows:
├──build: build output dir
├──rom
│ ├──saves: savedata dir
│ └── ***.nes: rom data put here
└──src
├──apu
├──bus
├──cartridge
│ └──mappers
├──cpu
├──joypad
├──ppu
├──config: emulator option
└──ui: emulator / option window
Place game ROM data (.nes) under /rom.
Save data for games that support saving will be saved in /rom/saves.
Caution
Using games you do not own or illegally obtained ROMs is prohibited.
This program implements the following components (some of which may not be complete)
- CPU
- official instructions
- unofficial instructions
- nestest.nes: completed
- reset
- PPU
- rough scanline rendering (including scrolling)
- accurate sprite 0 hit
- accurate scanline rendering emulate
- ppu open bus emulate
- APU
- square wave Channel (1 / 2ch)
- triangle wave Channel (3ch)
- noise wave Channel (4ch)
- DMC (5ch)
- expansion audio
- Bus
- JoyPad
- GameController support via SDL2 Gamepad
- 2P joypad emulation
- Joy-Con (R) support
- Nintendo HVC Controller (1/2) support
The following mappers have been implemented
- NROM (mapper 000)
- MMC1: SxROM (mapper 001)
- UxROM (mapper 002)
- CNROM (mapper 003)
- MMC3: TxROM (mapper 004)
See TEST_STATUS.md for the latest detailed test results.
The following games have been confirmed to generally play correctly:
- Super Mario Bros. [HVC-SM] (JPN)
- Super Mario Bros.3 [HVC-UM Revision A] (JPN)
- Hoshi no Kirby: Yume no Izumi no Monogatari [HVC-KI] (JPN)
This is an emulator for the Nintendo Entertainment System (NES) / Family Computer (Famicom).
"NES," "Nintendo," and "Famicom (Family Computer)" are trademarks of Nintendo Co., Ltd.
This project is not authorized, approved, or in any way associated with Nintendo. We respect the intellectual property rights of all content owners.