forked from r0nk/simplecpu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InstructionPointer.html
50 lines (48 loc) · 1.75 KB
/
InstructionPointer.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
<!DOCTYPE html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<html>
<body>
<div class="wrap">
<ul>
<li><a href="Binary.html"><b>SimpleCPU.com</b></a> </li>
<li><a href="about.html">about</a></li>
</ul><br>
<div class="content">
But how does the CPU know where to get its instructions?<br>
<br>
On the CPU, there is a tiny amount of memory. It does various things, such as<br>
hold something called the "instruction pointer". The instruction pointer <br>
holds the location of the next instruction, and increments itself after <br>
every instruction. So basically, the CPU reads the instruction pointer,<br>
fetches the next instruction, does it, increments the instruction pointer<br>
and then goes back to step one.<br>
<br>
The value of the instruction pointer itself can be set to some arbitrary <br>
location in memory. You ever wonder what an infinite loop is on a computer?<br> It's what happens when an instruction pointer is set to instructions that <br>
keep telling the instruction pointer to set itself to that same set of <br>
instructions.<br>
<br>
<div class="center">
<a href="code.html">
<img src="Left.png" alt="<left" style="width:50px;height:80px;" align="middle">
</a>
7/8
<a href="cpu.html">
<img src="Right.png" alt="next>" style="width:50px;height:80px;" align="middle">
</a>
</div>
<br>
</div>
</div>
<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>
</body>
</html>