Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A simple "Hello, world !" (debuggable) program for NASM with Linux
; Copyright (c) 1999 Konstantin Boldyshev <>
; Reviewed by HorlogeSkynet (12/09/16)
; "Hello, world !" in assembly language for Linux
; To compile: nasm -f elf64 -g helloWorld.asm
; To link the executable: ld -m elf_x86_64 -g -o helloWorld helloWorld.o
; To run the program: ./helloWorld
; To debug the program: gdb ./helloWorld
section .data
msg db 'Hello, world !', 0xa ; Our dear string
len equ $ - msg ; Length of our dear string
section .text
global _start ; Must be declared for linker (ld)
_start: ; Tell linker entry point
mov edx, len ; Message length
mov ecx, msg ; Message to write
mov ebx, 1 ; File descriptor (stdout)
mov eax, 4 ; System call number (sys_write)
int 0x80 ; Call kernel
mov eax, 1 ; System call number (sys_exit)
mov ebx, 0 ; Set the returned value
int 0x80 ; Call kernel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.