2. Machine code
A CPU can only process binary data, this includes the program instructions themselves.
Therefore a typical instruction will look like this inside the CPU:
|Typical Binary instruction|
This is definitely not a person-friendly format. We cannot easily see what this instruction is saying.
But we can improve readability slightly by representing is as a hexadecimal number, like this
01011011 is 5B Hex
If you have read the section on binary and hexadecimal numbers (here), then you will know that a binary number is usually presented to users in hex format.
An instruction that can run inside a CPU is called machine code and is in binary
If you think of a CPU as a machine, then it should be no surprise that these instructions are called machine code.
Each type of CPU uses different binary numbers to represent particular instructions, so the machine code written for one type of CPU will not run on another type of CPU. It will have to be re-written first.
Programming in pure machine code is very difficult and time consuming. And so the CPU engineers offer programmers a slightly more person-friendly way of coding called assembly language.
This is discussed on the next page.
Challenge see if you can find out one extra fact on this topic that we haven't already told you
Click on this link: What is machine code