TIDE
Languages

Assembly

Installing NASM for Assembly on Ubuntu in TIDE

Assembly

Assembly is a low-level programming language that has a direct 1-to-1 mapping with machine architecture instructions. Programming in assembly provides complete control over hardware registers, memory allocation, and system calls.

Installation

To compile and link assembly programs on Ubuntu (x86_64), install the Netwide Assembler (nasm), GNU linker, and standard build utilities:

apt update
apt install -y nasm build-essential gdb

Verification

Check that NASM and GCC are properly installed:

nasm -v
gcc --version

Writing, Assembling, and Running Code

Create a 64-bit Linux assembly source file named hello.asm:

section .data
    msg db "Hello from Assembly in TIDE!", 10
    len equ $ - msg

section .text
    global _start

_start:
    ; sys_write (rax=1, rdi=stdout, rsi=buffer, rdx=len)
    mov rax, 1
    mov rdi, 1
    mov rsi, msg
    mov rdx, len
    syscall

    ; sys_exit (rax=60, rdi=status)
    mov rax, 60
    mov rdi, 0
    syscall

Assembling the Source File

Assemble the .asm file into an ELF64 object file using NASM:

nasm -f elf64 hello.asm -o hello.o

Linking the Object File

Link the object file into a standalone executable using ld:

ld hello.o -o hello

Running the Executable

Execute the binary:

./hello

Official Resources

On this page