-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
298 lines (287 loc) · 15 KB
/
index.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="og:title" content="URCL Explorer">
<meta property="og:site_name" content="URCL Community">
<meta property="og:description" content="An IDE for URCL that runs in your browser.">
<meta property="og:type" content="website">
<meta property="og:image" content="src/img/favicon.png">
<title>URCL Explorer</title>
<link rel="stylesheet" href="./index.css">
<link rel="stylesheet" href="src/scroll-out/scoll-out.css">
<link rel="stylesheet" href="src/editor/editor.css">
<link rel="stylesheet" href="./mdb.dark.min.css">
<link rel="stylesheet" href="./codicon.css">
<link rel="icon" type="image/png" href="src/img/favicon.png">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
<script>
const synced_tabs = {};
window.addEventListener("load", function()
{
create_tab_group("left-tabs", "left-area");
create_tab_group("right-tabs", "right-area");
sync_tabs(["left-tabs", "right-tabs"]);
on_tab_selected("left-tabs", "left-area", "Source");
on_tab_selected("right-tabs", "right-area", "Examples");
});
function create_tab_group(group, view)
{
const tabs = document.getElementById(group);
const links = tabs.getElementsByTagName("a");
for (let i = 0; i < links.length; i++)
{
const link = links[i];
link.href = "javascript:on_tab_selected('" + group + "', '" + view + "', '" + link.innerText + "')";
const tab_id = link.innerText.replace(" ", "-").toLowerCase() + "-tab";
document.getElementById(tab_id).classList.add("d-none");
}
}
function sync_tabs(tabs)
{
for (let i = 0; i < tabs.length; i++)
{
synced_tabs[tabs[i]] = [];
for (let j = 0; j < tabs.length; j++)
{
if (i !== j) synced_tabs[tabs[i]].push(tabs[j]);
}
}
}
function on_tab_selected(group, view, link_text)
{
link_text = link_text.toUpperCase();
const tabs = document.getElementById(group);
const area = document.getElementById(view);
const links = tabs.getElementsByTagName("a");
for (let i = 0; i < links.length; i++)
{
const link = links[i];
const tab_id = link.innerText.replace(" ", "-").toLowerCase() + "-tab";
if (link.innerText.toUpperCase() === link_text)
{
const tab = document.getElementById(tab_id);
tab.parentNode.removeChild(tab);
area.appendChild(tab);
tab.classList.remove("d-none");
link.classList.add("active");
if (synced_tabs[group])
{
const other_groups = synced_tabs[group];
for (let j = 0; j < other_groups.length; j++)
{
disable_tab(other_groups[j], link_text);
}
}
}
else if (link.classList.contains("active"))
{
document.getElementById(tab_id).classList.add("d-none");
link.classList.remove("active");
if (synced_tabs[group])
{
const other_groups = synced_tabs[group];
for (let j = 0; j < other_groups.length; j++)
{
enable_tab(other_groups[j], link.innerText);
}
}
}
}
}
function enable_tab(group, link_text)
{
link_text = link_text.toUpperCase();
const tabs = document.getElementById(group);
const links = tabs.getElementsByTagName("a");
for (let i = 0; i < links.length; i++)
{
const link = links[i];
if (link.innerText.toUpperCase() === link_text)
{
link.classList.remove("d-none");
}
}
}
function disable_tab(group, link_text)
{
link_text = link_text.toUpperCase();
const tabs = document.getElementById(group);
const links = tabs.getElementsByTagName("a");
for (let i = 0; i < links.length; i++)
{
const link = links[i];
if (link.innerText.toUpperCase() === link_text)
{
link.classList.add("d-none");
}
}
}
</script>
</head>
<body class="container-fluid">
<div class="row">
<button id="compile-and-reset-button" class="btn btn-primary col major-button">Compile</button>
<button id="pause-button" class="btn btn-danger col major-button">Pause</button>
<button id="compile-and-run-button" class="btn btn-success col major-button">Compile & Run</button>
<button id="step-button" class="btn btn-warning col major-button">Step</button>
<button id="share-button" class="btn btn-info col major-button" style="font-family: codicon;"></button>
</div>
<main class="row">
<div class="col-sm col-push-5">
<ul id="left-tabs" class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link">Source</a>
</li>
<li class="nav-item">
<a class="nav-link">Build Output</a>
</li>
<li class="nav-item">
<a class="nav-link">Display</a>
</li>
<li class="nav-item">
<a class="nav-link">Console</a>
</li>
<li class="nav-item">
<a class="nav-link">Debug</a>
</li>
<li class="nav-item">
<a class="nav-link">Configuration</a>
</li>
<li class="nav-item">
<a class="nav-link">Examples</a>
</li>
</ul>
<div id="left-area">
<div id="source-tab" style="overflow: auto; max-width: 50em; max-height: 50em;">
<editor-window id="urcl-source"></editor-window>
</div>
</div>
</div>
<div class="col-sm col-pull-5">
<ul id="right-tabs" class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link">Source</a>
</li>
<li class="nav-item">
<a class="nav-link">Build Output</a>
</li>
<li class="nav-item">
<a class="nav-link">Display</a>
</li>
<li class="nav-item">
<a class="nav-link">Console</a>
</li>
<li class="nav-item">
<a class="nav-link">Debug</a>
</li>
<li class="nav-item">
<a class="nav-link">Configuration</a>
</li>
<li class="nav-item">
<a class="nav-link">Examples</a>
</li>
</ul>
<div id="right-area">
<div id="configuration-tab">
<span style="padding-right: 0.5em;">Clock Speed Hz</span><input type="number" id="clock-speed-input"> <output id="clock-speed-output"></output><br>
<span style="padding-right: 0.5em;">Auto Run</span><input type="checkbox" id="auto-run-input" checked> <br>
<div>
<input type="radio" name="jit-radio" id="jit-radio-none" checked>Interpret
<input type="radio" name="jit-radio" id="jit-radio-js">JS JIT
<input type="radio" name="jit-radio" id="jit-radio-wasm">WASM JIT
</div>
<div>
<input type="radio" name="count-radio" id="count-radio-inst" checked>Count instructions
<input type="radio" name="count-radio" id="count-radio-jumps">Count jumps
<input type="radio" name="count-radio" id="count-radio-none">Uninterrupted
</div>
<br>
<span style="padding-right: 0.5em;">Storage File</span><input id="storage-input" type="file"><span id="storage-msg"></span><br>
<span style="padding-right: 0.5em;">Minimum storage size</span><input id="storage-size" type="number" step="1"> words<br>
<span style="padding-right: 0.5em;">Little Endian</span><input id="storage-little" type="checkbox"><br>
<button id="storage-update">Update Storage</button>
<button id="storage-download">Update & Download Storage</button><br>
<span style="padding-right: 0.5em;">URCL -> C</span><input type="checkbox" id="c-out-check">
<pre id="c-out"></pre>
</div>
<div style="display: flex;">
<div id="examples-tab">
<details open>
<summary>Examples</summary>
<ul>
<li><a href="?srcurl=examples/urcl/competition1.urcl">Console game, bare bones</a></li>
<li><a href="?srcurl=examples/urcl/add.urcl">Addition</a></li>
<li><a href="?srcurl=examples/urcl/fib.urcl">Fibonacci Sequence </a></li>
<li><a href="?srcurl=examples/urcl/audio.urcl">Audio Ports</a></li>
<li><a href="?srcurl=examples/urcl/display-io.urcl">Display Ports</a></li>
<li><a href="?srcurl=examples/urcl/gamepad.urcl">Gamepad Port</a></li>
<li><a href="?srcurl=examples/urcl/mouse.urcl">Mouse Port</a></li>
<li><a href="?srcurl=examples/urcl/keyboard.urcl">Key Port by Verlio</a></li>
<li><a href="?srcurl=examples/urcl/sprites.urcl">Ball Sprite</a></li>
<li><a href="?srcurl=examples/urcl/game.urcl">Jumping Square</a></li>
<li><a href="?srcurl=examples/urcl/snake.urcl">Snake</a></li>
<li><a href="?srcurl=examples/urcl/pallet-test.urcl">Pallet Test</a></li>
<li><a href="?srcurl=examples/urcl/line.urcl">Drawing a Line</a></li>
<li><a href="?srcurl=examples/urcl/prime-sieve16.urcl">16 bit prime sieve</a></li>
<li><a href="?srcurl=examples/urcl/prime-sieve32.urcl">32 bit prime sieve</a></li>
<li><a href="?srcurl=examples/urcl/debug.urcl">Debug macro</a></li>
<li><a href="?width=128&height=128&color=RGB12&srcurl=https%3A%2F%2Fraw.githubusercontent.com%2Fstevembuko%2FURCL-renderer%2Fmain%2Frender.urcl">3D renderer by Uwerta</a></li>
<li><a href="?width=128&height=128&color=RGB16&srcurl=https://raw.githubusercontent.com/martandrMC/urcl-projects/main/minesweeper.urcl">Minesweeper by Mart</a></li>
<li><a href="?srcurl=examples/urcl/raycaster.urcl&width=128&height=96&color=Mono">Raycaster by CZdragon</a></li>
<h3 style="margin-bottom: 0.2rem; margin-top: 0.5rem"><a href="pages/competitions/1">competition 1</a> submission:</h3>
<li><a href="?srcurl=examples/urcl/console-flappy.urcl">Flappy Bird</a></li>
<li><a href="?srcurl=https://raw.githubusercontent.com/rickroller314/mycabbages/main/garden.urcl">Garden by GLaDOS</a></li>
<li><a href="?srcurl=https://raw.githubusercontent.com/Terrain2/urcl-comp-1/main/tictactoe-cleaned2.urcl">Tic Tac Toe by Terrain</a></li>
</ul>
</details>
</div>
<div id="build-output-tab">
<pre id="output" style="white-space: pre-wrap;"></pre>
<pre id="debug-output" style="white-space: pre-wrap;"></pre>
</div>
</div>
</div>
<div id="debug-tab">
<h3>Registers</h3>
<pre id="register-view"></pre>
<h3>Memory</h3>
<span style="padding-right: 0.5em;">Auto Update</span><input type="checkbox" id="update-mem-input"> <br>
<buffer-view id="memory-view" style="width: 100%; height: 10vh; resize: vertical;"></buffer-view>
</div>
<div style="display: flex; gap: 2rem;">
<div id="console-tab">
<scroll-out id="stdout" style="width: 100%;"></scroll-out>
<textarea id="stdin" type="text" style="width: 100%;"></textarea>
<br>
<span style="padding-right: 0.5em;">Null Terminate</span><input type="checkbox" id="null-terminate"><br>
<button style="width: 100%;" id="copy-console">Copy Output</button>
</div>
<div id="display-tab">
Color Mode
<select id="color-mode" value="PICO8">
<option value="PICO8">PICO8</option>
<option value="Mono">Mono</option>
<option value="Bin">Bin</option>
<option value="RGB6">RGB6</option>
<option value="RGB8">RGB8</option>
<option value="RGB12">RGB12</option>
<option value="RGB16">RGB16</option>
<option value="RGB24">RGB24</option>
<option value="RGB">RGB</option>
<option value="RGBI">RGBI</option>
</select>
Width <input type="number" id="display-width" value="32">
Height <input type="number" id="display-height" value="32">
<button id="display-fullscreen">Fullscreen</button><br>
<div id="pref-display"></div>
<canvas style="width: 75%; display: block;" width="32" height="32"></canvas>
</div>
</div>
</div>
</main>
<script type="module" src="js/index.js"></script>
</body>
</html>