2014-10-11 02:24:30 +02:00
|
|
|
[Live demo](http://copy.sh/v86/).
|
2013-11-06 18:19:13 +01:00
|
|
|
|
|
|
|
|
2013-11-06 01:12:55 +01:00
|
|
|
How does it work?
|
|
|
|
-
|
|
|
|
|
|
|
|
v86 emulates an x86-compatible CPU and hardware. Here's a list of emulated hardware:
|
|
|
|
|
|
|
|
- An x86 compatible CPU. The instruction set is around Pentium 1 level. Some
|
|
|
|
features are missing, more specifically:
|
|
|
|
- Task gates, far calls in protected mode
|
2014-07-23 01:11:06 +02:00
|
|
|
- 16 bit protected mode features
|
2013-11-06 01:12:55 +01:00
|
|
|
- Single stepping
|
|
|
|
- MMX, SSE
|
2014-07-23 01:11:06 +02:00
|
|
|
- A bunch of FPU instructions
|
|
|
|
- Some exceptions
|
2013-11-06 01:12:55 +01:00
|
|
|
- A floating point unit (FPU). Calculations are done with JavaScript's double
|
|
|
|
precision numbers (64 bit), so they are not as precise as calculations on a
|
|
|
|
real FPU (80 bit).
|
|
|
|
- A floppy disk controller (8272A).
|
|
|
|
- An 8042 Keyboard Controller, PS2. With mouse support.
|
|
|
|
- An 8254 Programmable Interval Timer (PIT).
|
|
|
|
- An 8259 Programmable Interrupt Controller (PIC).
|
|
|
|
- A CMOS Real Time Clock (RTC).
|
|
|
|
- A VGA controller with SVGA support and Bochs VBE Extensions. This includes
|
|
|
|
support for large resolutions.
|
2013-11-26 21:58:12 +01:00
|
|
|
- A PCI bus. This one is partly incomplete and not used by every device.
|
|
|
|
- An IDE disk controller.
|
2014-10-11 02:15:37 +02:00
|
|
|
- An NE2000 (8390) PCI network card.
|
2014-12-02 19:01:13 +01:00
|
|
|
- A virtio filesystem.
|
2013-11-06 01:12:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
How to build, run and embed?
|
|
|
|
-
|
|
|
|
|
|
|
|
- In order to build the `cpu.js` file, you need `make` and `cpp` (the C preprocessor).
|
2014-12-14 16:37:27 +01:00
|
|
|
Run: `make build/cpu.js`.
|
2014-07-23 01:11:06 +02:00
|
|
|
- If you want a compressed and fast (i.e. with debug code removed) version, you
|
2014-01-25 22:06:35 +01:00
|
|
|
need Closure Compiler. Pull the submodule using
|
2014-12-14 16:37:27 +01:00
|
|
|
`git submodule update --init --recursive closure-compiler` and run `make build/v86_all.js`.
|
2014-01-10 23:12:56 +01:00
|
|
|
- ROM and disk images are loaded via XHR, so if you want to try out `index.html`
|
2014-12-14 16:37:27 +01:00
|
|
|
locally, make sure to serve it from a local webserver. You can use `make run`
|
|
|
|
to serve the files using Python's SimpleHTTPServer.
|
2014-07-23 01:11:06 +02:00
|
|
|
- If you want only want to embed v86 on website you can use libv86.js. For
|
2014-08-22 13:20:41 +02:00
|
|
|
usage, check out [basic.html](docs/samples/basic.html).
|
2014-12-14 16:37:27 +01:00
|
|
|
- A couple of disk images are provided for testing. You can check them out
|
|
|
|
using `git submodule update --init --recursive images`.
|
|
|
|
|
|
|
|
|
|
|
|
To summarize:
|
|
|
|
|
|
|
|
```
|
|
|
|
git clone https://github.com/copy/v86.git # grab the main repo
|
|
|
|
cd v86
|
|
|
|
git submodule update --init --recursive images # get the disk images
|
|
|
|
git submodule update --init --recursive closure-compiler # fetch the disk images
|
|
|
|
```
|
|
|
|
|
|
|
|
Rebuild compiled version:
|
|
|
|
|
|
|
|
```
|
|
|
|
make
|
|
|
|
```
|
|
|
|
|
|
|
|
Rebuild only debug version (only necessary after changing `.macro.js` files):
|
|
|
|
|
|
|
|
```
|
|
|
|
make build/cpu.js
|
|
|
|
```
|
2013-11-06 01:12:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
Why?
|
|
|
|
-
|
|
|
|
|
|
|
|
Similiar projects have been done before, but I decided to work on this as a fun
|
|
|
|
project and learn something about the x86 architecture. It has grown pretty
|
2014-07-23 01:11:06 +02:00
|
|
|
advanced and I got Linux and KolibriOS working, so there might be some actual
|
|
|
|
uses.
|
|
|
|
|
|
|
|
If you build something interesting, let me know.
|
2013-11-06 01:12:55 +01:00
|
|
|
|
|
|
|
|
2014-01-10 23:12:56 +01:00
|
|
|
Compatibility
|
|
|
|
-
|
|
|
|
|
|
|
|
Here's an overview of the operating systems supported in v86:
|
|
|
|
|
2014-07-23 01:11:06 +02:00
|
|
|
- Linux works pretty well. Graphical boot fails in many versions, but you
|
|
|
|
mostly get a shell. The mouse is often not detected automatically.
|
2014-01-10 23:12:56 +01:00
|
|
|
- Damn Small Linux (2.4 Kernel): Run with `lowram` and choose PS2 mouse in
|
2014-07-23 01:11:06 +02:00
|
|
|
xsetup. Takes circa 10 minutes to boot.
|
|
|
|
- Tinycore (3.0 kernel): `udev` and `X` fail, but you get a
|
2014-01-10 23:12:56 +01:00
|
|
|
terminal.
|
2014-07-23 01:11:06 +02:00
|
|
|
- Nanolinux works.
|
|
|
|
- Archlinux works. Add `atkbd` to `MODULES` in `/etc/mkinitcpio.conf`.
|
|
|
|
- FreeDOS and Windows 1.01 run very well.
|
|
|
|
- KolibriOS works. A few applications need SSE.
|
|
|
|
- Haiku boots, but takes very long (around 30 minutes). Set the memory size to 128MB.
|
|
|
|
- ReactOS doesn't work.
|
|
|
|
- No Android version seems to work, you still get a shell.
|
2014-01-10 23:12:56 +01:00
|
|
|
|
2014-12-14 16:37:27 +01:00
|
|
|
You can get some infos on the disk images here: https://github.com/copy/images
|
2014-01-10 23:12:56 +01:00
|
|
|
|
2013-11-06 01:12:55 +01:00
|
|
|
|
|
|
|
How can I contribute?
|
|
|
|
-
|
|
|
|
|
2014-07-23 01:11:06 +02:00
|
|
|
- Add new features (hardware devices, fill holes in the CPU), fix bugs. Check
|
2014-12-14 16:37:27 +01:00
|
|
|
out the issues section and contact me if you need help.
|
2014-07-23 01:11:06 +02:00
|
|
|
- Report bugs.
|
|
|
|
- Donate. Via Bitcoin:
|
|
|
|
[`14KBXSoewGzbQY8VoznJ5MZXGxoia8RxC9`](https://blockchain.info/address/14KBXSoewGzbQY8VoznJ5MZXGxoia8RxC9).
|
|
|
|
If you want to donate elsewhere, let me know.
|
2013-11-06 01:12:55 +01:00
|
|
|
|
|
|
|
License
|
|
|
|
-
|
|
|
|
|
|
|
|
Simplified BSD License, see [LICENSE](LICENSE), unless otherwise noted.
|
|
|
|
|
|
|
|
|
|
|
|
Credits
|
|
|
|
-
|
|
|
|
|
|
|
|
- Test cases via QEMU, http://wiki.qemu.org/Main_Page
|
|
|
|
- https://github.com/creationix/node-sdl
|
|
|
|
- ascii.ttf (used in node) from http://www.apollosoft.de/ASCII/indexen.htm
|
2014-07-12 20:22:02 +02:00
|
|
|
- [Disk Images](https://github.com/copy/images)
|
2014-12-02 19:01:13 +01:00
|
|
|
- [The jor1k project](https://github.com/s-macke/jor1k) for 9p and filesystem drivers
|
2013-11-06 01:12:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
More questions?
|
|
|
|
-
|
|
|
|
|
|
|
|
Shoot me an email to `copy@copy.sh`. Please don't tell about bugs via mail,
|
2014-07-23 01:11:06 +02:00
|
|
|
create a bug report on GitHub instead.
|
2013-11-06 01:12:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
Author
|
|
|
|
-
|
|
|
|
|
|
|
|
Fabian Hemmer (http://copy.sh/, `copy@copy.sh`)
|
2014-07-23 01:11:06 +02:00
|
|
|
|