NASM - Netwide Assembler
The Netwide Assembler (NASM) is an assembler and disassembler for the Intelx86 architecture. It can be used to write 16-bit, 32-bit (IA-32) and 64-bit (x86-64) programs. NASM is considered to be one of the most popular assemblers for Linux.
The Netwide Assembler, NASM, is an 80x86 and x86-64 assembler designed for portability and modularity. It supports a range of object file formats, including Linux and *BSD a.out, ELF, Mach-O, 16-bit and 32-bit .obj (OMF) format, COFF (including its Win32 and Win64 variants.) It can also output plain binary files, Intel hex and Motorola S-Record formats. Its syntax is designed to be simple and easy to understand, similar to the syntax in the Intel Software Developer Manual with minimal complexity. It supports all currently known x86 architectural extensions, and has strong support for macros.
NASM is line-based. Most programs consist of directives followed by one or more sections. Lines can have an optional label. Most lines have an instruction followed by zero or more operands.
Generally, you put code in a section called .text and your constant data in a section called .data
NASM was originally written by Simon Tatham with assistance from Julian Hall. As of 2016, it is maintained by a small team led by H. Peter Anvin. It is open-source software released under the terms of a simplified (2-clause) BSD license
; include directives
segment .data ;
; RESX directives
; Define variables in the data section
hello: db 'Hello world!',10
helloLen: equ $-hello
; Code goes in the text section
mov eax,4 ; 'write' system call = 4
mov ebx,1 ; file descriptor 1 = STDOUT
mov ecx,hello ; string to write
mov edx,helloLen ; length of string to write
int 80h ; call the kernel
; Terminate program
mov eax,1 ; 'exit' system call
mov ebx,0 ; exit with error code 0
int 80h ; call the kernel
NASM can output several binary formats, including COFF, OMF, a.out, Executable and Linkable Format (ELF), Mach-O and binary file (.bin, binary disk image, used to compile operating systems), though position-independent code is supported only for ELF object files. NASM also has its own binary format called RDOFF.
The variety of output formats allows retargeting programs to virtually any x86 operating system (OS). Also, NASM can create flat binary files, usable to write boot loaders, read-only memory (ROM) images, and in various facets of OS development. NASM can run on non-x86 platforms as a cross assembler, such as PowerPC and SPARC, though it cannot generate programs usable by those machines.
NASM uses a variant of Intel assembly syntax instead of AT&T syntax. It also avoids features such as automatic generation of segment overrides (and the related ASSUME directive) used by MASM and compatible assemblers
It allows complex jobs to run in a simpler way.
It is memory efficient, as it requires less memory.
It is faster in speed, as its execution time is less.
It is mainly hardware-oriented.
It requires less instruction to get the result.
It is used for critical jobs.
It is not required to keep track of memory locations.
It is a low-level embedded system.
It takes a lot of time and effort to write the code for the same.
It is very complex and difficult to understand.
The syntax is difficult to remember.
It has a lack of portability of program between different computer architectures.
It needs more size or memory of the computer to run the long programs written in Assembly Language.
The Tech Platform