Emulators written in JavaScript

A list of emulators written in the JavaScript programming language.

This list started as a compilation of JavaScript emulators posted to Echo JS over the years. If you know about any missing emulators, please consider adding them to the collection : the source for this page is available on GitHub. Thank you in advance.

Lastly, if you are into JavaScript, you might enjoy Echo JS.

Amstrad

  • CPCBox - Amstrad CPC emulator in JavaScript
  • Roland - An Amstrad CPC emulator written in JavaScript

Apple

  • Apple IIjs - An Apple ][ Emulator in JavaScript
  • a2 - A fast, WebGL optimized Apple ][+ emulator.
  • Apple2JS - A JavaScript emulator for the Apple II

Atari

  • EstyJS - A pretty fast and functional JavaScript Atari ST emulator (Source)
  • jsA8E - JavaScript version of the A8E Atari 800 XL Emulator

Commodore

DEC

Nintendo

  • 1964js - JavaScript port of the 1964 N64 emulator for Windows
  • CycloaJS - JavaScript NES Emulator (Source)
  • GBA.js - Game Boy Advance in the Browser
    (Source)
  • GameBoy Online - JavaScript GameBoy Color emulator (Source)
  • IodineGBA - A GameBoy Advance emulator written entirely in JavaScript (Source)
  • JS-VBA-M - JavaScript port of VisualBoyAdvance-M, a Game Boy Color / Advance emulator
  • JSNES - A JavaScript NES emulator (Source)
  • Nezulator - A NES emulator in JavaScript
  • XNES - Experimental JavaScript Super Nintendo emulators (Source)
  • fam - JavaScript NES emulator (Source)
  • jsGB - A GameBoy emulator in JavaScript (Source)
  • mupen64plus - A port of the popular Nintendo 64 emulator for the Web (Source)
  • n64js - An N64 emulator in JavaScript (Source)

PC Emulators

  • JS/Linux - JavaScript PC emulator
  • JsDOSBox - JavaScript PC DOS emulator (Source)
  • PCjs - IBM PC Model 5150 emulator
  • Virtual x86 - An x86 emulator written in JavaScript (Source)
  • jemul8 - An object-oriented JavaScript x86 emulator for Node.js and the Browser (Source)
  • jsbochs - Bochs PC emulator for the Browser (Source)

Sega

Sinclair

Tandy

Multi-system Emulators

  • JSMESS - The JavaScript MESS (Multi Emulator Super System) (Source)
  • PCE - PC emulators in JavaScript (Atari ST, IBM PC 5150, Macintosh, RC759 Piccoline)
  • RetroArch - JavaScript port of RetroArch (bundles Gambatte (Gameboy), Genesis Plus GX, Handy (Lynx), Snes9x Next, VBA Next (GameBoy Advance), Tyrquake and FinalBurn Alpha)

Miscellaneous

DNS-OARC Spring 2014 Workshop

Last week, I had the chance to attend the DNS-OARC Spring 2014 Workshop which was held on May 10-11th 2014 in Warsaw (Poland). Given the fact I’m living only 300 km away from Warsaw, there was no way I could miss such an opportunity to enjoy a full weekend entirely focused on DNS.

The event was packed with high-quality presentations, friendly people, and the organization was impeccable. I also had the opportunity to meet and discuss DNS topics with Anand Buddhdev from the RIPE NCC and Stephane Bortzmeyer from AFNIC. If you guys read this, it was nice meeting you :)

So thanks to DNS-OARC for organizing such a great event. I’m definitely hoping to be able to attend the Spring 2015 edition in Amsterdam.

Presentations and Videos are available on DNS-OARC site.

Log rotation directly within Nginx configuration file

Ever since I discovered PostgreSQL allowed to embed variables in log_filename allowing to split logs without using logrotate or cronolog, I’ve been wanting to do the same with Nginx.

As it turns out, it’s not only possible but also pretty easy to achieve, since Nginx introduced the possibility to use variables in access_log directives (added in 0.7.4), and the $time_iso8601 variable providing time in ISO 8601 format (added in 0.9.6).

Here is an example showing $time_iso8601 format :

2014-05-04T18:12:02+02:00

All there is to do is use an “if” block to split required data using a regular expression and set time variables.

For splitting logs by day, one would use the following snippet :

if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})") {
    set $year $1;
    set $month $2;
    set $day $3;
}

access_log /var/log/nginx/$year-$month-$day-access.log;

Alternatively, we can also use the Perl compatible syntax for named regular expression capture :

if ($time_iso8601 ~ "^(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})") {}

access_log /var/log/nginx/$year-$month-$day-access.log;

To also create variables for hours, minutes and seconds, we can use the following snippet :

if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})")
{
    set $year $1;
    set $month $2;
    set $day $3;
    set $hour $4;
    set $minutes $5;
    set $seconds $6;
}

Lastly, and I cannot stress it enough, please make sure Nginx has proper permissions to access and write in the log directory.

This method is currently used in production on a busy Nginx server and has been running flawlessly for almost a month now. The only drawback is that buffered writes do not work when the access_log file path contain variables, so it isn’t possible to gzip logs on the fly.

Visualizing progression of file operations using pv (Pipe Viewer)

Compressing large files from command line can be time consuming, and unless using a file manager like Midnight Commander, there is usually no way to know in advance how long the operation is going to last.

Enter pv (Pipe Viewer), a neat CLI tool allowing to monitor the progress of data through a pipeline, by displaying a progress bar and indicating both processing speed and estimated time until completion.

Here are a few examples showing how to use the tool :

Compressing using gzip :

pv access.log | gzip > access.log.gz
 482MB 0:00:26 [18.3MB/s] [==================================>] 100%

Compressing using bzip2 :

pv access.log | bzip2 > access.log.bz2
 482MB 0:04:45 [1.69MB/s] [==================================>] 100%

Decompressing a gzip archive :

pv access.log.gz | gunzip > access.log
48.5MB 0:00:08 [5.85MB/s] [==================================>] 100%

Decompressing a bzip2 archive :

pv access.log.bz2 | bunzip2 > access.log
25.2MB 0:00:42 [ 607kB/s] [==================================>] 100%

One-liner to compress the current directory :

tar cpf - . | pv -s $(du -sb . | cut -f1) | gzip > archive.tar.gz
1.48GB 0:01:33 [16.3MB/s] [==================================>] 100%

This one is a little more complicated and requires an explanation : as pv cannot know in advance the amount of data to be transferred, we have to specify it beforehand using the du command.

There is so much more pv can do, for example limiting the transfer rate of a pipe (using the -L output modifier). Together with the -q display switch (which turns the progress bar off), it can be used to render text animations.

Playing a VT100 animation at 9600 bytes per second (a spinning and moving globe) :

curl -s http://artscene.textfiles.com/vt100/movglobe.vt | pv -q -L 9600

dnc : a CLI tool to check domain names configuration and statistics

For a long time, I needed a simple and minimalistic tool showing a quick overview of my domain names configuration and statistics. I originally planned to implement it as a shellscript, but Node makes it so easy to write efficient CLI tools and distribute them via npm so it made more sense to go this way. The tool performs asynchronous DNS requests and as a bonus, displays a nice colored Unicode table, thanks to the great cli-tables module.

Here is the output of running dnc with two domains in the configuration file :

dnc showing a report for two domains

To install, simply invoke :

npm install -g dnc

Source code and documentation are on GitHub : https://github.com/fcambus/dnc