What is Machine Language or Machine Code

In this tutorial, You will understand the concept of Machine Language and how programs written in any language get executed. 

Along with the detailed information of machine language, You will also know the main difference between assembly language and machine language.

What is Machine Language?

Machine language is a low-level language consists of binary digits. The machine language consists of strings of binary numbers (0's and 1's), and this is only the language understood by the computer system. 


Every high-level language code must be converted into machine language either by a compiler or by an interpreter so as to execute and run the code on the computer. It is so because the hardware can only understand the binary code.

Sometimes, it is also mentioned as a machine code or object code. Machine code is the fundamental or basic language of a computer. 



The computer can only understand binary language (i.e., 0 and 1). The particular binary code is used for some instructions to be executed in machine language. 

The opcode (also called operation codeof each and every computer system is different depending upon its microprocessors which are called machine code.  

The machine codes are the fundamental language of the computer which are written in binary language. 

The computer socket inside the computer system can immediately recognize the machine language and converts it into electrical signals that are used further.

An instruction developed in any machine language has a two-part composition.

1. Opcode

2. Operand


Opcode is the first part of an instruction that describes the computer system what function to perform. Every computer system has an operation code or opcode that tells them what functions to execute for each of its functions.

Operand is the second part of the instruction, and it describes the computer where to find or store the data or instructions that are used or going to be used.

The number of operands varies amongst computers. Each instruction says the Control Unit of the CPU what to do and how to do it. 

The operations are Arithmetic, Logical, Branch operation, etc depending upon the problem that is provided to the computer system.


Examples of machine language: This is the example of machine language for the text "Learning Mania". 




01001100    01100101    01100001    01110010    01101110    01101001    01101110    01100111    00100000    01001101    01100001    01101110    01101001    01100001   
You can read more examples here Computer Hope.


Advantages of Machine Language

1. Programs written in machine language can be executed very fast by the computer system. This is mainly because machine instructions are directly understood by the CPU and hence no translation of the program is required. 

2. There is an efficient use of the primary memory of the computer system.


Disadvantage of Machine Language

1. Machine Dependent - Because the internal design of every type of computer is different from other types of computers and needs different electrical signals to operate. The machine language is also different from computer to computer.

2. Difficult to Program - Although Machine Language is easily understood by the computer but it is very difficult to write a program in this language. 
It is essential for the programmer either to parrotize (or memorized) dozens of code numbers for the commands in the machine's instruction set or to constantly refer to a reference card for their understanding.

3. Difficult to Modify - It is difficult to correct or modify the machine language program. Checking machine instructions for error is very difficult and time-consuming. Similarly, modifying a machine language program is very difficult.

4. Error-ProneA programmer has to remember the Opcodes and knows about the memory allocation for writing machine language programs. Hence, it becomes very difficult for a programmer to concentrate fully on the logic of the problem. This results in programming errors.


Assembly Language vs Machine Language

Assembly language and Machine language both are low-level languages. However, Assembly Language is above the Machine language. 

A machine language consists of binary that can be directly executed by the computer but assembly language needs a software that is used to convert the assemble language code into machine code. The software is called an assembler.

Assembly language contains commands which are easily understood by the programmer but machine language does not contain any letter.

Assembly language uses mnemonic codes inside the programs. Assembly Language is easier to read, write, and maintain rather than machine language.

Assembly language is a language that comes in between the machine language (machine code) and high-level language that is it is neither hard nor easy. It is one level below high language but one level above machine code.

Previous
Next Post »

Comment Below: ConversionConversion EmoticonEmoticon