nepx / halfix

x86 PC emulator that runs both natively and in the browser, via WebAssembly
https://nepx.github.io/halfix-demo/
GNU General Public License v3.0
669 stars 86 forks source link

x86-64 and some upgrade? #29

Open therealbrate opened 3 years ago

therealbrate commented 3 years ago

yeah i know it'll be hard to do, but a 64-bit pentium 4 upgrade would be very nice i think 386/486 emulator is really good for low-end hosts, so you might think about adding it in the browser, nepx :) and about video card, i think i would be great to add a 3dfx voodoo 3 or 5 or cga (low-end) or even nvidia geforce 256 i think ;) also, network and sounds :)

nepx commented 3 years ago

Thanks for the interest!

I've been very busy with work, school, etc. lately, and unfortunately, that means that I have almost no time to spend on this project. Pull requests are always welcome, though I was working on a rewrite before I got overwhelmed with work.

Addressing a few points that you made:

x64 support is doable, but not with the way that the emulator is currently set up. In particular, the following would have to be improved:

It would be easy to modify the decoding tables in src/cpu/decoder.c and add/remove instructions based on the CPU level chosen. Not only would it be simple, it would also have zero runtime cost. For instance, if you chose to emulate a 486, you'd replace all of the SSE instructions with op_exception_ud handlers. It would be difficult to support all the steppings and bugs; for that, I'd advise you to look into PCjs or PCem.

One thing that doesn't need to be changed is speed: the emulator is slow enough that it feels like a real 386 :)

With some time and effort, it would be possible to port over a 3dfx card from another emulator, though I was hoping to add all of the ET4000's SVGA modes first. I'd have to look into documentation and code for that Nvidia card. Hopefully it's simple enough to implement in software. This would not be a trivial project.

There's a stub network card, but it doesn't work, and it needs to be run as root. I was thinking about writing a fully virtual network stack that'd piggyback off of the current host's network stack; this would allow me to run it without root and perhaps even use XMLHttpRequest in the browser...

Timing is terrible enough that sound would probably kill your ears. But once accurate timing is added, SoundBlaster support doesn't seem all that difficult.

I apologize for not having time to work on this project more. I am (was?) working on a Rust rewrite, but any pull requests to the current repo would be appreciated, and I'll be sure to incorporate them into the Rust rewrite.

fuel-pcbox commented 3 years ago

Hi, I've been working on nVidia Riva 128 emulation for 86Box for years now. The Geforce 256 would not be simple in the SLIGHTEST. Even the Riva 128 is ridiculously complex.

nepx commented 10 months ago

Hello all,

I've been working on this for the past several months. x86-64 support has been added to the interpreter, and the emulator can now boot a Linux kernel I compiled with Buildroot. There's some sort of device bug preventing the x64 version of Windows XP from booting that appears unrelated to the CPU.

I'm also adding a dynamic recompiler, which is taking much longer. The challenge is in designing a backend flexible enough to support both native code and WASM emission, and to minimize the amount of redundant host-specific code I need to write.

I got this to run back in July, but since then the dynamic recompiler and school have taken over my life.

Screenshot from 2023-07-02 20-23-50