A NES (Nintendo Entertainment System) emulator written in Python
Not suitable for speedrunning at this time—please wait for future updates before using PyNES for these purposes.
- No lag frames like on real NES hardware.
- Code run is still very slow.
- Accuracy not 100% yet.
The emulator is still under development, and performance is not yet optimized. Expect some slowdowns, especially on less powerful machines, and file size.
- CPU Emulation: Partial implementation of the 6502 CPU instruction set. (support unofficial opcodes but not complete yet)
- PPU Emulation: Basic PPU functionality for rendering graphics, sprites, and backgrounds. (WIP)
- Input Emulation: Keyboard support. (You need to hold it until frame is rendered, idk why but it work that way)
- Controller Support: Like Input Emulation but with every Joystick/Gamepad support? (using pygame-ce (pygame community edition), but untesting).
- ROM Loading: Supports
.nesROM files. (not txt files, and ram) - Debugging: Basic FPS and CPU register display. (WIP for more advanced debugging tools)
- Discord Rich Presence: Support for displaying current game activity on Discord.
- Mapper Support: support only 3 mappers and 1 buggy mapper.
- Cross-Platform Support: Ensure compatibility across Windows, macOS, and Linux. (WIP, you can test this build now)
- Fun Settings: Various fun settings like color filters and screen effects. (not take effects at accurate, just for fun and cool as same times)
- Shader Mod: Apply GLSL-like visual effects (e.g., scanlines, bloom, monochrome). [You can write your own shaders!]
- TAS (Tool-Assisted Speedruns or Tool-Assisted Superplays): Implement features to support TAS creation and playback.
- Complete PPU Features: Complete implementation of PPU core.
- Complete APU Emulation: Full sound channel support and audio effects.
- Save States: Implement save and load state functionality.
- Advanced Debugging Tools: Add features like breakpoints, memory inspection, and step-by-step execution.
- Performance Optimizations: Further optimize the emulator for speed and efficiency.
- Multiplayer Support: Implement support for multiple controllers for two-player games.
- Documentation: Improve documentation for users and developers.
- New User Interface: Design and implement a modern and intuitive user interface.
- Add extensions components: Move more performance-critical parts to Cython, Rust or C++ for better performance and lower cpu use. (not now)
This emulator is a work in progress. Many features are incomplete or missing, and bugs are likely present.
Some code may be messy or not well-optimized as this is a learning project. Contributions are welcome!
| Status | ID | Name | Notes | Known Issues |
|---|---|---|---|---|
| ✅ | 0 | NROM | Fixed PRG/CHR | — |
| 1 | MMC1 | PRG/CHR bank switching + IRQ | unknown issues | |
| 2 | UxROM | PRG bank switch (8KB @ $E000) | Untested | |
| 3 | CNROM | CHR bank switch (8KB) | Untested | |
| 4 | MMC3 | PRG/CHR bank + scanline IRQ | IRQ |
| OS | Status |
|---|---|
| Windows | Tested |
| macOS | Untested |
| Linux | Untested |
If you want to use a ready-made executable:
- Go to the Actions tab.
- Click the latest Build PyNES Emulator workflow.
- Download the artifact for your OS (Windows recommended).
- Extract and run the
.exe(or binary). - Select a
.nesROM when prompted.
Python **3.13+**Cythongitpipuv(a best tool for managing Python packages, it extremely fast thanpip)C compiler
git clone https://github.com/Paopun20/PyNES.Emulator.git
cd PyNES.Emulatorpython -m venv .venv
# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activatepython setup.py build_ext --inplace# Install dependencies
pip install -r requirements.txt
# or (extremely fast):
uv pip install -r requirements.txtpython app/main.pyTip: You can pass the
--debugflag when runningmain.pyto enable debug logging, but DON'T USE--realdebugFLAG, IT WILL SPAM LOG FILE WITH TOO MUCH DATA.
Advance Tip For Developer: You can pass the--eum_debugafter--debugFLAG to enable eumulator tracelogger to console and run slower in debug mode.
| NES | Keyboard | Xbox | PS4/PS5 | Switch Pro |
|---|---|---|---|---|
| Up | ↑ | D-Pad ↑ | D-Pad ↑ | D-Pad ↑ |
| Down | ↓ | D-Pad ↓ | D-Pad ↓ | D-Pad ↓ |
| Left | ← | D-Pad ← | D-Pad ← | D-Pad ← |
| Right | → | D-Pad → | D-Pad → | D-Pad → |
| A | X |
B |
✕ (Cross) |
B |
| B | Z |
A |
○ (Circle) |
A |
| Select | RShift |
View (#6) |
Share |
− (Minus) |
| Start | Enter |
Menu (#7) |
Options |
+ (Plus) |
| Action | Key | Controller |
|---|---|---|
| Pause | P |
— |
| Toggle Debug Overlay | F5 |
— |
| Cycle Debug Index (↔) | F6/F7 |
— |
| Step 1 CPU Cycle (paused) | F10 |
— |
| Shader Picker | M |
— |
| Reset Console | R |
— |
| Quit | ESC |
— |
| Save Screenshot | F12 |
— |
Note: Some controllers may require additional configuration or drivers to work correctly.
See CONTRIBUTING.md for guidelines.
Found a vulnerability? Please follow our Security Policy.
This project is open-source and licensed under the MIT - see the LICENSE file for details.
You can find easter eggs in the emulator or the source code! Good luck searching! :3