-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
82 lines (73 loc) · 3.04 KB
/
index.html
File metadata and controls
82 lines (73 loc) · 3.04 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GemuOtokonoko</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="emulator">
<section class="screen">
<canvas id="renderer" width="160" height="144"></canvas>
</section>
<section class="emulator-helpers">
<section class="debug">
<div class="registers-flags">
<div class="registers" id="registers">
<p id="AF">AF: 0000</p>
<p id="BC">BC: 0000</p>
<p id="DE">DE: 0000</p>
<p id="HL">HL: 0000</p>
<p id="PC">PC: 0000</p>
<p id="SP">SP: 0000</p>
<p id="OC">OC: 00</p>
</div>
<div class="flags" id="flags">
<label>Z<input type="checkbox" id="zero"></label>
<label>N<input type="checkbox" id="negative"></label>
<label>H<input type="checkbox" id="halfcarry"></label>
<label>C<input type="checkbox" id="carry"></label>
</div>
</div>
<div class=buttons>
<button type="button" id="step">Step</button>
<button type="button">Step over</button>
<button type="button">Reset</button>
<button type="button">Pause</button>
<button type="button">Stop</button>
<button type="button" id="run">Run</button>
<button type="button" class="btn" id="loadRom">Load Rom...</button>
<input type="file" id="rom" name="file">
</div>
</section>
<section class="next-instructions">
<div class="instructions" id="instructions">
</div>
</section>
</section>
</main>
<script src="src/constants.js"></script>
<script type="module" src="src/script.js"></script>
<script type="module">
import { tick, run, loadRom } from "./src/script.js";
document.getElementById("step").addEventListener("click", () => tick());
document.getElementById("run").addEventListener("click", () => run());
document.getElementById("loadRom").addEventListener('click', () => {
document.getElementById('rom').click()
});
let romLoader = document.getElementById('rom');
romLoader.onchange = function () {
let file = this.files[0];21
let reader = new FileReader(); // no arguments
let view = null;
reader.readAsArrayBuffer(file);
console.log("file loaded");
reader.onloadend = () => {
view = new Uint8Array(reader.result);
loadRom(view);
}
}
</script>
</body>
</html>