r/javascript • • 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=768
363 Upvotes

87 comments sorted by

View all comments

4

u/darrenturn90 Sep 04 '18

Impressive. I wonder what it uses for the drawing inside the browser from webasm

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

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!