-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfloppy-insert-eject.js
More file actions
executable file
·50 lines (43 loc) · 1.6 KB
/
floppy-insert-eject.js
File metadata and controls
executable file
·50 lines (43 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env node
"use strict";
const TEST_RELEASE_BUILD = +process.env.TEST_RELEASE_BUILD;
const pause = require("timers/promises").setTimeout;
const fs = require("fs");
var V86 = require(`../../build/${TEST_RELEASE_BUILD ? "libv86" : "libv86-debug"}.js`).V86;
process.on("unhandledRejection", exn => { throw exn; });
const emulator = new V86({
bios: { url: __dirname + "/../../bios/seabios.bin" },
vga_bios: { url: __dirname + "/../../bios/vgabios.bin" },
hda: { url: __dirname + "/../../images/msdos.img" },
network_relay_url: "<UNUSED>",
autostart: true,
memory_size: 32 * 1024 * 1024,
filesystem: {},
log_level: 3,
disable_jit: +process.env.DISABLE_JIT,
});
//const interval = setInterval(() => {
// console.warn(emulator.screen_adapter.get_text_screen());
//}, 1000);
const timeout = setTimeout(() => {
console.warn(emulator.screen_adapter.get_text_screen());
throw new Error("Timeout");
}, 60 * 1000);
setTimeout(async () =>
{
await emulator.wait_until_vga_screen_contains("C:\\> ");
console.log("Got C:\\>");
await pause(1000);
emulator.keyboard_send_text("dir A:\n");
await emulator.wait_until_vga_screen_contains("Abort, Retry, Fail?");
console.log("Got Abort, Retry, Fail?");
await pause(1000);
emulator.keyboard_send_text("F");
emulator.set_fda({ url: __dirname + "/../../images/freedos722.img" });
emulator.keyboard_send_text("dir A:\n");
await emulator.wait_until_vga_screen_contains("FDOS <DIR>");
console.log("Got FDOS");
emulator.stop();
clearTimeout(timeout);
//clearInterval(interval);
}, 1000);