{"id":15049281,"url":"https://github.com/nepx/halfix","last_synced_at":"2025-04-04T14:07:40.584Z","repository":{"id":54801568,"uuid":"217739578","full_name":"nepx/halfix","owner":"nepx","description":"x86 PC emulator that runs both natively and in the browser, via WebAssembly","archived":false,"fork":false,"pushed_at":"2022-12-26T04:29:19.000Z","size":2396,"stargazers_count":701,"open_issues_count":24,"forks_count":86,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-03-28T13:08:10.110Z","etag":null,"topics":["c","c99","cpu-emulator","emscripten","emulator","javascript","pc-emulator","pentium","webassembly","x86","x86-emulator"],"latest_commit_sha":null,"homepage":"https://nepx.github.io/halfix-demo/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nepx.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-26T16:46:51.000Z","updated_at":"2025-03-21T14:34:04.000Z","dependencies_parsed_at":"2023-01-30T23:16:02.543Z","dependency_job_id":null,"html_url":"https://github.com/nepx/halfix","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nepx%2Fhalfix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nepx%2Fhalfix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nepx%2Fhalfix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nepx%2Fhalfix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nepx","download_url":"https://codeload.github.com/nepx/halfix/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190250,"owners_count":20898702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","c99","cpu-emulator","emscripten","emulator","javascript","pc-emulator","pentium","webassembly","x86","x86-emulator"],"created_at":"2024-09-24T21:19:27.085Z","updated_at":"2025-04-04T14:07:40.536Z","avatar_url":"https://github.com/nepx.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Halfix x86 emulator\n\nHalfix is a portable x86 emulator written in C99. It allows you to run legacy operating systems on modern platforms. \n\n## Why?\n\nI made this mostly for fun, and because it was a great way to learn about the x86 PC architecture. On a more practical level, it can be used for:\n - Testing out or developing operating systems\n - Running old programs or operating systems that no longer work on modern computers or you wouldn't want to risk running on your personal computer. \n - Simulating other x86-based systems (the CPU component can be isolated relatively easily and used in other projects)\n - Testing web browser performance\n\n## Building and Running\n\nYou will need `node.js`, a C99-compatible compiler, `zlib`, and Emscripten (only if you're targeting the browser). Make sure that the required libraries are in a place where the compiler can find them. No pre-build configuration is required. \n\nThe display driver uses `libsdl`, but if you're on Windows, there's a native port that uses the Win32 API and doesn't require SDL. \n\n```bash\n# Debug, native\nnode makefile.js\n# Debug, Emscripten, asm.js\nnode makefile.js emscripten\n# Debug, Emscripten, WebAssembly\nnode makefile.js emscripten --enable-wasm\n\n# Release, native\nnode makefile.js release\n# Release, Emscripten, asm.js\nnode makefile.js emscripten release\n# Release, Emscripten, WebAssembly\nnode makefile.js emscripten --enable-wasm release\n\n# Win32 API build (no SDL required)\nnode makefile.js win32\n# Win32 API build, release\nnode makefile.js win32 release\n\n# For more options and fine tuning\nnode makefile.js --help\n\n# Chunk an image \nnode tools/imgsplit.js os.img\n\n# Run in browser\nhttp-server\n```\n\nCheck the [project wiki](https://github.com/nepx/halfix/wiki) for more details. \n\n## System Specifications\n\n - [CPU](https://github.com/nepx/halfix/tree/master/src/cpu): x86-32 (FPU, MMX, SSE, SSE2, some SSE3, PAE)\n - RAM: Configurable - anywhere from 1 MB to 3584 MB\n - Devices:\n   - Intel 8259 [Programmable Interrupt Controller](https://github.com/nepx/halfix/blob/master/src/hardware/pic.c)\n   - Intel 8254 [Programmable Interval Timer](https://github.com/nepx/halfix/blob/master/src/hardware/pit.c)\n   - Intel 8237 [Direct Memory Access Controller](https://github.com/nepx/halfix/blob/master/src/hardware/dma.c)\n   - Intel 8042 [\"PS/2\" Controller](https://github.com/nepx/halfix/blob/master/src/hardware/kbd.c) with attached keyboard and mouse\n   - [i440FX chipset](https://github.com/nepx/halfix/blob/master/src/hardware/pci.c) (this doesn't work quite so well yet)\n     - 82441FX PMC\n     - 82371SB ISA-to-PCI bus\n     - 82371SB IDE controller\n     - [ACPI](https://github.com/nepx/halfix/blob/master/src/hardware/acpi.c) interface\n   - Intel 82093AA [I/O APIC](https://github.com/nepx/halfix/blob/master/src/hardware/ioapic.c)\n - Display: Generic [VGA graphics card](https://github.com/nepx/halfix/blob/master/src/hardware/vga.c) (ET4000-compatible) with Bochs VBE extensions, optionally PCI-enabled\n - Mass Storage: \n   - Generic [IDE controller](https://github.com/nepx/halfix/blob/master/src/hardware/ide.c) (hard drive and CD-ROM) \n   - Intel 82077AA [Floppy drive controller](https://github.com/nepx/halfix/blob/master/src/hardware/fdc.c) (incomplete, but works in most cases)\n - Dummy PC speaker (no sound)\n\n## Compatibility\n\nIt boots a wide range of operating system software, including all versions of DOS, most versions of Windows (excluding Windows 8), newer versions of OS/2 Warp (3 and 4.5), ReactOS, some varieties of Linux (ISO Linux, Damn Small Linux, Red Star OS 2, Buildroot, Ubuntu), 9Front, NeXTSTEP, several hobby OSes, and probably more. \n\nSee [Compatibility](compatibility.md) for more details.\n\n## Self-Virtualization\n\nCan you run the emulator inside the emulator? \n\nYes, but not very quickly. \n\n![Halfix in Halfix](docs/pics/halfix-in-halfix.png)\n\n## Screenshots\n\nMS-DOS\n\n![DOS](docs/pics/dos.png)\n\nOS/2 Warp 4.5\n\n![OS/2 Warp](docs/pics/os2-warp4.png)\n\nWindows Vista\n\n![Vista](docs/pics/vista.png)\n\nWindows 7\n\n![Windows 7](docs/pics/win7.png)\n\nThe same Windows 98 disk image as in the [Halfix in Halfix screenshot](docs/pics/halfix-in-halfix.png) running in Firefox\n\n![Win98](docs/pics/win98.png)\n\nCPU-Z on Windows XP\n\n![CPU-Z](docs/pics/cpu-z.png)\n\nWindows 10\n\n![Win10](docs/pics/win10.png)\n\nUbuntu\n\n![Ubuntu](docs/pics/ubuntu.png)\n\n## Transferring Files\n\nCreate a directory with all the files you want to transfer and create an ISO image. \n\n```\nmkisofs -o programs.iso -max-iso9660-filenames -iso-level 4 programs/\n```\n\nNow update the configuration file as follows:\n\n```\n# Note: it does not hae to be ata0-slave. \n# I have not tested it with anything but ata0-slave.\n[ata0-slave]\ninserted=1\ntype=cd\nfile=/tmp/programs.iso\ndriver=sync\n```\n\nNow boot up your operating system and copy the files from the CD-ROM to the hard drive. \n\n## Known Issues\n - SSE3 is not fully supported\n - Performance isn't terrible, but it isn't fantastic either (70-100 MIPS native, 10-30 MIPS browser)\n - Timing is completely off\n - Windows 8 doesn't boot (see [this issue](https://github.com/nepx/halfix/issues/1))\n - FPU exceptions are probably very incorrect\n - Most devices aren't complete, but enough is implemented to boot modern OSes. \n - The configuration file parser isn't very good\n\n## License\n\nGNU General Public License version 3\n\n## Similar Projects\n\n - [v86](https://www.github.com/copy/v86)\n - [JSLinux](http://bellard.org/jslinux/)\n - [jemul8](http://www.github.com/asmblah/jemul8)\n\n## Credits\n\nThe FPU emulator uses an modified version of [Berkeley SoftFloat](jhauser.us/arithmetic/SoftFloat.html) from the [Bochs](bochs.sourceforge.net) emulator. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnepx%2Fhalfix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnepx%2Fhalfix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnepx%2Fhalfix/lists"}