24 aug 2020 @ justine's web page
Joel Yliluoma wrote this NES emulator back in 2011. It's one of the most beautiful pieces of code I've seen. However it used SDL as the GUI layer. I ported it to run within terminals. This is mostly for novelty value. Simply to show that it's possible. Please note that terminals are currently limited when it comes to sensing keydown and keyup events. We'll need to upstream some patches with PuTTY, gnome-terminal, KiTTY, etc. before we can get perfect gameplay.
Let's put the lo-fi graphical coolness aside for a moment. I actually did make one real improvement to the faithful reproduction of classic games. I noticed that most emulator software converts color wrong. See The Super Marihour Challenge as an example where the sky is purple in the emulator but blue on the CRT. That's because NTSC TVs used Illuminant C whereas most modern PC and HDTV standards use Illuminant D65. The fix is simple. See the source code below.
The .com shell script binary is also a .zip archive bundling games. You can edit its contents by changing the extension from .com to .zip. Playing audio requires apt installing ffmpeg so the ffplay command is available. You can set the FFPLAY environment variable to specify it.
download
nesemu1-1.2.com (548k PE+ELF+MachO+ZIP+SH 2023-08-01)
source code
see also