Hacker Newsnew | comments | show | ask | jobs | submit login
Run Windows 1.01 in your browser (jsmachines.net)
323 points by chl 676 days ago | 85 comments



As there seems to be a lot of interest in emulators in the browser, here's my effort: I ported an emulator for classic Mac and IBM PC to the browser.

Mac System 7 Demo: http://jamesfriend.com.au/pce-js/

Windows 3.0 Demo: http://jamesfriend.com.au/pce-js/ibmpc-win/

IBM PC doesn't have mouse support... Yet. For Mac OS it's writing the mouse position directly into memory, but I've yet to add that hack for Windows.

-----


Wow, awesome! For the Mac one with mouse support, you might want to add ".emscripten { cursor: none; }" to your stylesheet so the host cursor doesn't cover up the emulated one.

-----


Thanks for that, I'd assumed that would run afoul of some kind of click-jacking protection but fortunately it seems I was wrong :)

-----


The Mac is great -- just as I remember it when I was a little kid. Actually, not exactly -- the emulator seems faster than the Mac we had. Also, I tried to get it to crash but wasn't able to.

-----


> The Mac is great -- just as I remember it when I was a little kid. Actually, not exactly -- the emulator seems faster than the Mac we had. Also, I tried to get it to crash but wasn't able to.

You really shouldn't see a crash on a fresh install of the operating system. A lot of crashes on Mac OS Classic were caused by software that hooked itself deeply into the system and corrupted state. Not so different from Windows, actually ...

As software became ever more complex in the 9.x era, Option-OpenApple-Reset became as familiar as Ctrl-Alt-Delete.

-----


Cooperative multitasking and a lack of protected memory does not really lead to a robust system.

-----


Pretty cool, any chance they might end up on Github?

-----


