Hello, Everyone!
My Name is Akshay Patel and in this blog I am going to tell you about Assembly Language Programming.
I am going to use NASM assembler in Linux(Ubuntu) Operating System.
I will be using 64-bit configuration.
So let's begin with Assembly Language Programming
So to create first ALP(Assembly Language Program):
1. open terminal
2. Type :
gedit <program_name>.asm
e.g. my_ALP.asm
Gedit will open the file where we will type our Code.
3.To compile the file type :
nasm -f elf64 <program_name>.asm
eg. nasm -f elf 64 my_ALP.asm
4.Now we need to link our assembly files to create an executeable:
ld -o <executable_name> <objectfile_name>.o
e.g. ld -o my_executable my_ALP.o
5.To run our code type:
./<executable_name>
e.g. ./my_executable
================================================
In gedit <program_name>.asm
To begin with,"gedit" is the text editor to type the code. The extension for assembly language programs is .asm
================================================
In nasm -f elf64 <program_name>.asm
"nasm" is the name of the assembler which we are using.
There are other assemblers like TASM,YASM,MASM
The "-f elf64" option selects a 64-bit output format which is compatible
with Linux and GCC.
NASM genrates object file names <program_name>.o . It contains instructions and data in a form ready to link with
other code from other object files or libraries.
================================================
In ld -o <executable_name> <objectfile_name>.o
ld is used to link all the object files together and generate a single executable.
The -o <executable_name> option gives a name to the executable file produced by
ld.
Without that option, ld produces a file named a.out .
================================================
So, this is how we create an ALP file and create an executable from it.
My Name is Akshay Patel and in this blog I am going to tell you about Assembly Language Programming.
I am going to use NASM assembler in Linux(Ubuntu) Operating System.
I will be using 64-bit configuration.
So let's begin with Assembly Language Programming
So to create first ALP(Assembly Language Program):
1. open terminal
2. Type :
gedit <program_name>.asm
e.g. my_ALP.asm
Gedit will open the file where we will type our Code.
3.To compile the file type :
nasm -f elf64 <program_name>.asm
eg. nasm -f elf 64 my_ALP.asm
4.Now we need to link our assembly files to create an executeable:
ld -o <executable_name> <objectfile_name>.o
e.g. ld -o my_executable my_ALP.o
5.To run our code type:
./<executable_name>
e.g. ./my_executable
================================================
In gedit <program_name>.asm
To begin with,"gedit" is the text editor to type the code. The extension for assembly language programs is .asm
================================================
In nasm -f elf64 <program_name>.asm
"nasm" is the name of the assembler which we are using.
There are other assemblers like TASM,YASM,MASM
The "-f elf64" option selects a 64-bit output format which is compatible
with Linux and GCC.
NASM genrates object file names <program_name>.o . It contains instructions and data in a form ready to link with
other code from other object files or libraries.
================================================
In ld -o <executable_name> <objectfile_name>.o
ld is used to link all the object files together and generate a single executable.
The -o <executable_name> option gives a name to the executable file produced by
ld.
Without that option, ld produces a file named a.out .
================================================
So, this is how we create an ALP file and create an executable from it.