v86/examples/two_instances.html

89 lines
2.4 KiB
HTML
Raw Permalink Normal View History

2015-01-12 06:16:01 +01:00
<!doctype html>
<title>Two emulators</title>
2015-09-12 00:35:44 +02:00
<script src="../build/libv86.js"></script>
2015-01-12 06:16:01 +01:00
<script>
"use strict";
window.onload = function()
{
var container1 = document.getElementById("screen_container1");
var container2 = document.getElementById("screen_container2");
var emulator1 = new V86Starter({
2021-01-01 02:14:30 +01:00
wasm_path: "../build/v86.wasm",
2015-01-12 06:16:01 +01:00
screen_container: container1,
bios: {
2015-09-12 00:35:44 +02:00
url: "../bios/seabios.bin",
2015-01-12 06:16:01 +01:00
},
vga_bios: {
2015-09-12 00:35:44 +02:00
url: "../bios/vgabios.bin",
2015-01-12 06:16:01 +01:00
},
cdrom: {
2015-09-12 00:35:44 +02:00
url: "../images/linux.iso",
2015-01-12 06:16:01 +01:00
},
autostart: true,
});
var emulator2 = new V86Starter({
2021-01-01 02:14:30 +01:00
wasm_path: "../build/v86.wasm",
2015-01-12 06:16:01 +01:00
screen_container: container2,
bios: {
2015-09-12 00:35:44 +02:00
url: "../bios/seabios.bin",
2015-01-12 06:16:01 +01:00
},
vga_bios: {
2015-09-12 00:35:44 +02:00
url: "../bios/vgabios.bin",
2015-01-12 06:16:01 +01:00
},
cdrom: {
2015-09-12 00:35:44 +02:00
url: "../images/linux.iso",
2015-01-12 06:16:01 +01:00
},
autostart: true,
});
emulator2.keyboard_set_status(false);
container1.addEventListener("mousedown", function(e)
{
container1.style.borderColor = "yellow";
container2.style.borderColor = "black";
emulator1.keyboard_set_status(true);
emulator2.keyboard_set_status(false);
}, false);
container2.addEventListener("mousedown", function(e)
{
container1.style.borderColor = "black";
container2.style.borderColor = "yellow";
emulator1.keyboard_set_status(false);
emulator2.keyboard_set_status(true);
}, false);
emulator1.add_listener("serial0-output-char", function(char)
{
emulator2.serial0_send(char);
});
emulator1.add_listener("net0-send", function(data)
{
emulator2.bus.send("net0-receive", data);
});
emulator2.add_listener("net0-send", function(data)
{
emulator1.bus.send("net0-receive", data);
});
2015-01-12 06:16:01 +01:00
};
</script>
Click on a screen to control it.<hr>
<div id="screen_container1" style="float: left; margin: 10px; border: 3px solid yellow;">
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>
<div id="screen_container2" style="float: left; margin: 10px; border: 3px solid black;">
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>