What is Assembly Language?
Last Updated :
27 May, 2024
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.
Frequently Asked Questions on Assembly Language - FAQs
Where is assembly language used for?
- Operating system development
- Device driver creation
- Embedded systems programming
- Real-time applications
- Security research
Difference between Assembly language and High Level Language?
Assembly Language is mnemonic codes and closely related to CPU’s instruction set. In HLL there is abstraction.
Which CPU Architecture Should I Learn for Assembly Programming?
8085 and 8086 micro processor architectures are very far better to understand concepts.
Is Assembly Language Still Relevant in Modern Computing?
Yes. Assembly language remains relevant.
Similar Reads
100+ Happy Birthday Wishes: Sweet Quotes & Message ideas
Birthday is the most important day in anyone's life. So wishing your friends, relatives, or colleagues a Happy birthday will make the bond super strong. We have crafted the Top 100 Happy Birthday wishes that you can share on the eve with your friends, partner, or any colleague. Happy Birthday Wishes
14 min read
Best Free Movie Download Sites for 2024
Want to watch a movie whenever you want? Simply download it to your device and watch it later, even if you don't have an internet connection. This is called "streaming it locally." The best part about downloading a movie is that it's always ready for you, no matter where you are! Most legal movie do
9 min read
15 Best IPTV Service Providers Subscriptions (Top Picks)
Finding a reliable IPTV service provider can be challenging with so many options available. As streaming becomes the new standard for entertainment, IPTV services have gained huge popularity by offering a wide variety of TV channels, on-demand content, and international programmingâall through an in
14 min read
ASCII Values Alphabets ( A-Z, a-z & Special Character Table )
ASCII (American Standard Code for Information Interchange) is a standard character encoding used in telecommunication. The ASCII pronounced 'ask-ee', is strictly a seven-bit code based on the English alphabet. ASCII codes are used to represent alphanumeric data. The code was first published as a sta
7 min read
Class Diagram | Unified Modeling Language (UML)
A UML class diagram is a visual tool that represents the structure of a system by showing its classes, attributes, methods, and the relationships between them. It helps everyone involved in a projectâlike developers and designersâunderstand how the system is organized and how its components interact
12 min read
Spring Boot Interview Questions and Answers
Spring Boot is a Java-based framework used to develop stand-alone, production-ready applications with minimal configuration. Introduced by Pivotal in 2014, it simplifies the development of Spring applications by offering embedded servers, auto-configuration, and fast startup. Many top companies, inc
15+ min read
Spring Boot Tutorial
Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance
10 min read
Rashi/Zodiac Chart: Know Your Rashi by Name and Date Of Birth
The Indian astrology system recognizes 12 Rashis or Zodiac Signs, each with distinct characteristics. The Moon sign, determined by the Moon's placement at birth, is crucial in Vedic Astrology. Understanding Zodiac Signs helps individuals discover their personality traits, compatibility, and what the
13 min read
Free Reverse Phone Number Lookup Services and Sites: 10 Best Picks in 2025
Find all the latest list of Reverse Phone Number Lookup Services and Sites - Due to the rapid increase in numbers of spam calls and unknown numbers it has now become vital to use reverse phone number lookup services. Whether you're trying to identify an unknown caller or check the legality of a phon
12 min read
ACID Properties in DBMS
A transaction is a single logical unit of work that interacts with the database, potentially modifying its content through read and write operations. To maintain database consistency both before and after a transaction, specific properties, known as ACID properties must be followed. This article foc
7 min read