Dreamlayers ported DOSBOX via Emscripten into a browser-functional emulator. He did it all by himself, and he did it very well, all things considered. His name for it is em-dosbox.
I’m just going to lay it out and say that Dreamlayers is a software engineering genius, one of those people with a gift for coding and making things work not just better, but understanding what things have to be left tied down and waiting for later improvements. Most of his em-dosbox notes are where Emscripten falls down as a compiling and conversion platform, with indications of how they can be improved. And buried in the code of his is an alien artifact that makes the generated javascript from the process run extremely fast.
This is quite interesting and makes one wonder if, given the increase in capability of the underlying hardware, one can now view JavaScript as an universal programming language.
If my memory is correct, there was a couple of years ago a 486 emulator written in JavaScript capable enough to run an early version of a Linux distribution.
Anyways, it feels good to be able to play all those old games on any hardware with a JavaScript engine.
I first started programming in JavaScript during the late 90’s and it was horrible. Now it is still horrible but so much more powerful, useful and fast that it is becoming a bigger and bigger part of my work. I was never ready to accept the “browsers are the new operating systems”-mantra, but it seems we have truly come that far. Give people a modern browser and they can use email, play audio and video, do office work, use their files, play games, chat, rdp, video-conference, image-edit, etc etc and now run an emulated OS
Give it a better programming/scripting language, adapted to network and inter process communication, and you’ll get the perfect match.
Erlang ?
I found a demo online of DOSBOX running in the browser:
http://www.smart-page.net/blog/2014/04/22/tyrian-in-your-browser/
It was a Pentium MMC by the way:
http://bellard.org/jslinux/
There are a lot of CPU-emulators for Javascript:
https://github.com/s-macke/jor1k/wiki/Similar-emulators-written-in-J…
Then there is Atwood’s Law:
“any application that can be written in JavaScript, will eventually be written in JavaScript.”
http://blog.codinghorror.com/the-principle-of-least-power/
And Javascript isn’t much slower than native either.
When people emulate a CPU with an emulator that is never going to be close to native speed.
If you have the source, it’s obviously better to compile that code as Javascript:
https://github.com/jashkenas/coffeescript/wiki/list-of-languages-tha…
Javascript with asm.js is for a lot of things at 2 times native speed:
Or even 1.5 native speed:
https://blog.mozilla.org/javascript/2013/11/07/efficient-float32-ari…
And they are working on making it faster:
http://www.infoq.com/presentations/javascript-asmjs
http://kripken.github.io/mloc_emscripten_talk/sloop.html
It’s also funny Javascript can be faster than native code in very limited cases. For example when you port a Javascript benchmark in other languages:
https://blog.mozilla.org/javascript/2013/08/01/staring-at-the-sun-da…
What would happen if you took porting things to Javascript to the extreme ?:
https://www.destroyallsoftware.com/talks/the-birth-and-death-of-java…