Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I did the initial work of porting this emulator to the browser (most credit should go to the original emulator author however: http://hampa.ch/pce).

I wrote up the process and hacks that went in to making this possible here: https://jamesfriend.com.au/porting-pce-emulator-browser

The most gross/fun part was how I made the Mac OS mouse position align with your real mouse cursor: by writing its position directly to the emulated computer's memory. Classic Mac OS held the mouse position in a few fixed global memory locations. I realised I could just write to those memory locations every few CPU cycles. I could have instead written a driver which ran inside the emulated OS to communicate with the emulator program, but this was simpler!



Awsome! I need to finish that game of Fool's Errand [1] I started a quarter century ago and doing it on a modern machine seems just wrong.

1. http://www.thefoolandhismoney.com/02-FE/index.htm


That, and 3 in Three, were such unique puzzle games!

EDIT: A sequel came out a mere 25 years later called http://www.thefoolandhismoney.com/06-FM/index.htm


And 3 in Three.


Sadly it's not working for me, seems to be off by half. The emulated mouse is always at x/2 y/2 compared to the real mouse pointer.


I believe Chrome misreports the mouse position if you zoom the page, or if you have a hidpi display. Care to share more details?


This was in Safari on a retina mac book pro


Is this a Retina display issue, perhaps?


Interesting. What browser are you using?


heh. Enterprising pranksters could also rewrite those locations using an init. I believe gravity mouse was the name of it.


Your mouse hack is funny. I take it you don't implement hardware other than the CPU for the emulator?

The norm would be to disable the real mouse cursor (make it invisible) and then feed the guest mouse movement via MMIO and an IRQ. You don't need a driver because classic MacOS already has one for the emulated hardware.


I see that most of the work you did on PCE.js is 3-4 years old at this point.

What happened in the meantime?

Why did you choose PCE over (e.g.) Basilisk II?

How do you provide the Macintosh ROM?


PCE has very simple code, and unlike Basilisk II, doesn't make use of threads (which Emscripten didn't support at the time). Basilisk II also uses a SIGSEGV handler to catch invalid memory accesses, this would have to be coded around. I'd still like to port Basilisk II, which is feasible now due to new browser APIs, but it's a big project.

The Macintosh ROM is up to the website (e.g. archive.org) to provide, along with the disk images.


What about Executor and syn68k from ARDI? It got open sourced. You'd get something like MacOS system 6.0.7 or 7.0.0 running on an emulated 68LC040.

At the very least, that gets you a ROM.


I tried it out on a MacBookPro, and the tap to click function on the trackpad appears to not be working. A physical trackpad click works though.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: