How to Set Up Assembly Language on Visual Studio Code | 2021

Muhammad Meeran
3 min readSep 26, 2021

Last night, I opened my assembly language book to try some thing new. After reading through some boring stuff, I got to the interesting part where I was supposed to write the most important program of any language “Hello World”. However, the book only had instructions for Windows based systems and lacked support for Linux. That’s when I decided to set up assembly on my own system

Step 1: Installing the required packages

First we need to install some packages. Open a terminal by pressing CTRL + ALT+ T. Now write the following

sudo apt install gcc gdb ld nasm
Installing Necessary Packages

Step 2: Set Up Visual Studio Code

Now we need to set up visual studio code workspace. Create an empty folder anywhere in your system and open it with code.

mkdir Assembly
cd Assembly && code .

This will open your folder in Visual Studio Code. Open integrated Terminal by Pressing CTRL+` and then execute the following command

touch test.asm

You have created an assembly language file. Now we will write a hello world Program. Paste the following contents in test.asm

section     .textglobal      _start_start:mov     edx,lenmov     ecx,msgmov     ebx,1mov     eax,4int     0x80mov     eax,1int     0x80section     .datamsg     db  'Hello world',0xalen     equ $ - msg

Now, press CTRL + Shift + B and click

Configure Default Build Tasks > Create tasks.json.

This will create tasks.json file in .vscode directory. Now You need to Replace the files in .vscode folder with the ones provided in this link

After replacing the files, Press Ctrl+P to open up vscode command palette.

Now type the following command in it and press enter

ext install DamianKoper.gdb-debug

This will install gdb debugger for debugging your assembly Code.

Now Open the file You want to assemble in Vscode and press CTRL + Shift + B. This will create a file ending in extension “.o” and a simple file with no extension. Open the vscode terminal and execute this simple binary file

Hurray ! As you can see we have finally assembled our code and we see our famous Hello world printed on the console. That’s it

Happy Coding ~!

--

--

Muhammad Meeran

Just a normal guy trying to present the positive image if Islam to the western world and fighting against Islamophobia