Yeah, I'll put it up on GitHub once I've had time to clean up the build process to separate the new code from the dependencies (which I've had to hack extensively). In the meantime here's a dump of the source: http://jamesfriend.com.au/pce-js/pcejs20131028.zip

-----


Awesome, can play gorillas in qbasic :D

-----


I am really enjoying a lot of the retro things being posted recently. Sadly, they miss out some of the details. Like Elite being playable at 4 MHz, but really hard at 25 MHz, because that's how clocks worked then, and that's what the turbo button did. (It was a de-turbo button, turning your machine into a slow machine for compatibility. If it was connected, that is.)

And this makes me wonder about the Wayback machine. I can retrieve an old web page, but can I recreate the experience of posting to that site? Is anyone archiving the various social network sites code, so that the Future People can recreate the experience of Friendster or Facebook or Myspace? Or are the Future People going to have to guess by looking at screenshots and videos?

One of the first (perhaps the first?) commercial games for Windows was "Balance of Power". I think it either came with a weird runtime version of Win 1.0, or a voucher to get it, for people running dos.

http://theodor.lauppert.ws/games/bop.htm

-----


it came with an embedded windows runtime - I think it was Microsoft not sure quite yet how they'd license it.

-----


> it came with an embedded windows runtime - I think it was Microsoft not sure quite yet how they'd license it.

The Windows port of Microsoft Excel also initially came bundled with a Windows runtime. It wasn't really until Windows 3.0 that you could start take Windows as a prereq. Before then, very few systems had Windows installed.

Wait a minute. "Windows Runtime" has a different meaning nowadays. Microsoft is really reusing a lot of its existing trademarks for Windows 8, isn't it? "Surface" was also a trademark that they already owned, for a giant touchscreen table.

-----


>><machine id="ibm5160" class="pcjs" border="1" width="980px" pos="center" style="background-color:#FAEBD7">

Tag of the future

-----


Indeed.

What I might coin the "cloud tag".

-----


Every time I see an emulator like this on HN, my mind is blown.

Can someone explain to me and any other run-of-the-mill hackers reading this, how an emulator like this is made?

I wouldn't even know where to start.

-----


Seems like they're usually based on hardware emulators like qemu, bochs or similar which are compiled to javascript using tools like emscripten. IO hardware needs to be emulated in JS, a framebuffer is drawn to a canvas, mouse input events are translated to the native hardware events, I'm sure there's a million details.

-----


First you need to port x86(or any other) instruction set. This can also be done by compiling (part of)Bochs/PCE using emscripten. Then you need to port IO (floppy,HD etc.). Then monitor and graphics card. And if you really want to be cool there are hosts of other things to port like touchscreen, networking, USB etc.

-----


js is turing complete. In theory you should be able to write an emulator for an OS using js your browser runs. Turns out people are doing this.

From there its just the everday craziness of emulation. Emulating the instruction set, the IO devices, etc.

-----


The same way as any other emulator. Programs for any computer are just a sequence of bytes - i.e. just another file format. So you write something that interpret that file format. It's not fundamentally any different from writing, say, a PDF viewer.

-----


Run-of-the-mill hackers should know this.

You pick a sufficiently low-level abstraction layer and implement it in Javascript. Everything above that layer 'just works'TM.

-----


It's like drawing. http://i.imgur.com/RadSf.jpg

-----


Hahaha, precisely. Or drawing turtles!

-----


Drawing turtles? http://en.wikipedia.org/wiki/Turtle_graphics

-----


> Run-of-the-mill hackers should know this.

Do you really need to put the guy down for honestly admitting ignorance and trying to learn?

Anyway, "hacking" and computer science in general is diverse enough now that I wouldn't expect even an expert in any particular subfield to necessarily know anything about another. It's quite possible to be, say, an experienced database guru with a solid working knowledge of raytracing, network administration, and Unicode, without ever having touched anything related to emulators.

-----


I wasn't putting him down. Just noting that his use of the word 'hacker' is not correct. There's a minimum bar to clear to call one's self a hacker and understanding how to substitute part of a software stack with another one is above that bar (in my opinion).

See: http://www.paulgraham.com/gba.html

-----


Hmm.

What I'm about to say probably sounds a lot like something that somebody who lacks impressive technical prowess (like myself, self-admittedly) would say, but I think that being a "hacker" is almost more of a mindset. Or, alternatively, there is a hacker mindset, and a lot of the folks here can identify with, and exhibit, that mindset. Specifically, the hacker mindset means that you're always curious, always learning, always improving, just like the poster who asked the question above.

-----


I was referring to the term hacker in the 'good programmer' sense (as mentioned in the PG essay I linked to). Being a good programmer pre-supposes being a programmer (and good programmers should definitely have an idea how emulators are written, IMO).

-----


It seems to me that tying "hacker" status to any one specific skill or bit of knowledge is antithetical to the whole concept.

-----


I was referring to the term 'hacker' in the 'good programmer' sense as mentioned by Paul Graham in the link I posted. Obviously, to be a good programmer one must first be a programmer.

-----


Played Reversi in Windows 1.01. Still lost. I will go hang my head in shame now.

-----


The key to Reversi is to win the corners (EDIT: you can lose while still winning 2-3 corners, but losing the corners gives the opponent a much greater chance to take large chunks of the edges and then purse to turn whole rows). To win the corners, you must avoid the spots 1 out from the corners. To avoid being forced to take the spots 1 out from the corners, one strategy is to avoid the edges as long as possible, and then try to only take edge pieces with at least one gap to the corners, and one gap to the opponent.

You also want to keep your options open, to prevent being forced into taking the wrong piece near the edge or corners.

A simple strategy that works against this version relatively often is to at the start look for positions that will take some of the opponents pieces while ideally increasing your possible moves, while being as far from the edges as possible. Then when you are forced to put a piece near the edges, put it near the centre of an edge (as far from corners as possible).

By then the options will be so constrained you can start looking a at consequences of each option, with the goal being to avoid putting pieces near the corners.

I'm not a particularly good player, and I got 3 out of 4 corners on my first attempt by just relatively haphazardly following the above, which means the default settings and/or overall strength of this version is pretty weak.

-----


> I'm not a particularly good player, and I got 3 out of 4 corners on my first attempt by just relatively haphazardly following the above, which means the default settings and/or overall strength of this version is pretty weak.

It defaults to Beginner. Use the "Skill" menu to change it to Master. It'll be much more challenging, and the AI will take a lot longer to calculate its move.

(Remember: This is Windows 1.01, so you have to hold down the mouse button to use pull-down menus.)

-----


Came here to admit the same failing. I can't believe even Windows 1.01 can beat me at Reversi.

-----


If it makes you two feel any better - I've never beaten the BBC Basic port of Reversi - let alone any later implementations.

-----


Me too. :^(

-----


won by 24 :-D

-----


The first time I ran this something went wrong I somehow didn't manage to even boot in to windows but found myself at the command line, with only the DOS floppy disks available.

The true Windows 1.01 experience.

-----


  C:
  CD windows
  win

-----


I love that windows 1.x had a tiling window manager. I think it's kind of a shame that mode died for so long.

-----


Back in Windows 8. And improved in Windows 8.1.

EMACS, of course, never lost it.

-----


I only wish it was a bit more flexible in W8 :(

-----


The overlapping technology wasn't there. Tiling wasn't a 'feature' ;)

-----


From what I've heard, the overlapping technology was there as proven by its use in drop-down menus; the designers of the first version of Windows just thought tiling was a better way to go.

-----


Even better, Zork: http://jsmachines.net/disks/pc/games/infocom/zork1/

And it appears to save your state between runs, which is nice.

-----


So that's:

1. Zork

2. running in the Infocom Virtual Machine

3. running in an IBM PC emulator

4. running in Javascript

6. running in x86 machine code

and x86 maintains backwards compatibility with that original IBM PC through

7. hardware instruction set translation

It's nice to know all those transistors aren't sitting idle.

-----


For fewer layers (and faster playing) you can use Parchment: http://iplayif.com/?story=http://www.batmantis.com/zorks/zor...

Though the status line doesn't work... I should fix that.

And if you like Zork, try these modern classics:

Lost pig: http://iplayif.com/?story=http://mirror.ifarchive.org/if-arc...

Spider and Web: http://iplayif.com/?story=http://mirror.ifarchive.org/if-arc...

-----


Great. I like those interactive fiction and will play Lost pig :) What is missing is some sort of save game option via web storage. And maybe you should give some example links on the first page. bookmarked

-----


All these features, and Reversi! http://www.youtube.com/watch?v=tGvHNNOLnCk

-----


After Bellard's JSLinux, it was just about time till more OS will be ported to JS.

http://bellard.org/jslinux/

-----


After PCjs and Bellard's, try Virtual x86, which can emulate FreeDOS, OpenBSD, and KolibriOS.

http://copy.sh/v24/

As a hack, all of these JavaScript emulators are awesome to play with. But in reality if you need performance for something in the past decade, like a N64 or newer arcade emulators, JS is still orders of magnitude slower than dynarec emulators written in C. I hope something like PNaCl will come along to bridge the performance gap.

-----


Here is an incomplete list of web emulators

http://archive.vg/blog/12-feature/114-a-big-list-of-browser-...

-----


N64 might work. With WebGL support of course. And I hope too for a really new standard for web programming. Java was the answer for some time, then Flash, now Javascript. The big companies should sit together and agree on one standard with typed variables. The JIT compilers of Javascript will reach there limits sooner or later.

-----


So I worked on a defuct N64 emulator, TRwin, back around 2000. Thirteen years later and thanks to the power of the modern web, my PC that's literally orders of magnitude faster runs the best JS emulator like a slide show. Using native code, my celeron400 with a Voodo card could run it full speed.

JavaScript is a toy language. But I do agree that strong typing and restrictions on GC like asm.js would help the situation. Unfortunately we can't rely on the standards bodies to make good decisions. Static typing was supposed to be in ECMAScript 4 back in 2008, but they abandoned it back in 2007.

It's still painfully clear to me the we are going backwards with all of these bloated poorly designed layers in HTML5 and I have little faith in the standards bodies.

http://hulkholden.github.io/n64js/

-----


This an insanely great emulation. Including the loading times.

-----


the mouse tracking is fucked. it leaves the windows if i go to try and click the top right corner

-----


It'd be nice if they implemented Pointer Lock: https://developer.mozilla.org/en-US/docs/WebAPI/Pointer_Lock

-----


Yeah I had the same, I figured out it was more the acceleration that was the problem rather than the cursor movement itself...moving slower than usual meant I could use it without problems.

-----


about as good as vmware :)

