-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
38 lines (38 loc) · 1.3 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ARM Sim</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="panel">
<button id="step-button">Step</button>
<label for="source" class="btn">Load source: </label>
<input type="file" id="source-input" name="source">
</div>
<div id="error-wrapper"></div>
<div id="code-wrapper"></div>
<div id="status-wrapper"></div>
<script id="asm-code" type="asm">
MOV R1, #255
LDR R0, [R1]
ADD R0, R0, #2
STR R0, [R1]
MOV R0, #5 ; R0 is current number
MOV R1, #0 ; R1 is count of number of iterations
again ADD R1, R1, #1 ; increment number of iterations
ANDS R0, R0, #1 ; test whether R0 is odd
BEQ even
ADD R0, R0, R0, LSL #1 ; if odd, set R0 = R0 + (R0 << 1) + 1
ADD R0, R0, #1 ; and repeat (guaranteed R0 > 1)
B again
even MOV R0, R0, ASR #1 ; if even, set R0 = R0 >> 1
SUBS R7, R0, #1 ; and repeat if R0 != 1
BNE again
halt B halt ; infinite loop to stop computation
</script>
<script type="text/javascript" src="out/production/armsim/lib/kotlin.js"></script>
<script type="text/javascript" src="out/production/armsim/armsim.js"></script>
</body>
</html>