-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
115 lines (104 loc) · 3.32 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
<!DOCTYPE html>
<html>
<head>
<title>Simple Computer Tool</title>
<meta name="description" content="A Simple Computer assembler and simulator." />
<meta name="author" content="Jean-Philippe Ouellet" />
<script type="text/javascript" src="util.js"></script>
<script type="text/javascript" src="settings.js"></script>
<script type="text/javascript" src="cpu.js"></script>
<script type="text/javascript" src="assembler.js"></script>
<script type="text/javascript" src="simulator.js"></script>
<script type="text/javascript" src="main.js"></script>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<h1>Simple Computer Tool</h1>
<p><span>Send feedback to</span> Jean-Philippe Ouellet <a href="mailto:[email protected]"><[email protected]></a></p>
<h2>Code (assembly or bytecode)</h2>
<textarea id="code_in" rows="24" cols="80">
// Comments start with // or #
// Comments may appear on the same line as instructions
//
// Assembly instructions are specified like so:
// MNEMONIC OP[, OP[, OP]]
//
// Bytecode instructions are specified as 4 hex digits
//
// Assembly and bytecode may be mixed at will
// (useful when implementing new instructions)
//
// Values are given in C-style syntax:
// 0xBEEF for base 16
// 1984 for base 10
// \007 for base 8
// with an optional - before the radix specifier
// prefix to denote a negative value.
//
// Additional whitespace is allowed anywhere.
//
// To keep backwards compatibility, values may be prefixed with 'r',
// and opcodes may be lower case.
// Starter source code program for ECE 2504 Spring 2013
// Project 4
//
// Add your header comments (name, date, etc.) here.
//
// Do not change the following segment of code from here
// to the comment "CHANGE HERE" below.
ldi r0, 7
adi r0, r0, 6
jmp r0
// The following set of load instructions
// read the final values of the variables in
// memory locations 2-5 into r1-r5 so that we
// can see them on the LEDs
// Your code must jump to this point after it has
// stored the results in data memory. You should jump
// to location 3.
ldi r1, 2
ld r2, r1
inc r1, r1
ld r3, r1
inc r1, r1
ld r4, r1
inc r1, r1
ld r5, r1
// Now loop forever
ldi r0, 0
// The address of this brz is the one used in validation: Address C.
brz r0, 0
// You are permitted to add code after this point
// CHANGE HERE and beyond
// Your last instruction should be a jump to location 3
// in order to read the variables into registers r2-r5.
ldi r0, 3
jmp r0
</textarea>
<button id="btn_load">Load</button>
<pre id="warnings"></pre>
<h2>(dis)assembler output</h2>
<div id="code_out"></div>
<div id="settings">
<fieldset>
<h3>Offset Radix</h3>
<label><input type="radio" name="radix" value="10" checked />Decimal</label>
<label><input type="radio" name="radix" value="16" />Hexadecimal</label>
</fieldset>
<fieldset>
<h3>Comment Source</h3>
<label><input type="radio" name="source" value="literal" checked />Source code</label>
<label><input type="radio" name="source" value="assembly" />Assembly</label>
</fieldset>
<fieldset id="asm_opts">
<h3>Assembly Format</h3>
<label><input type="checkbox" name="r_prefix" checked />Prefix registers</label>
<label><input type="checkbox" name="align_ops" checked />Align operands</label>
</fieldset>
</div>
<h2>Simulation</h2>
<button id="btn_run">Run</button>
<table id="sim_out">
</table>
</body>
</html>