-
Notifications
You must be signed in to change notification settings - Fork 0
/
loader.js
36 lines (30 loc) · 1.21 KB
/
loader.js
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
// load all files to run v86 in browser, uncompiled
(function()
{
var
CORE_FILES = "const.js io.js cpu.js main.js ide.js fpu.js pci.js floppy.js " +
"memory.js dma.js pit.js vga.js ps2.js pic.js rtc.js uart.js acpi.js hpet.js " +
"cpu_state.js",
BROWSER_FILES = "main.js screen.js keyboard.js mouse.js serial.js lib.js",
LIB_FILES = "esprima.js walk.js";
load_scripts(CORE_FILES, "src/");
load_scripts(BROWSER_FILES, "src/browser/");
load_scripts(LIB_FILES, "lib/");
function load_scripts(resp, path)
{
var files = resp.split(" "),
script;
for(var i = 0; i < files.length; i++)
{
// this may be a bad idea, if someone tries to
// load this script after the document has loaded,
// but it's necessary to ensure that scripts are
// loaded in order
document.write('<script src="' + path + files[i] + '"></script>');
//script = document.createElement("script");
//script.src = PATH + files[i] + "?" + Math.random();
//script.defer = "defer";
//document.body.appendChild(script);
}
}
})();