When you tell a computer to do something, you are actually giving it a set on instructions. From the eyes of the CPU, these instructions cannot even be slightly ambiguous. As you may or may not know, computers use something called binary to store, transfer, and alter data.
What is binary? More than just a string of ones and zeros, binary represents fundamentally something either existing or not i.e. true or false. This system of counting is called base 2, it is much simpler than the counting system we use, base 10. Here is a list of the first 10 numbers in binary.
- 0 = 0000
- 1 = 0001
- 2 = 0010
- 3 = 0011
- 4 = 0100
- 5 = 0101
- 6 = 0110
- 7 = 0111
- 8 = 1000
- 9 = 1001
In practical everyday use, a base two system has very little use. But to a computer, it is very useful, as it can easily assign value to anything using only two physical states, on or off. Obviously the base 10 system of counting is better to us, but is it really the best? Other types of counting systems include hexadecimal (base 16 counting system popular in memory chips), and there is even a small but growing group of people who believe counting in base 12 is the most advantageous.
Assembly language the instructions to the computer, telling the processor where to put data or alter data. Unfortunately, this is very specific to each type of device, and extremely unreadable to people. When programmers write code, it obviously can not be in assembly because they would want it to work on more than one specific device. That is where the compiler comes in. A compiler, which is a type of program in itself, literally serves as a translator as it trans-codes a source language to an object language (think of the object language as the binary counterpart of the English based programming language).
Thanks for reading this weeks post on binary and assembly language, I hope you come back next week where I will discuss an extremely common programming language called C!