-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsections.html
More file actions
60 lines (46 loc) · 1.9 KB
/
sections.html
File metadata and controls
60 lines (46 loc) · 1.9 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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8" />
<title>Color Computer web disassembler</title>
<link rel="stylesheet" type="text/css" href="./lib/bootstrap.min.css" />
</head>
<body>
<div id="navbar"></div>
<table id="sections" class="table">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Size</th>
<th scope="col">VMA</th>
<th scope="col">Raw file</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script type="module">
import { setupNavBar } from './src/view/setupNavBar.mjs';
import { Section, loadAllSections, getAllSections } from './src/model/section.mjs';
function onLoad() {
setupNavBar();
loadAllSections();
const sections = getAllSections();
var tableBodyEl = document.querySelector("table#sections>tbody");
let keys = [], key = "", row = {}, i = 0;
for (let i = 0; i < sections.length; i++) {
row = tableBodyEl.insertRow();
row.insertCell(-1).textContent = sections[i].name;
row.insertCell(-1).textContent = sections[i].size + " bytes";
row.insertCell(-1).textContent = "$" + sections[i].virtualMemoryAddress.toString(16);
console.log(sections[i].buffer);
var blob = new Blob([new Uint8Array(sections[i].buffer)], {type: "application/octet-stream"});
console.log(blob);
let url = window.URL.createObjectURL(blob);
row.insertCell(-1).innerHTML = '<a download="' + sections[i].name + '.raw" href="' + url + '">' + sections[i].name + '.raw</a>';
}
}
window.addEventListener("load", onLoad);
</script>
</body>
</html>