Skip to content
← Back to Community
Writing x86 Assembly Using
Profile icon
has Hacker Plan

Whether it be for a computer systems class or just for fun, programming in assembly can be a powerful tool in understanding C programs and computer architecture in general. Although doesn't have support for x86 assembly just yet, I think I found a pretty easy workaround that allows you to write x86 assembly source code within a C repl. For me, using as an online IDE is a huge advantage as a macOS user that finds SSHing all the time cumbersome and VMs too laggy.

I'll be using x86 64-bit assembly with AT&T syntax for the example repl.

How It Works

Basically, the way this method works is that I think C repls already have all of the necessary C-associated tools already "preloaded" and available, so we can use standard bash commands and things like gcc, objdump and gdb among others that would typically be found on a normal Linux computer. We can therefore simply use terminal commands to compile and run assembly code.

Starting Up

To start, simply create a new repl in C and press the Add file button to create a new file fibonacci.s. As an example, I programmed a function to calculate the nth Fibonacci number, but you can change the name of the .s file to whatever you'd like. Structure the .s source code as you normally would :

.globl main main: # Write code here! .data


To convert your assembly source code in your .s file into an executable, don't press the Run button at the top of the repl! Instead, in the terminal associated with the repl, run the following bash command:

> gcc fibonacci.s -o fibonacci

Of course, you can change fibonacci with whatever the name of your program is. This compiles as a 64-bit executable using gcc. (For 32-bit executable, use the as and ld bash commands to assemble and link, and add the -m elf_i386 flag to the ld command. Thanks Stack Overflow).

Running the Program

Run the program using the bash command

> ./fibonacci

If you happen to have command line arguments too, you can add them in a format like

> ./fibonacci arg1 arg2 arg3

Getting the Return Value

To find out what your assembly code returned, the easiest way (for integer return values) is to use this single-line bash command after running the executable:

> echo $?


So far to my knowledge, the only real limitation for me is that there's (as of 09/2020) no support for syntax highlighting assembly code that you'd normally see using vim or some other editor, since assembly isn't technically a language that's supported officially yet by That being said, this tool has been extremely helpful for me and hopefully for you too!

Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon

One thing: Intel assembler is better.

Profile icon
Profile icon
Profile icon

Writing a code requires deep knowledge and the ability to fix errors quickly, the same is with any other writing. When you write a text, you need to understand the structure and know what exactly you need to write. For me, it was always challenge, but with the help of I found a few good services that can write any paper for me. The reviews on the site turned to be very helpful.

Profile icon

I’ve been able to get highlighting on mobile tho.

Profile icon


Profile icon

Creating a bash repl will be better suited for this task.

makefile works too (also called polygott).