-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathindex.html
396 lines (379 loc) · 17.9 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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
<!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">
<meta name="description" content="Web-based simulator for the LC-3 (Little Computer 3)">
<meta name="author" content="William Chargin">
<title>LC-3 Simulator</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/styles.css" rel="stylesheet">
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-53956520-3', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<!-- Don't really need a navbar for a one-page site...but it's here in case we add more stuff later. -->
<nav class="navbar navbar-inverse navbar-static-top">
<div class="container">
<!-- This is the hamburger icon for mobile, but we don't have any links. -->
<!--
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
-->
<span class="navbar-brand">LC-3 Simulator</span>
</div>
</nav>
<div class="container" id="container-wait">
<div class="row">
<div class="col-md-12">
<div class="alert alert-info" role="alert" id="wait-alert">
<strong>Initializing</strong> the LC-3.
Please wait…
</div>
</div>
</div>
</div>
<div class="container" id="container-main" style="display: none;">
<div class="row">
<div class="col-md-6">
<h1>Memory</h1>
<div class="alert alert-danger hidden-alert" role="alert" id="error-address-invalid">
<strong>Whoops!</strong>
That memory address is <strong>invalid</strong>.
Hexadecimal addresses must begin with the letter <span class="hex-value hex-no-tooltip">x</span>.
All other addresses must be decimal.
If you're entering a label, make sure your capitalization is correct.
</div>
<div class="alert alert-danger hidden-alert" role="alert" id="error-address-bounds">
<strong>Whoops!</strong>
The memory address you've entered is <strong>out of bounds</strong>.
Memory addresses must be within <span class="hex-value">x0000</span> and <span class="hex-value hex-signed">xFFFF</span>, inclusive.
</div>
<div class="panel panel-default">
<div class="panel-heading">
<div class="input-group" id="mem-jumpto-group">
<span class="input-group-btn"><button class="btn btn-default" id="mem-jumpto-activate"><span class="glyphicon glyphicon-search"></span></button></span>
<input type="text" id="mem-jumpto" class="form-control" placeholder="Jump to address or label">
<span class="input-group-btn"><button class="btn btn-default" id="manage-labels-button"><span>Manage Labels</span></button></span>
</div>
</div>
<table class="table table-hover" id="memory-table">
<thead>
<tr>
<th><!-- for dropdown menu button --></th>
<th>0x</th>
<th>Label</th>
<th>Hex</th>
<th>Instruction</th>
</tr>
</thead>
<tbody></tbody>
</table>
<div class="panel-footer">
<div class="row" id="scroll-container">
<div class="col-xs-12 col-sm-6">
<div class="btn-group" role="group">
<button type="button" class="btn btn-default" id="mem-scroll-up"><span class="glyphicon glyphicon-chevron-up"></span></button>
<button type="button" class="btn btn-default" id="mem-scroll-down"><span class="glyphicon glyphicon-chevron-down"></span></button>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-default" id="mem-jump-pc">Jump to PC</button>
</div>
</div>
<div class="col-xs-12 col-sm-6">
<button class="btn btn-default" type="button" id="mem-upload-object"><span class="glyphicon glyphicon-upload"></span></button>
<button class="btn btn-default" type="button" id="mem-assemble">Assemble</button>
<button class="btn btn-default" type="button" id="mem-raw">Raw</button>
</div>
</div>
</div></div>
</div>
<div class="col-md-6">
<h1>Status</h1>
<div class="panel panel-default" id="register-panel">
<div class="panel-heading"><h3 class="panel-title">Registers</h3></div>
<div class="panel-body">
<div class="row register-row" id="registers-primary">
<!-- added dynamically -->
</div>
<div class="row"><div class="col-xs-0"></div></div>
<div class="row register-row" id="registers-special">
<!-- added dynamically -->
</div>
<div class="row">
<div id="register-reset-buttons" class="col-xs-12">
<div class="btn-group" role="group">
<button type="button" class="btn btn-default dyndis disabled-running disabled-halted" id="reset-numeric">Clear R0–R7</button>
<button type="button" class="btn btn-default dyndis disabled-running disabled-halted" id="reset-registers">Reset all registers</button>
</div>
</div>
</div>
</div>
</div>
<div class="text-center" id="control-buttons">
<div class="btn-group" role="group">
<button type="button" class="btn btn-default dyndis disabled-running disabled-halted" id="control-step" title="Execute the next instruction, entering a subroutine if necessary">Step</button>
<button type="button" class="btn btn-default dyndis disabled-running disabled-halted" id="control-next" title="Fully execute the next instruction or subroutine">Next</button>
<button type="button" class="btn btn-default dyndis disabled-running disabled-halted" id="control-finish" title="Finish execution of the current subroutine">Finish</button>
<button type="button" class="btn btn-default dyndis disabled-running disabled-halted" id="control-run" title="Run indefinitely">Run</button>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-default dyndis disabled-paused disabled-halted" id="control-pause" title="Pause execution" disabled="disabled">Pause</button>
<button type="button" class="btn btn-default dyndis disabled-running disabled-halted" id="control-continue" title="Continue execution after being paused">Continue</button>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-default dyndis disabled-unhalted" id="control-unhalt" title="Restart the machine after a HALT">Unhalt</button>
</div>
<div class="checkbox">
<label><input type="checkbox" id="follow-pc" checked="checked">Follow PC</label>
</div>
</div>
<div class="alert alert-danger hidden-alert exception" data-exception="privilege">
<strong>Privilege mode exception!</strong>
An RTI instruction was executed while in user mode.
The machine has been halted.
</div>
<div class="alert alert-danger hidden-alert exception" data-exception="opcode">
<strong>Illegal opcode exception!</strong>
The reserved instruction was executed.
The machine has been halted.
</div>
</div>
<div class="col-md-6">
<h1>Console</h1>
<pre class="pre-scrollable" id="console-contents" tabindex="0"></pre>
<div class="text-center">
<div class="btn-group" role="group">
<button type="button" class="btn btn-default" id="btn-clear-in">Clear Input Buffer (<span id="buffered-char-count"></span> <span id="buffered-char-noun"></span>)</button>
<button type="button" class="btn btn-default" id="btn-clear-out">Clear Output</button>
</div>
</div>
<div class="form-group" id="newline-select">
<div class="radio">
<label><input type="radio" name="newline" data-newline="0a" id="newline-0a" checked="checked">Newline as <span class="hex-value">0x0A</span></label>
</div>
<div class="radio">
<label><input type="radio" name="newline" data-newline="0d" id="newline-0d">Newline as <span class="hex-value">0x0D</span></label>
</div>
<div class="radio">
<label><input type="radio" name="newline" data-newline="binary" id="newline-binary">Binary (leave newlines unchanged)</label>
</div>
</div>
</div>
</div>
</div>
<!-- Modal window for managing labels -->
<div class="modal fade" id="label-manager">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Manage labels</h4>
</div>
<div class="modal-body">
<p>The following labels, including system labels, are currently set:</p>
<table id="labels-table" class="table">
<thead>
<tr><th>Label name</th><th>Address</th><th>Delete</th></tr>
</thead>
<tbody>
<tr id="new-label-row">
<td>
<div class="has-feedback">
<input type="text" class="label-name form-control" placeholder="Type to create a new label" autofocus>
<span class="glyphicon glyphicon-remove form-control-feedback error-feedback name-error"></span>
</div>
<ul class="error-list">
<li class="name-empty">Name cannot be empty</li>
<li class="name-conflict">Label name already exists</li>
<li class="name-invalid">Label name invalid</li>
</ul>
</td>
<td>
<div class="has-feedback">
<input type="text" class="label-address form-control hex-value hex-no-tooltip">
<span class="glyphicon glyphicon-remove form-control-feedback error-feedback address-error"></span>
</div>
<ul class="error-list">
<li class="address-invalid">Invalid address</li>
<li class="address-conflict">Address already has label</li>
</ul>
</td>
<td><button role="button" class="btn btn-danger" tabindex="-1"><span class="glyphicon glyphicon-remove"></span></button></td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Done</button>
</div>
</div>
</div>
</div>
<!-- Modal to load with object file -->
<div class="modal fade" id="load-object">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Upload files</h4>
</div>
<div class="modal-body">
<p>
Upload <strong>object files (.obj)</strong> and <strong>symbol files (.sym)</strong> by dragging them onto the box below.
You can upload multiple files at once.
</p>
<p>
You must convert any ASCII binary (.bin) or hexadecimal (.hex) files, and assemble any assembly language (.asm) programs, before uploading.
</p>
<div class="drop-box">
<span>Drop files here</span>
</div>
<div class="alert alert-warning" id="invalid-alert">
<strong>Hold on!</strong>
The following <span id="warning-file-noun"></span> couldn't be recognized and <strong>won't be processed</strong>:
<ul id="invalid-files">
</ul>
<div class="btn-toolbar alert-buttons" role="toolbar">
<button class="btn btn-default" id="invalid-open-assembler">Open Assembler</button>
<button class="btn btn-default" id="invalid-dismiss">Dismiss</button>
</div>
</div>
<div class="alert alert-success" id="confirm-alert">
The following <span id="success-file-noun"></span> <span id="success-file-verb"></span> <strong>ready to be processed</strong>:
<ul id="success-files">
</ul>
<div class="btn-toolbar alert-buttons" role="toolbar">
<button class="btn btn-primary" id="success-confirm">Process Files</button>
</div>
</div>
<div id="upload-in-progress">
<div class="progress">
<div class="progress-bar" role="progressbar" style="width: 100%;">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
<!-- Modal for assembling -->
<div class="modal fade" id="assemble-modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Assemble</h4>
</div>
<div class="modal-body">
<p>
<strong>Paste</strong> your assembly code below, or <strong>drop a file</strong> on the textbox.
Click the <strong>Assemble</strong> button to assemble your code.
</p>
<div id="assembly-input-container">
<textarea class="form-control" rows="16" id="assembly-input"></textarea>
<div id="release-message">
<span>Drop file to load contents</span>
</div>
</div>
<div class="alert alert-danger">
<strong>Oh no!</strong>
You've got <span id="assembly-error-noun"></span> in your assembly code:
<ul id="assembly-errors">
</ul>
</div>
<div class="alert alert-success">
<strong>Awesome!</strong>
Your code was assembled successfully.
You can load your program directly into the simulator, or download the output object file and symbol table.
<div class="alert-buttons" role="toolbar">
<div class="btn-group" role="group">
<button class="btn btn-default" id="btn-download-symbol">Download Symbol Table</button>
<button class="btn btn-default" id="btn-download-object">Download Object File</button>
</div>
<div class="btn-group" role="group">
<button class="btn btn-primary" id="btn-assembly-load">Load into Simulator</button>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-default" id="btn-assemble">Assemble</button>
</div>
</div>
</div>
</div>
<!-- Modal for writing raw hex/bin code -->
<div class="modal fade" id="raw-modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Write raw hex or binary</h4>
</div>
<div class="modal-body">
<p>
<strong>Paste</strong> your hex or binary code below, or <strong>drop a file</strong> on the textbox.
Click the <strong>Process</strong> button to process your instructions so that you can download an OBJ file or load them directly into the interpreter.
</p>
<div id="raw-input-container">
<textarea class="form-control" rows="16" id="raw-input"></textarea>
<div id="raw-release-message">
<span>Drop file to load contents</span>
</div>
</div>
<div class="alert alert-danger">
<strong>Oh no!</strong> <span id="raw-error"></span>
</div>
<div class="alert alert-success">
<strong>Awesome!</strong>
Your code was processed successfully.
You can load your program directly into the simulator, or download the output object file.
<div class="alert-buttons" role="toolbar">
<div class="btn-group" role="group">
<button class="btn btn-default" id="btn-download-raw-object">Download Object File</button>
</div>
<div class="btn-group" role="group">
<button class="btn btn-primary" id="btn-raw-load">Load into Simulator</button>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-default" id="btn-process-raw">Process</button>
</div>
</div>
</div>
</div>
<footer></footer>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> -->
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/Queue.js"></script>
<script src="js/lc3_util.js"></script>
<script src="js/lc3_os.js"></script>
<script src="js/lc3_core.js"></script>
<script src="js/lc3_as.js"></script>
<script src="js/lc3_hexbin.js"></script>
<script src="js/lc3_ui.js"></script>
</body>
</html>