What is Machine Language?
Machine language is the basic low-level programming language designed to be recognized by a computer. Actually the language is written in a binary code of 0s and 1s that represent electric impulses or off and on electrical states respectively. A group of such digits is called an instruction and it is translated into a command that the central processing unit or CPU understands.
More specifically, instructions are organized in patterns of 0s and 1s in various lengths such as 16, 24, 32, and 64 digits or bits, representing specific tasks such as storing or transferring data. An instruction is made up of two parts: the operator or opcode and the operand. The first few bits of an instruction are the "operator or opcode," whose role is to specify the kind of operation that needs to be performed. The rest of the bits are the "operand," whose role is to indicate the location where the operation is to be performed. For instance, a binary opcode such as the 000001 could be an instruction to store the contents of the accumulator in a given memory address. The whole instruction could look like this: 00000100011100000000000100000010.
Another example of binary machine language is the binary-coded decimal, where decimal numbers are encoded in binary form. Each decimal digit is coded as a four-digit binary number as follows:
- 0000 = 0
- 0001 = 1
- 0010 = 2
- 0011 = 3
- 0100 = 4
- 0101 = 5
- 0110 = 6
- 0111 = 7
- 1000 = 8
- 1001 = 9
For example, the decimal number 5,270 is represented by the binary code for 5, 2, 7, 0, which translates into 0101 0010 0111 0000.
The CPU has the ability to perform millions of instructions per second and this fact makes the binary machine language efficient, despite the volume of bits. It would be useful to note that different CPUs from different manufacturers use different machine languages.
What is a High-Level Language?
The term high-level language indicates a programming language that is understood by the programmer and can be translated into a simple machine language that a computer can understand and execute. These high-level languages do not depend on the machine code of a specific computer. Some of the most common high-level languages are C, C++, Java, PHP, Visual Basic, Perl, Python and many more.
Between the machine and the high-level languages comes the assembly language which uses neumonic codes or symbols and it is much harder to program since it demands greater attention and far more detail.
High-Level Language vs Machine Language
Both high-level and low-level languages are necessary for the communication between the programmer and the processing unit of a computer. The most important points regarding the high-level vs machine language comparison are summarized below:
- A machine language is designed in terms of execution by the hardware of the computer. A high-level language is an easy, reliable, and efficient way to express the creativity of a programmer into commands that a computer will understand.
- The task of programming using binary code would be complex and arduous. These characteristics would result in programs that would be difficult to read, check for errors, or debug.
- A slight change in machine language, e.g. the change of a bit, may affect the whole instruction sequence.
- Instructions written in a machine language can be very lengthy. This can easily result in errors during programming. What's more, the whole process could become very time-consuming and costly. For example, a simple subtraction between two numbers would require more than ten instructions in machine language.
Nevertheless, machine language is the only language the central processing unit understands. And it is the only bridge of communication between the programmer and the computer. Although most programmers do not use machine language to write their programs anymore, it is essential that they still have the knowledge of it, since many tasks are better accomplished with its use.
- "Machine Language" by bookrags.com
- "Machine Language for Beginners" by R. Bandler
- Microprocessor Tutorial by eastaughs.fsnet.co.uk