1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <!doctype html>
- <title>Archlinux</title>
- <script src="../build/libv86.js"></script>
- <script>
- "use strict";
- window.onload = function()
- {
- var emulator = new V86Starter({
- wasm_path: "../build/v86.wasm",
- memory_size: 128 * 1024 * 1024,
- vga_memory_size: 8 * 1024 * 1024,
- screen_container: document.getElementById("screen_container"),
- bios: {
- url: "../bios/seabios.bin",
- },
- vga_bios: {
- url: "../bios/vgabios.bin",
- },
- hda: {
- url: "http://localhost/v86-images/arch3.img",
- async: true,
- size: 8 * 1024 * 1024 * 1024,
- },
- filesystem: {
- baseurl: "http://localhost/v86-images/arch/",
- basefs: "http://localhost/v86-images/fs.json",
- },
- autostart: true,
- });
- document.getElementById("save_file").onclick = function()
- {
- emulator.save_state(function(error, new_state)
- {
- if(error)
- {
- throw error;
- }
- 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();
- });
- this.blur();
- };
- document.getElementById("restore_file").onchange = function()
- {
- if(this.files.length)
- {
- var filereader = new FileReader();
- emulator.stop();
- filereader.onload = function(e)
- {
- emulator.restore_state(e.target.result);
- 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>
|