
What is assembly language?
The assembly language is a low level programming language which is use by microprocessor and memory. It is a also called as assembly code and denoted by asm. The extension of assembly code is .s. Each assembly language is a specific to a particular computer architecture and sometime to an operating system.
The assembly language is still use for Hardware manipulation, access to a specialised processor instruction and to understand processes going inside the processor. The C and C++ are mid level languages which is used for application in real world but to understand the process going on while running c program, assembly language is required and it is fantastic language.
Is there any need to learn this language?
Basically assembly language is not needed but if you want to be a good programmer and want to know what is going behind the program, in processor and memory assembly language is for you.
Basic Syntax of Assembly language
section .text
global_start ;must be declared for linker (ld)
_start: ;tells linker entry point
mov edx,len ;message length
mov ecx,msg ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel
section .data
msg db ‘Hello, world!’, 0xa ;our dear string
len equ $ – msg ;length of our dear string
The output is : Hello, world!
Understanding the Syntax
The Syntax contains basically 3 parts
- data
- bss
- text
The data section
Here you can declare values like variables in C
The variables are as follow :- .ascii for strings, .int for 32 bit integer, .short for 16 bit integers, .float for floating point.
The processor supports the following data size:-
- Word: a 2-byte data item
- Doubleword: a 4-byte (32 bit) data item
- Quadword: an 8-byte (64 bit) data item
- Paragraph: a 16-byte (128 bit) area
- Kilobyte: 1024 bytes
- Megabyte: 1,048,576 bytes
The bss section
The bss section is used for declaring variables.
The text section
The text section is used for keeping the actual code. This section must begin with the declaration global _start, which tells the kernel where the program execution begins.
Comment
Using comments are helpful:- # is used to comment
The Registers:- The processor is for processing the data. Reading data and storing into the memory slows down the speed of processor so it uses location of internal memory called as Registers

The Pointer Register:-
- Instruction Pointer (IP) − The 16-bit IP register stores the offset address of the next instruction to be executed. IP in association with the CS register (as CS:IP) gives the complete address of the current instruction in the code segment.
- Stack Pointer (SP) − The 16-bit SP register provides the offset value within the program stack. SP in association with the SS register (SS:SP) refers to be current position of data or address within the program stack.
- Base Pointer (BP) − The 16-bit BP register mainly helps in referencing the parameter variables passed to a subroutine. The address in SS register is combined with the offset in BP to get the location of the parameter. BP can also be combined with DI and SI as base register for special addressing.
The Index Register:-
- Source Index (SI) − It is used as source index for string operations.
- Destination Index (DI) − It is used as destination index for string operations.





