2015-01-12 06:16:01 +01:00
|
|
|
<!doctype html>
|
2015-08-22 16:37:55 +02:00
|
|
|
<title>Archlinux</title>
|
2015-01-12 06:16:01 +01:00
|
|
|
|
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 emulator = new V86Starter({
|
2021-01-01 02:14:30 +01:00
|
|
|
wasm_path: "../build/v86.wasm",
|
2021-01-02 03:10:47 +01:00
|
|
|
memory_size: 512 * 1024 * 1024,
|
2015-08-22 16:37:55 +02:00
|
|
|
vga_memory_size: 8 * 1024 * 1024,
|
2015-01-12 06:16:01 +01:00
|
|
|
screen_container: document.getElementById("screen_container"),
|
|
|
|
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
|
|
|
},
|
2015-08-22 16:37:55 +02:00
|
|
|
filesystem: {
|
2021-01-02 03:10:47 +01:00
|
|
|
baseurl: "../images/arch/",
|
|
|
|
basefs: "../images/fs.json",
|
2015-01-12 06:16:01 +01:00
|
|
|
},
|
|
|
|
autostart: true,
|
2021-01-02 03:10:47 +01:00
|
|
|
bzimage_initrd_from_filesystem: true,
|
|
|
|
cmdline: [
|
|
|
|
"rw",
|
|
|
|
"root=host9p rootfstype=9p rootflags=trans=virtio,cache=loose",
|
|
|
|
"init=/usr/bin/init-openrc",
|
|
|
|
].join(" "),
|
2015-01-12 06:16:01 +01:00
|
|
|
});
|
|
|
|
|
2022-07-25 14:55:07 +02:00
|
|
|
document.getElementById("save_file").onclick = async function()
|
2015-01-12 06:16:01 +01:00
|
|
|
{
|
2022-07-25 14:55:07 +02:00
|
|
|
const new_state = await emulator.save_state();
|
2015-01-12 06:16:01 +01:00
|
|
|
|
2022-07-25 14:55:07 +02:00
|
|
|
var a = document.createElement("a");
|
|
|
|
a.download = "v86state.bin";
|
|
|
|
a.href = window.URL.createObjectURL(new Blob([new_state]));
|
|
|
|
a.dataset.downloadurl = "application/octet-stream:" + a.download + ":" + a.href;
|
|
|
|
a.click();
|
2015-01-12 06:16:01 +01:00
|
|
|
|
|
|
|
this.blur();
|
|
|
|
};
|
|
|
|
|
|
|
|
document.getElementById("restore_file").onchange = function()
|
|
|
|
{
|
|
|
|
if(this.files.length)
|
|
|
|
{
|
|
|
|
var filereader = new FileReader();
|
|
|
|
emulator.stop();
|
|
|
|
|
2022-07-25 14:55:07 +02:00
|
|
|
filereader.onload = async function(e)
|
2015-01-12 06:16:01 +01:00
|
|
|
{
|
2022-07-25 14:55:07 +02:00
|
|
|
await emulator.restore_state(e.target.result);
|
2015-01-12 06:16:01 +01:00
|
|
|
emulator.run();
|
|
|
|
};
|
|
|
|
|
|
|
|
filereader.readAsArrayBuffer(this.files[0]);
|
|
|
|
|
|
|
|
this.value = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
this.blur();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<input id="save_file" type="button" value="Save state to file">
|
|
|
|
Restore from file: <input id="restore_file" type="file">
|
|
|
|
<hr>
|
|
|
|
|
|
|
|
<!-- A minimal structure for the ScreenAdapter defined in browser/screen.js -->
|
|
|
|
<div id="screen_container">
|
|
|
|
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
|
|
|
|
<canvas style="display: none"></canvas>
|
|
|
|
</div>
|