-
Notifications
You must be signed in to change notification settings - Fork 0
/
preview.html
98 lines (80 loc) · 1.74 KB
/
preview.html
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Rat16 Console</title>
<style type="text/css">
body{
height: 100vh;
width: 100vw;
margin: 0px;
padding: 0px;
}
</style>
</head>
<body>
<canvas id="main" style="cursor: none;"></canvas>
<script src="memorymap.js"></script>
<script src="devices.js"></script>
<script src="graphicspipeline.js"></script>
<script src="gpu.js"></script>
<script src="rat16.js"></script>
<script>
let test = [
0,1,1,0,0,1,1,0,
0,1,1,0,0,1,1,0,
0,1,1,0,0,1,1,0,
0,1,1,0,0,1,1,0,
0,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,1,1,1,1,1,1,1,
0,1,1,0,0,1,1,0,
0,1,1,0,0,1,1,0,
0,1,1,0,0,1,1,0,
0,1,1,0,0,1,1,0,
0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,
1,0,0,0,0,0,0,1,
1,1,1,1,1,1,1,1,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0
]
let data = {
sprites: test,
code: () => {
let key = "No Cart!\n\nLoad one!"
function update() {
this.clr()
let txt = key.split("\n")
for (var i = 0; i < txt.length; i++) {
let v = txt[i]
this.text(v,50-((v.length*8)/2),(50-4)+(i*8),2)
}
}
return update
}
}
let params = new URLSearchParams(window.location.search)
if (params.get("data")) {
let jsn;
try{
jsn = JSON.parse(atob(params.get("data").replace(/ /g, "+")))
data = jsn
}catch(err){
alert(`Could not load:\n${err}`)
throw new Error(err)
}
}
let vm = new Rat16(document.getElementById("main"), data)
vm.run()
</script>
</body>
</html>