r/javascript • u/RevillWeb • Sep 04 '18
Windows 2000 running in the browser using WebAssembly
https://bellard.org/jslinux/vm.html?url=https://bellard.org/jslinux/win2k.cfg&mem=192&graphic=1&w=1024&h=7684
u/darrenturn90 Sep 04 '18
Impressive. I wonder what it uses for the drawing inside the browser from webasm
3
u/RevillWeb Sep 04 '18
I was wondering the same, I don't know enough about WebAssembly yet to figure that out. If anyone knows, please share!
4
u/AegisCZ Sep 04 '18
WebGL. Emscripten translates OpenGL calls to WebGL
8
u/dtfinch Sep 04 '18
It's using a 2D context. It's created in jslinux.js, then in x86emu-wasm.js there's an _fb_refresh() function it exports that reads the frame buffer from the heap and displays it with putImageData().
4
u/darrenturn90 Sep 04 '18
So you can call webgl directly from webasm? Or do you mean it translates to js webgl calls?
3
u/AegisCZ Sep 04 '18
It translates to it. You don't write wasm, you compile LLVM languages
3
u/darrenturn90 Sep 04 '18
But it compiles direct to webasm or needs JavaScript hooks like with current dom manipulation
66
41
61
u/stevep98 Sep 04 '18
Jesus, it runs on my iPhone. Holy cow. Can’t click though.
46
u/z500 Sep 04 '18
I'm on an S9 and I got Firefox running, but just barely. If you had told me 15 years ago when phones were getting tinier and tinier that I would have one that would run Windows off the internet in an emulator in my browser, I don't think I would have believed you.
8
u/Caffeine_Monster Sep 04 '18
got Firefox running
You know what website you have to go to...
6
u/MatrixEchidna Sep 04 '18
WASM wouldn't run in browser available for Windows 2000. /partypooper
..i think
6
u/Caffeine_Monster Sep 04 '18
I believe win 2000 can run all recent firefox releases providing you have all the service patches installed
2
u/z500 Sep 04 '18
Instructions clear. Phone still opened a portal to some eldritch dimension and sucked itself in.
6
u/tinydonuts Sep 04 '18
On my laptop, IE starts in just a few seconds. Over a minute later and Firefox is still starting. Checks out.
6
u/quink Sep 04 '18
Helps that half the login time is spent getting a very pre-WHATWG
mshtml.dllup for the shell.-5
u/istarian Sep 04 '18
Why not? Were you just unaware of the whole emulation scene? People have been progressively emulating older hardware and software for a long time...
6
u/z500 Sep 04 '18
Yeah but at the time I didn't think those dinky little things would eventually become as powerful as a computer.
3
3
u/Sipredion Sep 04 '18
I'm on a Sony Xperia, running it in chrome. Works perfectly for me, I'm clicking through the file explorer now. Takes nearly a minute to respond but god damn it works
3
23
u/fatgirlstakingdumps Sep 04 '18
You guys might enjoy this, if you haven't come across it already - https://github.com/felixrieseberg/windows95
11
u/2epic Sep 04 '18
This is amazing. It ran on my Samsung Galaxy Note 8. I was able to take out the stylus, hover over the screen with it to move the mouse around, and click by tapping the screen. Incredible.
23
u/marocu Sep 04 '18
Wow. Booted up on my S8 and appears to be fully usable. Had no idea web assembly was this powerful.
11
u/delventhalz Sep 04 '18
Web Assembly is super powerful. It's only ~10% slower than native byte code. The shit is bananas.
5
u/AegisCZ Sep 04 '18
You can translate llvm ir to it (C code, Rust etc...). It pretty much can do anything js can
9
u/trakam Sep 04 '18
Apart from have a decent DOM api yet
8
6
u/dont_forget_canada Sep 04 '18
Technically you can pass weapper methods around Dom functionality that you want to your wasm setup function from JavaScript. The thing is, at least how I understand it, calling JS from wasm is quite slow. Not sure if this extends to calling webgl being slow from wasm too.
-2
u/istarian Sep 04 '18
What's powerful is the hardware that you're holding in your hand.
7
u/delventhalz Sep 04 '18
Also Web Assembly.
-4
u/istarian Sep 04 '18
Not sure how you can describe code as powerful honestly. You need the processing power to handle all that in a reasonable amount of time and also execute the code.
5
u/marocu Sep 04 '18
I meant powerful as in very empowering to developers.
-4
u/istarian Sep 04 '18
I wasn't aware developers were short on options. Frankly this whole make web apps instead of desktop one seems lamentable to me.
7
4
u/TheCarnalStatist Sep 04 '18
We should use abaci instead of calculators too
-1
u/istarian Sep 04 '18
Really not the same thing. More like saying saying that some hypothetical remote interface to a calculator is better than having a physical calculator that doesn't need online connectivity.
Also Discord has a web client but that doesn't make it better than a desktop client.
7
u/osoese Sep 04 '18
This is sweet. Putty, and some browsers as installed programs...with outlook.
3
u/dardotardo Sep 04 '18
Were you able to connect to a server with putty?
2
6
5
Sep 04 '18
Is this really web assembly?
I have checked the source code and only found two Javascript files: term.js and jslinux.js. "term.js" I understand is a JavaScript console/terminal and "jslinux.js" is, I presume, a Linux like emulator in JS.
So where does web assembly come in?
3
4
10
Sep 04 '18
Thank god it's W2000 not ME.
16
Sep 04 '18
This is the second ME joke I've seen today, and it's only 8:30am. I feel like I've been transported back in time to the beginning of the millennium.
3
3
Sep 04 '18
Runs smooth AF on iPhone X. Such a shame that the author didn’t give mobile users a way to click.
3
3
3
3
3
Sep 05 '18
Is incredible how google.com works perfectly in that old IE browser. Can't say the same about bing.
2
2
Sep 04 '18
Can it run Chrome and inside Chrome can I load this link? Can it run Chrome and inside Chrome can I load this link?
2
u/ADagen Sep 04 '18
You will need to install the newest Chrome and I'm not sure you can)) By default there is only IE5 and FF12
2
1
1
1
u/dont_forget_canada Sep 04 '18
When you make canvas draw calls (or any js calls) through wasm it's expensive though I thought.
1
1
u/Arkhenstone Sep 04 '18
Just, what can we do with it like that ? There's only web browsers but no connection.
8
Sep 04 '18
Details. This is Fabrice Ballard* here. WebAssembly networking is just a matter of time and interest.
* Developer of QEMU and FFMPEG and more other projects than you can shake a stick at. The man's a better developer and manager of developers than you or I will ever be.
3
u/Arkhenstone Sep 04 '18
Sure I wasn't questioning the talent or what it's for! Just what you can really do with it, I'm pretty sure there is something to try out in there but I felt lost. I know a bit of 98 because I used to play on it, but I was 6 to 8 sooo... And jumped to XP.
3
Sep 04 '18
I'm not sure what you can do with it as it is; my main use for Windows 2000 back in the day was for playing StarCraft.
6
u/trevorsg Ex-GitHub, Microsoft Sep 04 '18
IE worked for me. Just had to click through the setup wizard saying "connect through LAN".
3
3
u/unstablevacuum Sep 04 '18
I'm guessing, but implementing the network layer with WebSockets is probably challenging, but not impossible. Same with audio <-> WebAudio, USB/Bluetooth <-> WebUSB/WebBluetooth, etc.
2
2
u/Arkhenstone Sep 04 '18
Like, I should upload a music and it can read it? Or try to get a stream for IE?
1
u/hixsonj Sep 04 '18
Minesweeper!
8
u/Arkhenstone Sep 04 '18
Minesweeper!
Goddammit ! Humanity is saved, we build a full OS in webassembly just to get the full experience of Minesweeper back in early 2000 !
1
u/identicalBadger Sep 04 '18
Now what is web assembly? Is it running Windows 2000 on a server somewhere? Or is my iPad actually trying to boot up Windows inside of safari?
5
u/MrRare Sep 04 '18
It is actually running / booting locally in safari. Assembly is a really low level way to talk to hardware. So low level that almost all programs that are coded with a programming language that is vaguely understandable for humans are most likely transformed into some kind of assembly specific for a processor architecture. Assembly then tells the hardware what it should do to get the desired results. Honestly im not really sure how this all works but my uneducated guess is that somewhere allong the line this thing is translating the normal assembly stuff done by the windows 95 to something similar within webassembly. On the fly. Correct me if im wrong, im really interested in this and hope to fully understand it someday.
2
u/dtfinch Sep 04 '18
It's literally trying to run on your ipad. It's not running on a server.
In the past there was asm.js, a subset of javascript that could be compiled into efficient assembly code. WebAssembly builds on its success, filling in the feature/performance gaps that can't be expressed well as javascript, and giving it a binary format.
0
u/GBcrazy Sep 04 '18
Jesus, this is incredible. Suddenly I want to learn C++ to build cool things like that.
0
Sep 04 '18
[deleted]
8
u/Mr21_ Sep 04 '18
I like this joke :D
But i tend to be agree with it seriously, maybe with WebAssembly one day facebook etc. will be full in webasm and we'll not be able to inspect anything anymore, at least not with the same facility :(
0
Sep 04 '18
[deleted]
7
6
Sep 04 '18
This has it! I just played for a few minutes and was delighted to find that I'm just as bad as ever.
2
0
Sep 04 '18
[deleted]
2
u/dont_forget_canada Sep 04 '18
It's x86 emation so he is emulating on the hardware and not the software/kernel level.
53
u/xemasiv Sep 04 '18
FUCK YES DUDEEEEEEEEEEE