If you think that a computer understands when you tell copy, paste or delete, you are wrong. Believe it or not, computer understands only two numbers. All programming languages, no matter how advanced they are, in its realization process comes down to two numbers - within machine language.
Most computer programs today are written in higher-level languages or eventually in assembly language. This code is automatically translated to executable machine code, through the necessary utilities such as compilers and linkers.
Therefore, computer languages are classified into three basic types:
- machine languages,
- assembly languages,
- and so-called higher-level languages.
And now there's a story about the machine language.
Machine language
A machine language is defined by the operation codes and format of the machine instructions of the computer, whereas an assembly language is a symbolic representation of a given machine language. Higher-level languages evolved to overcome the inherent difficulties of machine or assembly language programming, which require a large amount of code. In addition, the machine language is very difficult to read.
A program comprises a well-ordered set of instructions to the computer directing it to perform certain operations. The program is expressed by letters, numbers, and symbols according to a well-defined set of rules. The set of alphanumeric symbols and the rules combine to form the syntax of a programming language. A machine language is a language specified by the computer itself.
A machine instruction contains two basic parts: (1) an operation to be performed and (2) the specification of one or more operands, such as machine locations, registers, channels, or input/output devices, upon which the operation will take place. The operation is specified by a numeric code called the operation or “op“ code. An example of an instruction is a directive to add the contents of a machine location and a register location. The operation code is the numeric code for the addition operation, and the operands are the addresses of the register and the memory location. The operands are thus numbers indicating the addresses of computer location, an address of a register, or a particular input/output device.
Since the computer deals only with binary numbers, the machine instructions must be expressed numerically, using only the digits 0 and 1.
My programming professor was always speaking: Computer is a stupid device that understands only two things, (electricity) and (no electricity).
However, because binary mumbers are cumbersome, almost impossible for humans to remember, and tedious to write, and because of the relationship between octal and binary numbers, machine-language coding is done using octal or hexadecimal numbers.
The precise format of machine instructions to be given depends on the make and model of the computer. It is not, basically, modifiable by the programmer. The exception to this statement is in microprogramming, where the set of basic machine instructions can be specified by the user with the aid of the manufacturer. Microprogramming is a feature frequently available in minicomputers. This capability permits a sequence of instructions to be defined for each basic machine instruction. The execution of a microprogrammed machine instruction then automatically causes the execution of several individual (or micro) instructions.
It is important to note that the interpretaion of a machine-language program is a direct function of the computer hardware.
Now I want to introduce you with binary numbers, as a fundamental basis of machine language. So let's start.
A little binary mathematics
Here are some fundamental rules for binary mathematical operations.
Addition of binary numbers is performed in a manner similar to adding decimal numbers. Follow these rules:
- Zero plus zero equals zero (0+0=0)
- Zero plus one equals one (0+1=1)
- One plus zero equals one (1+0=1)
- One plus one equals zero with one to carry (1+1=10)
The following is an example of binary addition. The result is given bolow with the decimal equivalent to the right.
The resulting binary number, 1010, is the sum.
Explanation:
1+1. The sum is greater than 1 and the answer is 0 with 1 to carry.
1+1+1. This results in 1 with 1 to carry
1+1. Again, 0 is below the line and 1 is carried.
1+0. The answer is 1.
Machine code
Well, machine code looks like this:
Very difficult to read.
Some examples of code, in practice:
1011 1010 0001 0001 (meaning: store count)
0011 0010 0000 0001 (meaning: address of count)
0000 0000 (meaning: stop program)
because computer technology can not be understood if it does not start from this lesson.
This post has been upvoted for free by @millibot with 0.1%!
Get better upvotes by bidding on me.
More profits? 100% Payout! Delegate some SteemPower to @millibot: 1 SP, 5 SP, 10 SP, custom amount
You like to bet and win 20x your bid? Have a look at @gtw and this description!
This post is very clear 👌
I will be featuring it in my weekly #technology and #science curation post for the @minnowsupport project and the Tech & Science Guild! The Tech Bloggers' Guild is a new group of Steem bloggers and content creators looking to improve the overall quality of our niche.
Wish not to be featured in the curation post this Friday? Please let me know. In the meantime, keep up the hard work, and I hope to see you at the Tech Bloggers' Guild!
If you have a free witness vote and like what I am doing for the Steem blockchain it would be an honor to have your vote for my witness server. Either click this SteemConnect link or head over to steemit.com/~witnesses and enter my username it the box at the bottom.