-
Notifications
You must be signed in to change notification settings - Fork 35
/
cpu.html
71 lines (69 loc) · 2.49 KB
/
cpu.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
<!DOCTYPE html>
<head>
<link rel="stylesheet" type="text/css" href="styles/style.css">
</head>
<html>
<body>
<div class="wrap">
<ul>
<li><a href="Binary.html"><b>SimpleCPU.com</b></a> </li>
</ul><br>
<div class="content">
Here is a (relatively) simple CPU for you to play with;<br>
</div>
<canvas id="cpu" width="550" height="320"></canvas><br>
<div class="content">
To modify memory, simply click on the bits while the cpu is off. You can scroll through memory as well. To start executing instructions, turn the cpu switch on.<br>
<br>
This cpu has three different instructions:<br>
<table>
<tr>
<td><b>Instruction</b></td>
<td></td>
<td><b>Code</b></td>
<tr>
<td><i>add the value at the address held at (Instruction Pointer + 1)<br>
to the value at the address held at (Instruction Pointer + 2)</i></td>
<td> </td>
<td>00000001</td>
</tr>
<tr>
<td><i>subtract the value at the address held at (Instruction Pointer + 2)<br>
from the value at the address held at (Instruction Pointer + 1)</i></td>
<td> </td>
<td>00000010</td>
</tr>
<tr>
<td><i>move the value at the address held at (Instruction Pointer + 1)<br>
to the value at the address held at (Instruction Pointer + 2)</i></td>
<td> </td>
<td>00000011</td>
</tr>
</table>
<br>
All of the instructions have a size of 3 bytes (operands included).This means that we increment the instruction pointer by 3 after each instruction is executed.<br>
<br>
The instruction pointer can be accessed by addressing memory location 00000000.
<br>
<br>
<div class="center">
<a href="InstructionPointer.html">
<img src="images/Left.png" alt="<left" style="width:50px;height:80px;" align="middle">
</a>
8/8
</div>
<br>
</div>
</div>
<script src="scripts/cpu.js"></script>
<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-55886101-1', 'auto');
ga('send', 'pageview');
</script>
<font size=2><a href="https://www.github.com/r0nk/simplecpu">source code</a> - <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=AVU3S9FB4BMCY&lc=US&item_name=Simple%20CPU¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted">donate</a> - <a href="mailto:[email protected]">contact</a></font>
</body>
</html>