terminal-nes
v0.1.2
Published
๐ฎ Real NES emulator in your terminal โ jsnes core, pixel-perfect 256ร224 frames via kitty/iTerm2 graphics, keyboard โ NES controller, share-to-X with screenshot.
Downloads
482
Maintainers
Readme
๐ฎ terminal-nes
Real NES emulator in your terminal. A single command starts a genuine NES emulator (jsnes core) streaming pixel-perfect 256ร224 frames into your terminal via kitty/iTerm2/sixel graphics โ no canvas, no browser, no X server.
Comes with a free-to-distribute homebrew ROM (assets/falling.nes, MIT) so it
works out of the box, and supports your own legally-owned ROMs.
Install & run
npm i -g terminal-nes
terminal-nesOr run directly without installing:
npx terminal-nesRequires a graphics-protocol terminal: Kitty, iTerm2, WezTerm, Ghostty or any Sixel terminal. Otherwise a friendly hint is printed.
Controls
Bundled Falling game:
| Key | Action |
| ---------------------- | --------------------------- |
| โ / โ or A / D | Move left/right |
| โ / โ | Select mode before starting |
| Enter | Start |
| P | Open menu |
| Q / Ctrl+C | Quit |
The pause menu provides resume, share, restart, and quit actions. Generic ROMs
still receive the complete NES D-pad plus Z/J = B, X/K = A, Enter = Start,
and Shift = Select.
Play your own (legally owned) ROM
mkdir -p ~/.config/terminal-nes/roms
cp /path/to/your/rom.nes ~/.config/terminal-nes/roms/
VUE_TUI_NES_ROMS_DIR=~/.config/terminal-nes/roms VUE_TUI_NES_RANDOM=1 terminal-nesOr point to a single ROM directly:
VUE_TUI_NES_ROM=/path/to/contra.nes terminal-nesOriginal NES Contra uses Mapper 2, which is fully supported by the bundled jsnes core โ your legal ROM drops right in.
ยฉ Copyright reminder: the package ships no commercial game data. Only run ROMs you legally own (own-cartridge dumps / officially licensed files).
Share to X + leaderboard
Open the menu with P, then press 2:
- Screenshot saved as PNG (
.nes-shares/) - Image copied to the system clipboard (macOS/Linux)
- Browser opens the X composer with a caption pre-filled:
vue-tui repo link +
#vueTui #terminalUI #retroGaming - Local leaderboard tracked at
~/.vue-tui-nes/leaderboard.json
Customize your player name: VUE_TUI_NES_PLAYER=my-name terminal-nes
Graphics quality
- NTSC overscan cropped (real visible 256ร224 picture)
- Automatic integer upscaling (1ร/2ร) when the terminal is large enough โ nearest-neighbour, pixel crisp
- Falls back to exact-fit on small terminals
Scripts (repo)
pnpm run build # tsdown โ dist/cli.js + dist/index.js
pnpm run typecheck
pnpm run smoke # headless emulation + PNG validation
pnpm run check:rom # verify a ROM loads on the bundled core
pnpm run check:input # no-keyup input direction regression
pnpm run check:share # share pipeline (screenshot/caption/leaderboard)
pnpm run check:share-browser # X intent URL + clipboard image (no browser open)
pnpm run pack:local # local tarballHow it works
src/nes-video-game.tsโ jsnes โ overscan crop โ RGBA โ PNG โ TVideosrc/run.tsโ CLI runner: ROM resolution, input mapping, share handlingsrc/share.tsโ screenshot, X post, local leaderboardsrc/png.tsโ pure Node zlib PNG encoder + nearest resizesrc/vendor/jsnes/โ jsnes core (Apache-2.0, see NOTICE)assets/falling.nesโ MIT-licensed homebrew game (LICENSE included)
License
MIT (this package). Vendored code: jsnes (Apache-2.0), Falling (MIT).
