What is Assembly Language?
Last Updated :
15 Apr, 2025
When we talk about programming languages the first thing that comes to our mind is languages like C, C++, Java, Python, etc. But those languages hide the actual working i.e., that abstracts many things from users. But there is a language that really lies on basic concepts behind the programming or interaction between computer hardware.
What is Assembly Language?
Assembly language is a low-level language that helps to communicate directly with computer hardware. It uses mnemonics to represent the operations that a processor has to do. Which is an intermediate language between high-level languages like C++ and the binary language. It uses hexadecimal and binary values, and it is readable by humans.
Evolution of Assembly Language?
Assembly language has evolved hand in hand with advancements in computer hardware and the evolving needs of programmers. Here's a closer look at each generation:
First Generation (1940-1950) :
- Computers relied on vacuum tubes, and programming was directly in machine language, using binary instructions.
- Assembly language emerged as a readable abstraction, employing mnemonic codes to represent machine instructions.
Second Generation (1950-1960) :
- Transistor-based computers replaced vacuum tubes, offering enhanced Consistency and prowess.
- Assembly languages became more intricate to handle the complex instruction sets of these new machines. Simultaneously, high-level programming languages like FORTRAN and COBOL provided Advanced abstraction
Third Generation (1960-1970) :
- Integrated circuits became Standard place, resulting in Diminished but potent computers.
- Assembly languages evolved further, introducing features like macros and symbolic labels, which boosted programmer productivity and code readability.
Fourth Generation (1970-1980) :
- The beginning of microprocessors transformed computing, paving the way for microcomputer systems such as the IBM PC and Apple II.
- Assembly languages for microcomputers were redesigned to enhance user accessibility, featuring syntax highlighting and automatic indentation, thus increasing inclusivity for a larger group of programmers.
Fifth Generation (1980-present) :
- This era is characterized by executing multiple computational tasks simultaneously this method is known as parallel processing system and the growth of sophisticated software systems
- Assembly language continued to evolve to meet the demands of programmers, with the deployment of cutting-edge debugging methods andtools focused on improving code performance and productivity.for intricate systems.
How Assembly Language Works?
Assembly languages contain mnemonic codes that specify what the processor should do. The mnemonic code that was written by the programmer was converted into machine language (binary language) for execution. An assembler is used to convert assembly code into machine language. That machine code is stored in an executable file for the sake of execution.
It enables the programmer to communicate directly with the hardware such as registers, memory locations, input/output devices or any other hardware components. Which could help the programmer to directly control hardware components and to manage the resources in an efficient manner.
How to execute Assembly Language?
- Write assembly code: Open any text editor in device and write the mnemonic codes in it and save the file with a proper extension according to your assembler. Extension can be .asm, .s, .asmx.
- Assembling the code: Convert your code to machine language using an assembler.
- Generating object file: It will generate an object file corresponding to your code. It will have an extension .obj.
- Linking and creating executables: Our assembly language might contain multiple source codes. And we have to link them to libraries to make it executable. We can use a linker like lk for this purpose.
- Running program: After creating an executable file we can run it as usual. It will depend on the software that how to run the program.
Components of Assembly Language
- Registers: Registers are the fast memory locations situated inside the processor. Which helps ALU to perform arithmetic operations and temporary storing of data. Example: Ax (Accumulator), Bx, Cx.
- Command: An instruction in assembly code known as a command informs the assembler what to do. Assembly language instructions typically employ self-descriptive abbreviations to make the vocabulary simple, as "ADD" for addition and "MOV" for data movement.
- Instructions: Instructions are the mnemonic codes that we give to the processor to perform specific tasks like LOAD, ADDITION, MOVE. Example: ADD
- Labels: It is a symbolic name/identifier given to indicate a particular location or address in the assembly code. Example: FIRST to indicate starting of execution part of code.
- Mnemonic: A mnemonic is an acronym for an assembly language instruction or a name given to a machine function. Each mnemonic in assembly corresponds to a specific machine instruction. Add is an illustration of one of these machine commands. CMP, Mul, and Lea are among further instances.
- Macro: Macros are the program codes that can be used anywhere in the program through calling it once we define it. And it is often embedded with assemblers and compilers. We should define it using a directive %macro. Example: %macro ADD_TWO_NUMBERS 2
add eax, %1
add eax, %2
%endmacro - Operands: These are the data or values that we are given through instruction to perform some operation on it. Example: In ADD R1,R2 ; R1 and R2 are operands.
- Opcode: These are the mnemonic codes that specify to the processor which operation has to be done. Example: ADD means Addition.
Binary Number System
There are generally various types of number systems and among them the four major ones are,
- Binary Number System (Number system with Base 2)
- Octal Number System (Number system with Base 8)
- Decimal Number System (Number system with Base 10)
- Hexadecimal Number System (Number system with Base 16)
Number System
Binary Number System is a number system that is used to represent various numbers using only two symbols “0” and “1”. The word binary is start with prefix "bi" which means two so only two number that is 0 and 1 is used to represent any decimal number. Hence, this number system is called Binary Number System. Thus, the binary number system is a system that has only two symbols.
In a binary number system, we represent the number as,
28
|
27
|
26
|
25
|
24
|
23
|
22
|
21
|
20
|
---|
256
|
128
|
64
|
32
|
16
|
8
|
4
|
2
|
1
|
Decimal to Binary:
For writing binary number of any decimal number then follow above table if number is less than 511.
Example: Write binary number of 45.
Solution:
Step 1: Break decimal number in nearest smallest number into power of 2.
45=32+8+4+1
Step 2: From Highest number (i.e. 32) to end (i.e. 1) write 1 in table if number is present otherwise write 0.
So binary number of 45 is-101101
Hexadecimal Number System
Hexadecimal Number System is a number system that is used to represent various numbers using 16 symbols that is from 0 to 9 digits and A to F alphabet and it is a base-16 numeral system. 0 to 9 in decimal and Hexadecimal is same.
Decimal To Hexadecimal Table
Decimal
| Hex
| Decimal
| Hex
| Decimal
| Hex
| Decimal
| Hex
|
---|
0
|
0
|
10
| A
|
20
|
14
|
30
| 1E
|
---|
1
|
1
|
11
| B
|
21
|
15
|
31
| 1F
|
---|
2
|
2
|
12
| C
|
22
|
16
|
32
|
20
|
---|
3
|
3
|
13
| D
|
23
|
17
|
33
|
21
|
---|
4
|
4
|
14
| E
|
24
|
18
|
34
|
22
|
---|
5
|
5
|
15
| F
|
25
|
19
|
35
|
23
|
---|
6
|
6
|
16
|
10
|
26
| 1A
|
36
|
24
|
---|
7
|
7
|
17
|
11
|
27
| 1B
|
37
|
25
|
---|
8
|
8
|
18
|
12
|
28
| 1C
|
38
|
26
|
---|
9
|
9
|
19
|
13
|
29
| 1D
|
39
|
27
|
---|
Hexadecimal numbers can easily converted to another form like Binary number system, Decimal number System, Octal number System and vice-versa. In this article we only focus to convert Hexadecimal to decimal and vice-versa.
Decimal to Hexadecimal Conversion:
Step 1: Take a input decimal value N.
Step 2: Devide N with 16 and store remainder.
Step 3: Again divide quotient with 16 obtain in Step 2 and store remainder.
Step 3: repeat Step 3 until Quotient become 0.
step 4: Write remainder in reverse order and this is the hexadecimal value of the number.
Example : Convert 450 Decimal value into Hexadecimal.
step 1: N = 450.
Step 2: 450/16 gives Q = 28, R = 2.
Step 3: 28/16 gives Q = 1, R = 12 = C.
Step 4: 1/16 gives Q = 0, R = 1.
Step 5 : hexadecimal of 450 is 1C2.
Hexadecimal to Decimal Conversion
To convert Hexadecimal to Decimal multiply each digit by 16 to the power of its position starting from the right and the position of rightmost digit is 0 then add the result.
Example: Convert (A7B)16 to decimal.
(A7B)16 = A × 162 + 7 × 161 + B × 160
⇒ (A7B)16 = 10 × 256 + 7 × 16 + 11 × 1 (convert symbols A and B to their decimal equivalents; A = 10, B = 11)
⇒ (A7B)16 = 2560 + 112 + 11
⇒ (A7B)16 = 2683
Therefore, the decimal equivalent of (A7B)16 is (2683)10.
Advantages of Assembly Language
- It provides precise control over hardware and hence increased code optimization.
- It allows direct access to hardware components like registers, so it enables tailored solutions for hardware issues.
- Efficient resource utilization because of low level control, optimized code, resource awareness, customization etc.
- It is ideal for programming microcontrollers, sensors and other hardware components.
- It is used in security researches for finding security vulnerabilities, reverse engineering software for system security.
- It is very essential for the making the operating systems, kernel and device controllers that requires hardware interaction for its functionality.
Disadvantages of Assembly Language
- Complex and very hard to learn the language especially for beginners.
- It is highly machine dependent. So, it limits portability.
- It is really hard to maintain the code, especially for large scale projects.
- It is very time consuming since it is really hard to understand and very length of code.
- Debugging is very challenging to programmers.
Similar Reads
What is a Low Level Language?
Both High level language and low level language are the programming language's types. The main difference between high level language and low level language is that, Programmers can easily understand or interpret or compile the high level language in comparison of machine. Low level language is high
5 min read
What is Machine Language?
Machine language is a low-level programming language that is understood by computers. Machine language is made up of binary bits 0 and 1. Machine language is also known as machine codes or object code. As machine language consists of only 0 and 1, that's why it is difficult to understand in raw form
4 min read
What is High Level Language?
Computer languages have a huge importance in the digital world. If you want to create anything such as an application, website, software, or game you need to write it using a coding language, which is most probably a high-level language because they are easier to use and understand by humans. In thi
7 min read
What is Procedural Language?
Procedural programming is a software development method that is executed step by step in a certain manner. The sequence of tasks to be carried out in order to find a solution is of primary importance. Procedural languages are encoded as algorithms, so that, in addition, the programmer not only speci
5 min read
What is COBOL(Common Business Oriented Language)?
COBOL an acronym for Common Business Oriented Language is a computer programming language, which was designed for business use. COBOL was procedural in the beginning, but since 2002, COBOL became object-oriented. COBOL was developed by Conference of Data System Languages(CODASYL). COBOL is primarily
6 min read
Assembly language program to find largest number in an array
Problem - Determine largest number in an array of n elements. Value of n is stored at address 2050 and array starts from address 2051. Result is stored at address 3050. Starting address of program is taken as 2000. Example: Algorithm: We are taking first element of array in AComparing A with other e
3 min read
Difference Between Machine Language and Assembly Language
Machine language is the low level programming language. Machine language can only be represented by 0s and 1s. In earlier when we have to create a picture or show data on the screen of the computer then it is very difficult to draw using only binary digits(0s and 1s). For example: To write 120 in th
2 min read
What is a Computer Program?
Software development is one of the fastest-growing technologies as it can make work easy in our daily lives. It is the foundation of modern technology. We write a set of programs to form software programs is the basic necessity for building software. Here in this article, we are going to learn about
5 min read
What is Program Counter?
Many complex components come together to make a computer system work seamlessly. One such essential element is the program counter. There is a register in a PC (program counter) processor that contains the address of the next instruction to be executed from memory. In this article we learn what prog
4 min read
Programming Language Generations
A computer is a digital machine. It can only understand electric signals either ON or OFF or 1 or 0. But how do we communicate with this digital machine? Just like there are multiple languages we communicate with each other (e.g., English, Hindi, Tamil, Gujarati, etc.). But computers cannot understa
6 min read