nepx / halfix Goto Github PK
View Code? Open in Web Editor NEWx86 PC emulator that runs both natively and in the browser, via WebAssembly
Home Page: https://nepx.github.io/halfix-demo/
License: GNU General Public License v3.0
x86 PC emulator that runs both natively and in the browser, via WebAssembly
Home Page: https://nepx.github.io/halfix-demo/
License: GNU General Public License v3.0
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 :)
Hi,
I'm quite impressed with what you've done with this project. But I ran into a problem, as I wanted to have a play with the "native" version (on a Linux system). I initially failed to get the '-c' option to work for me.
First up, I believe that the "long" options typically work with a double dash (e.g. '--help'), and the "short" alias with a single dash (e.g. '-h'), which is not what the help text actually shows. This might be addressed via a small change to 'src/main.c':
@@ -51 +51 @@ static void generic_help(const struct op
- int linelength = sprintf(line, " -%s", o->name);
+ int linelength = sprintf(line, " --%s", o->name);
@@ -53 +53 @@ static void generic_help(const struct op
- linelength += sprintf(line + linelength, " --%s", o->alias);
+ linelength += sprintf(line + linelength, " -%s", o->alias);
Secondly, the "custom config file" parameter does not get parsed correctly, which I managed to solve for myself (in the same source file) via:
@@ -88 +88 @@ int main(int argc, char** argv)
- if (!(data = argv[i++])) {
+ if (!(data = argv[++i])) {
Cheers,
Martin
how do i fix it
The commit eb89fba uses net.h but missing.
Hi there,
Awesome project!
Is there a way for JS to interact with the emulator via stdin, stdout, or stderr?
I'd like to write to stdin and read stdout via JS.
Thanks!
Mike
We’d love to provide commercial support for this project especially if we can get inbound/outbound networking working as well as being able to get docker working inside a lightweight host distribution like Alpine Linux.
Sorry to open an issue over this, but I couldn’t find your contact information anywhere. Please shoot me an email at matthew at clutch dot io if you are interested. Either way, this is such a cool project that opens up many great possibilities!
It would be nice to have some instruction regression tests to be sure that the implementation would be consistent with real x86.
I get an error when I try to run Windows XP on the browser when I increase the ram.
Is there any way to make ram reach 1GB for example?
Thanks in advance, this is an amazing project
I not found any info about it in readme so asking, i tried via mingw but just get lot of errors
UPD: Ok i need disable -Werror
Unexpected identifier 'makefile'
Even though real operating systems will initialize FPU during their boot process (by issuing finit
instruction), it would be more convenient for libcpu user if the FPU was already initialized.
remy@DESKTOP-O6A3FTL:/mnt/c/Users/Matt/halfix$ node makefile.js emscripten release
[
'-lSDL',
'-lSDLmain',
'-lm',
'-lz',
'-s',
'NO_FILESYSTEM=1',
'-s',
'TOTAL_MEMORY=256MB',
'',
'-s',
'WASM=0'
]
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/pc.c -c -o build/objs/94-pc-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/util.c -c -o build/objs/94-util-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/state.c -c -o build/objs/94-state-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/io.c -c -o build/objs/94-io-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/display.c -c -o build/objs/94-display-1b228.o -Iincludeemcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/drive.c -c -o build/objs/94-drive-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/emscripten/emscripten.c -c -o build/objs/14h-emscripten-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/ini.c -c -o build/objs/94-ini-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/host/net-none.c -c -o build/objs/mt-net-none-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/access.c -c -o build/objs/jj-access-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/trace.c -c -o build/objs/jj-trace-1b228.o -Iincludeemcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/seg.c -c -o build/objs/jj-seg-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/cpu.c -c -o build/objs/jj-cpu-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/mmu.c -c -o build/objs/jj-mmu-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/ops/ctrlflow.c -c -o build/objs/u8-ctrlflow-1b228.o -Iinclude
src/emscripten/emscripten.c:29:5: error: expected expression
EM_ASM_({
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/smc.c -c -o build/objs/jj-smc-1b228.o -Iinclude
^
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/decoder.c -c -o build/objs/jj-decoder-1b228.o -Iinclude
/usr/share/emscripten/system/include/emscripten/emscripten.h:97:71:emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/eflags.c -c -o build/objs/jj-eflags-1b228.o -Iinclude
noteemcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/prot.c -c -o build/objs/jj-prot-1b228.o -Iinclude
: expanded emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/opcodes.c -c -o build/objs/jj-opcodes-1b228.o -Iinclude
from macro 'EM_ASM_'
#define EM_ASM_(code, ...) emscripten_asm_const_int(#code, __VA_ARGS__)
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/ops/arith.c -c -o build/objs/u8-arith-1b228.o -Iinclude
^
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/ops/io.c -c -o build/objs/u8-io-1b228.o -Iinclude
1 error generatedemcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/ops/string.c -c -o build/objs/u8-string-1b228.o -Iinclude
.
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/ops/stack.c -c -o build/objs/u8-stack-1b228.o -Iinclude
ERROR root: compiler frontend failed to generate LLVM bitcode, halting
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/ops/misc.c -c -o build/objs/u8-misc-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/ops/bit.c -c -o build/objs/u8-bit-1b228.o -Iincludeemcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/softfloat.c -c -o build/objs/jj-softfloat-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/fpu.c -c -o build/objs/jj-fpu-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/cpu/ops/simd.c -c -o build/objs/u8-simd-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/hardware/dma.c -c -o build/objs/xx-dma-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/hardware/cmos.c -c -o build/objs/xx-cmos-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/hardware/pit.c -c -o build/objs/xx-pit-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/hardware/pic.c -c -o build/objs/xx-pic-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/hardware/kbd.c -c -o build/objs/xx-kbd-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/hardware/vga.c -c -o build/objs/xx-vga-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/hardware/ide.c -c -o build/objs/xx-ide-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/hardware/pci.c -c -o build/objs/xx-pci-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/hardware/apic.c -c -o build/objs/xx-apic-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/hardware/ioapic.c -c -o build/objs/xx-ioapic-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/hardware/fdc.c -c -o build/objs/xx-fdc-1b228.o -Iinclude
emcc -Wall -Wextra -Werror -std=gnu99 -DEMSCRIPTEN_BUILD -O3 src/hardware/acpi.c -c -o build/objs/xx-acpi-1b228.o -Iinclude
Failed to compile: src/emscripten/emscripten.c
40/41 compiled successfully!
src/emscripten/emscripten.c
Any help would be greatly appreciated. Anything as simple as "it's on my end" or "it's on your end"
Thanks
Hi there
Looks emscripten_load_state
referenced in libhalfix.js
is missing in emscripten.c ?
hi id like to use this on my xbox one but i can't compile it for uwp
The following snippet
stc
mov $0x00, %al
rcr $0x20, %al
sets al
to 0x8
, while 0
is expected, as x86 masks the shift count with 0x1f
before the rotate.
Firstly, thanks for creating this project. I'm impressed with the compatibility so far, especially with OS/2 working out of the box - this seems to be quite a feet!
Just a note that https://github.com/nepx/halfix/wiki/Disk-Images#modifying-disk-images is out of date
To enable write, set the ALLOW_READWRITE macro in src/drive.c to 1. This will allow changes to all disk images to be written back to the disk.
TODO: make this a run-time option.
Should be:
To enable write, set
writeback=1
in your configuration. This will allow changes to all disk images to be written back to the disk.
Thanks again!
I'm getting error below when trying to build. I'm using a fresh installed node.js (12.9.0) and EMSDK on Ubuntu 20.04 AMD64. Seems to be a syntax error in emulator-files.json. I've created PR: #13
Running:
node makefile.js emscripten
Yields:
undefined:389
}
^
SyntaxError: Unexpected token } in JSON at position 9852
at JSON.parse (<anonymous>)
at load_json (/home/martin/halfix/makefile.js:21:17)
at Object.<anonymous> (/home/martin/halfix/makefile.js:27:16)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Function.executeUserEntryPoint [as runMain] (intern
Can you add networking support? I need to access the Internet from the VM.
Wanted to try the emscripten build of halfix.
Looks like there's a file that's missing from git:
<script src="lib/drive-filereader.js"></script>
The file is not in the repo, I assume its also where dynCall_vii
would be implemented, as it ends up being undefined.
Great job on this project, it's nice to see another x86 emulator which can target the web. It's written very nicely too, so props to you!
I think it would be great to see a dedicated website for this so that people can easily try it out. I guess some more work might need to be done on save states?
On Halfix for Windows:
In Browser, before loading screen VM resets:
On Windows works with .img/splitted image.
In browser in Safe Mode not works
happy new year!
the in browser emu
tested: nt, react
has no text-input stream
aka
i can not aplay any text, like the login
but mouse works fine
used now opera on Android 10
I'm not sure what does ifdef with a BIG_ENDIAN
does. Is it an attemt to support arbitrary endianness hosts? Well, if it is, then it does not work. Even if standard C had something like that, at my perfectly little endian x86_64 system it is defined somewhere in depths of glibc...
Windows 8 doesn't boot. It BSODs (or rather GSODs -- gray screen of death) right after the Windows logo disappears.
It's because of a Kernel Data Inpage Error
, which, according to this source indicates that Windows 8 couldn't read from the pagefile.
I think it's a hardware issue, specifically pertaining to how hard disk information is read/written. It's not a IDE DMA issue -- I created a Windows 8 disk image that uses the READ
/WRITE MULTIPLE
command, and it still BSODs this way.
Multi-sector reads/writes to the disk image haven't been extensively tested. I think there's a subtle bug where cross-block writes don't work properly. The only operating system that uses them is OS/2 (which works fine).
It's possible that the BSOD is due to a cross-block bug. Windows XP had trouble booting in the Emscripten version because single sector reads at the end of the block were corrupting the next one. OS/2 sometimes has trouble booting on my Android phone because of multi-block reads.
More investigation is required.
This is more a question / inquiry about using halfix.
I've just released an updated version of https://oldweb.today (https://github.com/oldweb-today/oldweb-today), which runs several browsers in JS-based emulators to run old browsers, connected to web archives.
The system connects to a custom network stack, also running in the browser.
Currently, I'm using v86 and basilisk emulators, and it would be neat to also add halfix, eventually.
I'd in trying out Halfix, if it can support more recent browsers, especially ones that can run Flash, probably a later version of Firefox. So far, I haven't been able to get it to load a Win98 image, though it did load WinXP.
To make this performant, would also need to have save state / load state working..
I'm curious what combinations of browsers have been tested and do work well..
Hi!
First of all, thank you for really amazing project!
Trying to boot TinyCore Linux 11 (http://tinycorelinux.net/) in browser (WASM)
and get System is deadlocked on memory
error (see attached screenshot).
Compiled with node makefile.js emscripten release --enable-wasm
Emscripten info: emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.39.9, clang version 11.0.0 MacOS
Run in Chrome 80 via serve
npm package (via http://localhost:5000/?cda=tc11os
)
I think the system is out of memory -- how can I increase available RAM for OS (e.g. via browser address line parameters?)?
Thank you!
how do you get os running in the app version
Is it possible to create Visual Studio Project for Windows builds?
As far as I can tell there is typo:
Line 950 in 1d942ac
Usage of flags
makes no sense here. Maybe temp2 > 0
should be placed there (as it indicates that the remainder found is a partial one as far as I can tell).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.