-----


I had the same problem in chrome on Mac, but it works fine on firefox.

-----


As someone who really enjoys the history of computing, this is awesome! I don't think I've ever had a chance to play with Win 1 and probably wouldn't have gone through the trouble of getting it running myself. This and others like it would be neat for the Computer History Museum to have on its site.

-----


I can't seem to successfully reset the calculator after a divide by zero.

It's funny how when I closed Windows and ended on the DOS prompt I mindlessly typed "win" & enter. Some habits never die I guess.

-----


"C" key works for me as expected, where is problem?

-----


Yes it does, for some reasons I'm an idiot that was using buttons on the left and didn't see the C.

-----


Windows 1.01 feels much closer to Mac Classic than Windows 3.1 does. (Button appearance, close button on left, menus must be held down to stay open, "Get Info" instead of "Properties".)

-----


It's really mind blowing how it's written entirely in javascript

-----


Wow, it had been a long time since I'd played DONKEY.BAS. http://jsmachines.net/demos/pc/donkey/

-----


Bill Gates and Neil Konzen wrote DONKEY.BAS. His name doesn't show up in the program listing, though, even on PC-DOS 1.0. :-(

-----


Interesting to see Helvetica ("Helv") in Windows 1.0 Write. According to a quick Wikipedia, Arial was only introduced with TrueType in Windows 3.x.

