-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
274 lines (219 loc) · 9.26 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
<!DOCTYPE html>
<html>
<head>
<style>
@import url('https://fonts.googleapis.com/css?family=Roboto+Mono');
</style>
<link rel="stylesheet" type="text/css" href="Style.css">
<link rel="stylesheet" type="text/css" href="GUI_Table.css">
<link rel="stylesheet" type="text/css" href="Code_Table.css">
<link rel="stylesheet" type="text/css" href="Stack_Table.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script></script>
<script src="SSBC_Interpreter.js"></script>
<title>Visual SSBC</title>
</head>
<body>
<!-- The Modal -->
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<span class="close">×</span>
<p>This version of the simulator is for SSBC V5 R1</p>
<p>Loading code written for a different SSBC version will likely not work as the op codes will have changed!</p>
<p>Code and stack memory are 1 KB due to web browser limitations. The full SSBC spec has 64KB and the code and stack share the same memory.
The code is loaded into memory at position 0 and the stack is loaded into memory at 65,531. The code pointer increments and the stack pointer decrements.
If enough code and/or stack memory is used the two could overwrite each other during execution.</p>
<p>###SSBC V5 R1 OP CODE SPECIFICATION###</P>
<p>
<table border="1px">
<tr><td>0:NOOP</td></tr>
<tr><td>1:HALT</td></tr>
<tr><td>2:PUSHIMM</td></tr>
<tr><td>3:PUSHEXT</td></tr>
<tr><td>4:POPINH</td></tr>
<tr><td>5:POPEXT</td></tr>
<tr><td>6:JNZ</td></tr>
<tr><td>7:JNN</td></tr>
<tr><td>8:ADD</td></tr>
<tr><td>9:SUB</td></tr>
<tr><td>10:NOR</td></tr>
</table>
</p>
</div>
</div>
<div class="navbar">
<div class="dropdown">
<button class="dropbtn" id="myBtn">SSBC V5</button>
</div>
<div class="dropdown">
<button class="dropbtn">Load Examples
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
<a onclick="loadAdd3()">add3.mac</a>
<a onclick="loadPopins()">popins.mac</a>
<a onclick="loadPushpop()">pushpop.mac</a>
<a onclick="loadSigma5()">sigma5.mac</a>
<a onclick="loadSigma5r()">sigma5r.mac</a>
<a onclick="loadSub3()">sub3.mac</a>
<a onclick="loadRoutine()">routine.mac</a>
</div>
</div>
<div class="dropdown">
<button class="dropbtn">SSBC Info
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
<a href="ssbc-v5-r1.artn" target="_blank" type="text/rtf">SSBC ARTN (Original)</a>
<a href="ssbc-v5-r1-mine.pdf" target="_blank" type="application/pdf">SSBC ARTN (My Version)</a>
<a href="ssbc-fig.pdf" target="_blank" type="application/pdf">Dataflow Diagram</a>
</div>
</div>
<a>Tutorial</a>
<a>About</a>
<div class="dropdown">
<input id="file_in" class="dropbtn" type="file" onchange="readFile(this)"></input>
</div>
</div>
<table border="1px" id = "gui_table" class = "gui" >
<tr id="gui_header">
<td >CONTROLS</td>
<td >STACK</td>
<td >CODE</td>
</tr>
<tr>
<td class = "interface">
<table border="1px" style="width:100%;">
<div style="height:3px"></div>
<div class = "heading">STATE</div>
<tr>
<td>
<button style="width:100%" onclick="reset_interpreter()">Reset</button>
<button style="width:100%" onclick="reload()">Reload</button>
</td>
</tr>
</table>
<table border="1px" style="width:100%;">
<div style="height:3px"></div>
<div class = "heading">EXECUTION</div>
<tr>
<td style="width:50%" >
<button style="width:100%" onclick="step()">Step</button>
</td>
<td style="width:50%" >
<button style="width:50%" onclick="run()">Run</button><button style="width:50%" onclick="stop()">Stop</button>
</td>
</tr>
</table>
<table id="io_table" border="1px" style="width:100%;">
<div style="height:3px"></div>
<div class = "heading">I/O</div>
<tr>
<td>
<button onclick="Set_PSW()">Set PSW</button>
<input type="text" size="10" maxlength="8" id="in_PSW">
</td>
<td><div>PSW</div><div id="psw">-</div></td>
</tr>
<tr>
<td>
</td>
<td><div>PORT A</div><div id="a">-</div></td>
</tr>
<tr>
<td>
<button style="width:100%" onclick="Set_B()">Set B</button>
<input type="text" size="10" maxlength="8" id="in_B" >
</td>
<td><div>PORT B</div><div id="b">-</div></td>
</tr>
<tr>
<td>
</td>
<td>
<div>PORT C</div><div id="c">-</div>
</td>
</tr>
<tr>
<td>
<button onclick="Set_D()">Set D</button>
<input type="text" size="10" maxlength="8" id="in_D">
</td>
<td><div>PORT D</div><div id="d">-</div></td>
</tr>
<tr>
<td>
<button onclick="Set_PC()">Set PC</button>
<input type="text" size="10" maxlength="10" id="in_PC">
</td>
<td><div>PC</div><div id="pc">-</div></td>
</tr>
<tr>
<td>
<div>IR (char)</div>
<div id="irc">-</div>
</td>
<td>
<div>IR</div>
<div id="ir">-</div>
</td>
</tr>
<tr>
<td>
<button onclick="Set_SP()">Set SP</button>
<input type="text" size="10" maxlength="10" id="in_SP">
</td>
<td><div>SP</div><div id="sp">-</div></td>
</tr>
</table>
</td>
<td class="stack" id="stack_td">
<div style="width:100%; height: 100%; overflow-y: auto;">
<table border="1" id="mystack">
<thead>
<tr><th>Line DEC</th><th>Line HEX</th><th>VALUE</th></tr>
</thead>
<tbody>
<!-- fillStack() -->
</tbody>
</table>
</div>
</td>
<td class = "code" id="code_td">
<div style="width:100%; height: 100%; overflow-y: auto;">
<table border="1" id="dataSection">
<thead>
<tr><th>Line DEC</th><th>Line HEX</th><th>VALUE</th><th>COMMENTS</th></tr>
</thead>
<tbody>
<!-- fillCode() -->
</tbody>
</table>
</td>
</tr>
</table>
<script>
// Get the modal
var modal = document.getElementById('myModal');
// Get the button that opens the modal
var btn = document.getElementById("myBtn");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
</body>
</html>