-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
218 lines (213 loc) · 10.7 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
<!DOCTYPE html>
<html>
<head>
<title>ARM Editor Online</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/style.css">
<script src="js/ace/ace.js" type="text/javaScript" charset="utf-8"></script>
<script src="js/ace/theme-cobalt.js" type="text/javascript" charset="utf-8"></script>
<script src="js/ace/mode-assembly_arm.js" type="text/javascript" charset="utf-8"></script>
</head>
<body id="body_">
<center>
<h1 id="header"># ARM Editor Online #</h1>
<table>
<tr>
<td>
<div id="regView" class="hide">
<input id="bin" type="radio" name="representation" value="bin" onclick="changeBase(2);"/> bin
<input id="dec" type="radio" name="representation" value="dec" onclick="changeBase(10);" checked="checked" /> dec
<input id="hex" type="radio" name="representation" value="hex" onclick="changeBase(16);"/> hex <br>
<br>
<b>Registers View</b> <br>
>> <i>General Purpose</i>
<table>
<tr>
<td>r0</td>
<td><input class="regVal" id="r0" type="text" name="r0" value="0" onchange="changeRegVal('r0');"/></td>
</tr>
<tr>
<td>r1</td>
<td><input class="regVal" id="r1" type="text" name="r1" value="0" onchange="changeRegVal('r1');"/></td>
</tr>
<tr>
<td>r2</td>
<td><input class="regVal" id="r2" type="text" name="r2" value="0" onchange="changeRegVal('r2');"/></td>
</tr>
<tr>
<td>r3</td>
<td><input class="regVal" id="r3" type="text" name="r3" value="0" onchange="changeRegVal('r3');"/></td>
</tr>
<tr>
<td>r4</td>
<td><input class="regVal" id="r4" type="text" name="r4" value="0" onchange="changeRegVal('r4');"/></td>
</tr>
<tr>
<td>r5</td>
<td><input class="regVal" id="r5" type="text" name="r5" value="0" onchange="changeRegVal('r5');"/></td>
</tr>
<tr>
<td>r6</td>
<td><input class="regVal" id="r6" type="text" name="r6" value="0" onchange="changeRegVal('r6');"/></td>
</tr>
<tr>
<td>r7</td>
<td><input class="regVal" id="r7" type="text" name="r7" value="0" onchange="changeRegVal('r7');"/></td>
</tr>
<tr>
<td>r8</td>
<td><input class="regVal" id="r8" type="text" name="r8" value="0" onchange="changeRegVal('r8');"/></td>
</tr>
<tr>
<td>r9</td>
<td><input class="regVal" id="r9" type="text" name="r9" value="0" onchange="changeRegVal('r9');"/></td>
</tr>
<tr>
<td>r10 (sl)</td>
<td><input class="regVal" id="r10" type="text" name="r10" value="0" onchange="changeRegVal('r10');"/></td>
</tr>
<tr>
<td>r11 (fp)</td>
<td><input class="regVal" id="r11" type="text" name="r11" value="0" onchange="changeRegVal('r11');"/></td>
</tr>
<tr>
<td>r12 (ip)</td>
<td><input class="regVal" id="r12" type="text" name="r12" value="0" onchange="changeRegVal('r12');"/></td>
</tr>
<tr>
<td>r13 (sp)</td>
<td><input class="regVal" id="r13" type="text" name="r13" value="0" onchange="changeRegVal('r13');"/></td>
</tr>
<tr>
<td>r14 (lr)</td>
<td><input class="regVal" id="r14" type="text" name="r14" value="0" onchange="changeRegVal('r14');"/></td>
</tr>
<tr>
<td>r15 (pc)</td>
<td><input class="regVal" id="r15" type="text" name="r15" value="0" onchange="changeRegVal('r15');"/></td>
</tr>
</table>
<div>>> <i>Current Program Status</i></div>
<table>
<tr>
<td>Negative (N)</td>
<td><input class="regVal" id="n" type="text" name="n" value="0" disabled="disabled"/></td>
</tr>
<tr>
<td>Zero (Z)</td>
<td><input class="regVal" id="z" type="text" name="z" value="0" disabled="disabled"/></td>
</tr>
<tr>
<td>Carry (C)</td>
<td><input class="regVal" id="c" type="text" name="c" value="0" disabled="disabled"/></td>
</tr>
<tr>
<td>Overflow (V)</td>
<td><input class="regVal" id="v" type="text" name="v" value="0" disabled="disabled"/></td>
</tr>
</table>
</div>
</td>
<td id="editorPanel">
Enter your source code below or browse a file to load <br>
<div id="editor">
# ARM program to print "Hello World!"
# *************** instruction memory
.text
.global main
main:
# store(push) lr to the stack
sub sp, sp, #4
str lr, [sp, #0]
# your code here
ldr r0, =hello
bl printf
# retrive(pop) lr from the stack
ldr lr, [sp, #0]
add sp, sp, #4
# return
mov pc, lr
# *************** data memory
.data
hello: .asciz "Hello World!\n"
</div>
<br>
<div>
<div style="float: left;">
<input type="file" id="fileToLoad">
<button onclick="loadFileAsText()">Load</button>
</div>
<div style="float: right;">
<button onclick="editor.setValue('');">
<img src="image/cl.png" alt="Clear"/></button>
<button onclick="saveTextAsFile()">
<img src="image/dl.png" alt="Download"/></button>
</div>
</div>
<br>
</td>
<td>
<div id="dashboard">
<div class="hide">
<div id="editorLineNum"></div>
<div id="stepInLine"></div>
<div id="ic"></div>
<div id="instruct"></div>
<br>
<div id="lable"></div>
<div id="data"></div>
<br>
<b>Instruction Memory</b>
<table border="1">
<thead>
<tr>
<th>Address</th>
<th>Instruction</th>
</tr>
</thead>
<tbody id="instructTBody">
</tbody>
</table>
<b>Data Memory</b>
<table border="1">
<thead>
<tr>
<th>Address</th>
<th>Data</th>
</tr>
</thead>
<tbody id="dataTBody">
</tbody>
</table>
</div>
<div>
<button onclick="simulate()">
<img src="image/ex.png" alt="Simulate"/></button>
<button onclick="assemble()">Assemble</button>
<button id="stepIn" onclick="stepIn()" disabled="disabled" class="hide">Step In</button>
</div>
Input (stdin)<br>
<textarea id="stdin_" name ="stdin" placeholder="your inputs here"></textarea><br>
Output (stdout)<br>
<textarea id="stdout_" name="stdout" placeholder="your output here"></textarea>
</div>
</td>
</tr>
</table>
</center>
<script>
var editor = ace.edit("editor");
var assembly_armMode = require("ace/mode/assembly_arm").Mode;
editor.getSession().setMode(new assembly_armMode());
</script>
<!--script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="js/arm-sim.min.js" type="text/javascript" charset="utf-8"></script-->
<script src="js/jquery-1.11.1.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/HashTable.js" type="text/javascript" charset="utf-8"></script>
<script src="js/controller.js" type="text/javascript" charset="utf-8"></script>
<script src="js/arm-sim.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
disableRegVals();
$(".hide").hide();
</script>
</body>
</html>