Introduction to Assembly
Language
Assembly Language is a low-level programming language. It helps in
understanding the programming language to machine code. In
computer, there is assembler that helps in converting the assembly
code into machine code executable. Assembly language is designed
to understand the instruction and provide to machine language for
further processing. It mainly depends on the architecture of the
system whether it is the operating system or computer architecture.
Assembly Language mainly consists of mnemonic processor
instructions or data, and other statements or instructions. It is
produced with the help of compiling the high-level language source
code like C, C++. Assembly Language helps in fine-tuning the
program.
Advantages:
1. It allows complex jobs to run in a simpler way.
2. It is memory efficient, as it requires less memory.
3. It is faster in speed, as its execution time is less.
4. It is mainly hardware oriented.
5. It requires less instruction to get the result.
6. It is used for critical jobs.
7. It is not required to keep track of memory locations.
8. It is a low-level embedded system.
Disadvantages:
1. It takes a lot of time and effort to write the code for the same.
2. It is very complex and difficult to understand.
3. The syntax is difficult to remember.
4. It has a lack of portability of program between different
computer architectures.
5. It needs more size or memory of the computer to run the long
programs written in Assembly Language.
Why is Assembly Language Useful?
Assembly language helps programmers to write the human-readable
code that is almost similar to machine language. Machine language
is difficult to understand and read as it is just a series of numbers.
Assembly language helps in providing full control of what tasks a
computer is performing.
Example:
Find the below steps to print “Hello world” in Windows
1. Open the notepad.
2. Write below code
global _main
extern _printf
section .text
_main:
push message
call _printf
add esp, 4
ret
message:
db 'Hello, World!', 10, 0
3. Save the file with any name example XYZ.asm, the extension
should be “.asm”.
4. The above file needs to compile with the help of assembler
that is NASM (Netwide Assembler).
5. Run the command nasm –f win32 XYZ.asm
6. After this, Nasm creates one object file that contains machine
code but not the executable code that is XYZ.obj
7. To create the executable file for windows Minimal GNU is used
that provides the GCC compiler.
8. Run the command gcc –o XYZ.exe XYZ.obj
9. Execute the executable file now “XYZ”
10. It will show the output as “Hello, world”.
Why you should learn Assembly
Language?
The learning of assembly language is still important for
programmers. It helps in taking complete control over the system
and its resources. By learning assembly language, the programmer
is able to write the code to access registers and able to retrieve the
memory address of pointers and values. It mainly helps in speed
optimization that increase efficiency and performance.
Assembly language learning helps in understanding the processor
and memory functions. If the programmer is writing any program
that needs to be a compiler that means the programmer should
have a complete understanding of the processor. Assembly
language helps in understanding the work of processor and
memory. It is cryptic and symbolic language.
Popular Course in this category