Cool, now we have a basic calculator. How can we turn this up to eleven and make a computer?


Now that you know what data is, code is easy to explain. It's just data. However, code is different than other data because the CPU interprets code as instructions.

Let's say we wanted the computer to do math, we could come up with a system like;

instruction code
"add a number to another number"    00000001
"subtract a number from another number"    00000010

Then, we could build a machine with logic gates so that these inputs would cause adders or subtractors to be used.

Now, real quick, memory is organized in a computer by something called memory addresses, which basically allow the CPU to ask for memory at a certain location. Generally speaking the addresses are sized by "bytes" which is just another word for "eight bits". So if we wanted to access memory location five or whatever we could store that as '00000101'.
Lets go back and add some more to our table:

"move this data into some location"    00000011

Now we can say something like:

  "add the number at location #5 in memory to the other number at
  location #7 in memory."

By breaking it down into:

  (add) (memory address #5) (memory address #7)

Which is really just:

  00000001 00000101 00000111

<left 6/8 next>

source code - donate - contact