-----


It's actually MS Sans Serif not even trying to hide the fact it's a ripoff. It's still in Windows 7 (don't know about 8), along with a TrueType version. Major differences between MS Sans Serif and Helvetica are the uppercase R and G. The overall typeface has a little more vertical stress. It's a way better ripoff than Arial; it's a shame Arial became so ubiquitous in that capacity.

-----


I tried to unmaximize a window by dragging the title bar like in Windows 7 or GNOME 3. I have no idea why I expected that to work.

-----


Were you confused by the dead mouse scroll wheel, too? Or was that just me?

-----


I still suck at Reversi. :(

-----


There is some issue with the mouse. When I click on terminal.exe and try to click on "File", the mouse is coming out of the emulator. You would probably want to create an interface like a VM, where the mouse comes out of the emulator only when you press some combination of keys.

-----


That'll probably impossible in the browser due to security reasons: otherwise misuse could trap the user on a website

-----


Nice, this one runs on an iPad mini! Not much slower than on a computer.

-----


Unbelievable... I never knew how Windows looked before 3.0 - thanks!

-----


I wonder what the license it. The guy from copy.sh promised to make it open source, but didn't yet. Can I hope?

-----


Yep, still as slow and glitchy as I remember it :)

This trend of retro computing is a wonderful trend.

-----


Glad it boots to desktop, not metro.

-----


the left top menu looks like bootstrap collapse :-). Nostalgia for sure..good work

-----


i am not sure but i am not able to do it.

-----


where is qbasic?

-----


In the MS-DOS Executive, click the A-Drive, and the double-click on BASICA.EXE (Basic Advanced).

QBasic didn't come until MS-DOS 5, the demo uses MS-DOS 2.

-----


> QBasic didn't come until MS-DOS 5, the demo uses MS-DOS 2.

Actually, the demo is PC-DOS 2.0, not MS-DOS 2.0. Notice the disk that's in the emulator's drive. Also, IBM replaced all of Microsoft's copyright notices:

  The IBM Personal Computer DOS
  Version 2.00 (C)Copyright IBM Corp 1981, 1982 1983
If they're using real disk images, then they must have an actual IBM ROM BASIC in the emulator. PC-DOS BASIC(A) would only run on a true-blue IBM machine, because it called into the ROM BASIC. In contrast, MS-DOS BASIC(A) was implemented entirely in software and would run on any clone.

-----


Check out the windows 3.0 demo in the first comment. Qbasic is the first thing I found there. Had so much fun w/ qbasic, writing polysonic songs for the little pc speaker, hacking up GORILLAS.BAS, which WORKS!!!!

-----




Applications are open for YC Winter 2016

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: