Comments (1)
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Debian Emulator</title>
<script src="./emulator/libv86-debug.js"></script>
</head>
<body>
<div id="screen_container">
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>
<div>
<input type="text" id="code_input" placeholder="Type your code here" style="width: 400px;">
<button id="run_button">Run</button>
</div>
<div>
<pre id="status">Wait for boot...</pre>
<pre id="output"></pre>
</div>
<script>
"use strict";
window.onload = function() {
var emulator = new V86({
wasm_path: "./emulator/v86-debug.wasm",
memory_size: 512 * 1024 * 1024,
vga_memory_size: 8 * 1024 * 1024,
screen_container: document.getElementById("screen_container"),
initial_state: { url: "./debina/debian-state-base.bin" },
filesystem: { baseurl: "./debina/debian-9p-rootfs-flat/" },
autostart: true,
disable_keyboard: true,
disable_mouse: true,
});
var data = "";
var do_output = false;
emulator.add_listener("serial0-output-byte", function(byte) {
var char = String.fromCharCode(byte);
if(char !== "\r") {
data += char;
}
if(do_output) {
document.getElementById("output").textContent += char;
}
if(data.endsWith("~# ")) {
console.log("Now ready");
document.getElementById("status").textContent = "Ready.\n";
document.getElementById("run_button").disabled = false;
do_output = false;
}
});
document.getElementById("code_input").onkeydown = function(e) {
if(e.which == 13 && e.ctrlKey) {
document.getElementById("run_button").onclick();
}
};
document.getElementById("run_button").onclick = function() {
var code = document.getElementById("code_input").value;
emulator.serial0_send(bashEscape(code) + "\n");
document.getElementById("output").textContent = "";
document.getElementById("status").textContent = "Running ...\n";
this.disabled = true;
do_output = true;
};
};
function bashEscape(arg) {
arg = arg.replace(/\t+/g, "");
return "'" + arg.replace(/'+/g, function (val) {
return "'" + val.replace(/'/g, "\\'") + "'";
}) + "'";
}
</script>
</body>
</html>
this worked.
from v86.
Related Issues (20)
- Adding NX functionality via my fork, will request help there.
- you dont actually need qemu to make a hdd HOT 1
- PIC disables all IRQs on initialization HOT 1
- DOMException when running this DOS image
- MacOS not working HOT 1
- Running this in browser using file:// HOT 1
- non-QWERTY keyboards have incorrect input HOT 1
- ability to run .elf kernel HOT 2
- Cannot run KolibriOS HOT 4
- When attempting to install debian in the emulator, from both disk and cd-rom, I get a bugged out screen. HOT 3
- SSSE3 support HOT 1
- Booting windows XP HOT 1
- Buildroot - how to access files uploaded? HOT 1
- Buildroot has no apt command? HOT 1
- fs9p read_file strange behavior (How to detect if ready to read?) HOT 6
- Audio not working / Soundcard not fully configured on demo Windows 2000 image HOT 1
- Floppy disk buffer changes are not saved or loaded with the state HOT 1
- Add OPFS/navigator.storage Support for Improved File System Integration HOT 1
- KolibriOS image has changed location HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from v86.