Before we start coding in assembly language, we will need to set up our development environment.
This section will guide you through the process of installing the necessary tools required to write and assemble an asm program.
We will use NASM Assembler and ld linker throughout this tutorial.
The Netwide Assembler (NASM) is a popular assembler for assembling x86 and x86_64 assembly code into object code.
Here's how to install it:
sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get install nasm -yAfter installation, verify the installation using:
nasm -vTo convert your object code into an executable binary, you need a linker. Most linux distributions come with ld as part of binutils package. You will also need a C compiler to link object code with system libraries.
Verify the installation of gcc C compiler and ld linker using:
gcc -v
ld -vif it is not installed, install it using :
sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get install gcc -y
sudo apt-get install binutils -yIt's really helpful to use a debugger like gdb for debugging assembly programs. Here's how you can install it:
sudo apt-get install gdb -yVerify the installation using:
gdb -vYou can use any text editor/IDE for writing assembly programs. Some of them are:
- SASM
- Vim/Neovim or Emacs with syntax highlighting for assembly.
- Kate
- Visual studio code (with nasm extension)