v86 README

The project's README from github.com/copy/v86. As one markdown file: README.md.

Join the chat at https://gitter.im/copy/v86 or #v86 on irc.libera.chat

v86 emulates an x86-compatible CPU and hardware. Machine code is translated to WebAssembly modules at runtime in order to achieve decent performance. Here's a list of emulated hardware:

Demos

9front — Arch Linux — Android-x86 1.6-r2 — Android-x86 4.4-r2 — BasicLinux — Buildroot Linux — Damn Small Linux — ELKS — FreeDOS — FreeBSD — FiwixOS — Haiku — SkiffOS — ReactOS — Windows 2000 — Windows 98 — Windows 95 — Windows 1.01 — MS-DOS 6.22 — OpenBSD — Oberon — KolibriOS — SkiftOS — QNX

Documentation

How it works — Networking — Dial-up modem networking — Alpine Linux guest setup — Arch Linux guest setup — Debian with xfce guest setup — MS-DOS/FreeDOS guest setup — Windows 3.1x guest setup — Windows 9x guest setup — Windows NT guest setup — 9p filesystem — Linux rootfs on 9p — Profiling

Compatibility

Here's an overview of the operating systems supported in v86:

You can get some information on the disk images here: https://github.com/copy/images.

How to build, run and embed?

You need:

See tools/docker/test-image/Dockerfile for a full setup on Debian or WSL.

Alternatively, to build using Docker

Running via Dev Container

Testing

The disk images for testing are not included in this repository. You can download them directly from the website using:

mkdir -p images && curl --compressed --output-dir images/ --remote-name-all https://i.copy.sh/{linux.iso,linux3.iso,linux4.iso,buildroot-bzimage68.bin,TinyCore-11.0.iso,oberon.img,msdos.img,openbsd-floppy.img,kolibri.img,windows101.img,os8.img,freedos722.img,mobius-fd-release5.img,msdos622.img}

Run integration tests: make tests

Run all tests: make jshint rustfmt kvm-unit-test nasmtests nasmtests-force-jit expect-tests jitpagingtests qemutests rust-test tests

See tests/Readme.md for more information.

API examples

Using v86 for your own purposes is as easy as:

var emulator = new V86({
    screen_container: document.getElementById("screen_container"),
    bios: {
        url: "../../bios/seabios.bin",
    },
    vga_bios: {
        url: "../../bios/vgabios.bin",
    },
    cdrom: {
        url: "../../images/linux.iso",
    },
    autostart: true,
});

See v86.d.ts for TypeScript definitions. You can use make doc (TypeDoc) or make denodoc (Deno) to generate HTML documentation in ./docs/api/.

Generative AI

At this time, v86 does not accept pull requests or issues written partially or entirely by generative AI tools. Exceptions may be made on a case-by-case basis.

License

v86 is distributed under the terms of the Simplified BSD License, see LICENSE. The following third-party dependencies are included in the repository under their own licenses:

Credits

More questions?

Shoot me an email to [email protected]. Please report bugs on GitHub.

v86 (copy/v86)

Searching Database…

23.6K ·GitHub
这是什么?v86 是一个完全在浏览器里运行的 x86 电脑模拟器。它模拟奔腾 4 级别的 CPU 和经典 PC 硬件,在运行时把客户机的机器码转成 WebAssembly,速度还不错。
这个要像 VirtualBox 那样安装,还是直接在网页里就能跑?什么都不用装——它就在网页里运行。你可以试试在线演示,通过 libv86.js 把它嵌入自己的网站,或者对于基于打包工具的项目引入官方的 npm 包。
那怎么把它加到自己的项目里呢?如果用的是 Vite、React、Next 或 Webpack 这类项目,运行 'npm install v86' 即可。否则可以从发布页面拿 libv86.js,参考自带的示例;想从源码构建的话,调试版用 'make',优化版用 'make all'。
被模拟的电脑性能怎么样?CPU 大概只有奔腾 4 的水平,完整支持 SSE3。没有 64 位扩展,也不支持多核,所以 64 位内核跑不起来——只能运行 32 位的客户机系统。
我用什么操作系统或浏览器有影响吗?基本没影响——所有运算都在浏览器端完成,任何现代浏览器都能用。如果你想自己部署模拟器,仓库里带了 Dockerfile,一条 docker run 命令就能启动服务。
把它嵌入我自己的网站会有授权方面的麻烦吗?不会——它采用的是宽松的 Simplified BSD License(BSD-2-Clause)。个别内置的第三方组件(如 SoftFloat 和 zstd)保留各自的原有授权。
哪些操作系统在上面跑得比较好?Linux 运行良好(仅限 32 位),FreeDOS、MS-DOS、Windows 1.01 到 2000、ReactOS、Haiku、KolibriOS、QNX 和 FreeBSD 也都没问题。Plan 9 和 OS/2 跑不了,Windows XP 及更新的系统只能在特定条件下运行。
被模拟的电脑都有什么硬件?都是经典 PC 配件:PS/2 键盘和鼠标、软盘和 IDE 磁盘控制器、支持 SVGA 和 Bochs VBE 扩展的 VGA 显卡、SoundBlaster 16 声卡、virtio 设备,甚至还有一个 Hayes 兼容的拨号调制解调器。
被模拟的电脑能上网吗?能——它带一块 NE2000 PCI 网卡,还支持 virtio 网络设备,文档里对普通联网和拨号调制解调器联网都有说明。有个示例甚至通过 Broadcast Channel API 把两个模拟器实例连成了一个网络。
我能把正在运行的虚拟机保存起来,以后再接着用吗?可以——API 支持保存和恢复模拟器的状态,而且用 zstd 压缩能让保存的状态镜像保持得很小。
What are similar projects?ra2, martypc, daedalOS, webvm, liteparse, frank-386, windows95, tfjs
Which topics is it in?jit, retro, cpu, x86, emulator, virtualization, hardware, wasm, bsd, browser, rust, npm
Creator
copy
Size
16.4 MB
Stars
23.6K
Updated
CommitOct 09
Age
12y
Commits · 90 Days