-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
289 lines (285 loc) · 9.54 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>CHIP-8 Compiler</title>
<link href="css/bulma.min.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<section class="section">
<div class="container">
<h1 class="title">CHIP-8 Compiler</h1>
<h2 class="subtitle">Onur Cinar</h2>
</div>
</section>
<div class="container">
<div id="notification" class="notification">
<button class="delete"></button>
<span class="content"></span>
</div>
<div class="columns">
<div class="column">
<div class="buttons">
<button id="compile" class="button is-outlined is-info">Compile</button>
<button id="save" class="button is-outlined is-info">Save</button>
</div>
<div id="tabs1" class="tabs">
<ul>
<li><a data-target="code">Code</a></li>
<li><a data-target="help">Help</a></li>
</ul>
</div>
<div id="code" class="box">
<div id="editor" class="is-family-code" contenteditable="true" spellcheck="false">
<div>LD V0 0x00</div>
<div>LD V1 0x16</div>
<div>LD V2 0x0E</div>
<div></div>
<div>run:</div>
<div> LD F V0</div>
<div> CLS</div>
<div> DRW V1 V2 0x05</div>
<div> ADD V0 0x01</div>
<div> SE V0 0x0A</div>
<div> JP run</div>
<div>done:</div>
<div> JP done</div>
</div>
</div>
<div id="help" class="box">
<table class="table">
<thead>
<tr>
<th>Opcode</th>
<th>Instruction</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>0nnn</td>
<td>SYS addr</td>
<td>Jump to a machine code routine at nnn.</td>
</tr>
<tr>
<td>00E0</td>
<td>CLS</td>
<td>Clear the display.</td>
</tr>
<tr>
<td>00EE</td>
<td>RET</td>
<td>Return from a subroutine.</td>
</tr>
<tr>
<td>1nnn</td>
<td>JP addr</td>
<td>Jump to location nnn.</td>
</tr>
<tr>
<td>2nnn</td>
<td>CALL addr</td>
<td>Call subroutine at nnn.</td>
</tr>
<tr>
<td>3xkk</td>
<td>SE Vx, byte</td>
<td>Skip next instruction if Vx = kk.</td>
</tr>
<tr>
<td>4xkk</td>
<td>SNE Vx, byte</td>
<td>Skip next instruction if Vx != kk.</td>
</tr>
<tr>
<td>5xy0</td>
<td>SE Vx, Vy</td>
<td>Skip next instruction if Vx = Vy.</td>
</tr>
<tr>
<td>6xkk</td>
<td>LD Vx, byte</td>
<td>Set Vx = kk.</td>
</tr>
<tr>
<td>7xkk</td>
<td>ADD Vx, byte</td>
<td>Set Vx = Vx + kk.</td>
</tr>
<tr>
<td>8xy0</td>
<td>LD Vx, Vy</td>
<td>Set Vx = Vy.</td>
</tr>
<tr>
<td>8xy1</td>
<td>OR Vx, Vy</td>
<td>Set Vx = Vx OR Vy.</td>
</tr>
<tr>
<td>8xy2</td>
<td>AND Vx, Vy</td>
<td>Set Vx = Vx AND Vy.</td>
</tr>
<tr>
<td>8xy3</td>
<td>XOR Vx, Vy</td>
<td>Set Vx = Vx XOR Vy.</td>
</tr>
<tr>
<td>8xy4</td>
<td>ADD Vx, Vy</td>
<td>Set Vx = Vx + Vy, set VF = carry.</td>
</tr>
<tr>
<td>8xy5</td>
<td>SUB Vx, Vy</td>
<td>Set Vx = Vx - Vy, set VF = NOT borrow.</td>
</tr>
<tr>
<td>8xy6</td>
<td>SHR Vx Vy</td>
<td>Set Vx = Vx SHR 1.</td>
</tr>
<tr>
<td>8xy7</td>
<td>SUBN Vx, Vy</td>
<td>Set Vx = Vy - Vx, set VF = NOT borrow.</td>
</tr>
<tr>
<td>8xyE</td>
<td>SHL Vx Vy</td>
<td>Set Vx = Vx SHL 1.</td>
</tr>
<tr>
<td>9xy0</td>
<td>SNE Vx, Vy</td>
<td>Skip next instruction if Vx != Vy.</td>
</tr>
<tr>
<td>Annn</td>
<td>LD I, addr</td>
<td>Set I = nnn.</td>
</tr>
<tr>
<td>Bnnn</td>
<td>JP V0, addr</td>
<td>Jump to location nnn + V0.</td>
</tr>
<tr>
<td>Cxkk</td>
<td>RND Vx, byte</td>
<td>Set Vx = random byte AND kk.</td>
</tr>
<tr>
<td>Dxyn</td>
<td>DRW Vx, Vy, nibble</td>
<td>Display n-byte sprite starting at memory location I at (Vx, Vy), set VF = collision.</td>
</tr>
<tr>
<td>Ex9E</td>
<td>SKP Vx</td>
<td>Skip next instruction if key with the value of Vx is pressed.</td>
</tr>
<tr>
<td>ExA1</td>
<td>SKNP Vx</td>
<td>Skip next instruction if key with the value of Vx is not pressed.</td>
</tr>
<tr>
<td>Fx07</td>
<td>LD Vx, DT</td>
<td>Set Vx = delay timer value.</td>
</tr>
<tr>
<td>Fx0A</td>
<td>LD Vx, K</td>
<td>Wait for a key press, store the value of the key in Vx.</td>
</tr>
<tr>
<td>Fx15</td>
<td>LD DT, Vx</td>
<td>Set delay timer = Vx.</td>
</tr>
<tr>
<td>Fx18</td>
<td>LD ST, Vx</td>
<td>Set sound timer = Vx.</td>
</tr>
<tr>
<td>Fx1E</td>
<td>ADD I, Vx</td>
<td>Set I = I + Vx.</td>
</tr>
<tr>
<td>Fx29</td>
<td>LD F, Vx</td>
<td>Set I = location of sprite for digit Vx.</td>
</tr>
<tr>
<td>Fx33</td>
<td>LD B, Vx</td>
<td>Store BCD representation of Vx in memory locations I, I+1, and I+2.</td>
</tr>
<tr>
<td>Fx55</td>
<td>LD I, Vx</td>
<td>Store registers V0 through Vx in memory starting at location I.</td>
</tr>
<tr>
<td>Fx65</td>
<td>LD Vx, I</td>
<td>Read registers V0 through Vx from memory starting at location I.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="column">
<div class="buttons">
<button id="start" class="button is-outlined is-success">Start</button>
<button id="step" class="button is-outlined is-warning">Step</button>
<button id="stop" class="button is-outlined is-danger">Stop</a>
<button id="reset" class="button is-outlined is-danger">Reset</button>
</div>
<div id="tabs2" class="tabs">
<ul>
<li><a data-target="display-keyboard-instructions">Display</a></li>
<li><a data-target="registers-memory">Registers/Memory</a></li>
</ul>
</div>
<div id="display-keyboard-instructions" class="box">
<div id="display">
</div>
<div class="columns">
<div class="column">
<div id="keyboard">
</div>
</div>
<div class="column">
<div id="instructions">
</div>
</div>
</div>
</div>
<div id="registers-memory" class="box">
<div id="registers">
</div>
<div id="memory">
</div>
</div>
</div>
</div>
<div class="has-text-centered">
Source code can be found at
<a href="https://repl.it/@onurcinar/Chip8CompilerJS" target="_blank">Repl.it</a>
and
<a href="https://github.com/cinar/Chip8CompilerJS" target="_blank">GitHub</a>
.
</div>
</div>
<script src="js/script.js" type="module"></script>
</body>
</html>