| var V86Starter = require("../../build/libv86.js").V86Starter; |
| return new Uint8Array(fs.readFileSync(path)).buffer; |
| console.log("Use F2 to save the state and F3 to restore."); |
| var bios = readfile(__dirname + "/../../bios/seabios.bin"); |
| var linux = readfile(__dirname + "/../../images/linux.iso"); |
| var emulator = new V86Starter({ |
| cdrom: { buffer: linux }, |
| emulator.add_listener("serial0-output-char", function(chr) |
| process.stdout.write(chr); |
| console.log("Now booting, please stand by ..."); |
| process.stdin.setRawMode(true); |
| process.stdin.setEncoding("utf8"); |
| process.stdin.on("data", function(c) |
| else if(c === "\x1b\x4f\x51") |
| emulator.save_state(function(err, s) |
| console.log("--- Saved ---"); |
| else if(c === "\x1b\x4f\x52") |
| console.log("--- Restored ---"); |
| emulator.restore_state(state); |
| emulator.serial0_send(c); |