Skip to content

Instantly share code, notes, and snippets.

@SourLemonJuice
Last active December 3, 2024 11:15
Show Gist options
  • Save SourLemonJuice/6df94858c4b4061d814684c0b80df814 to your computer and use it in GitHub Desktop.
Save SourLemonJuice/6df94858c4b4061d814684c0b80df814 to your computer and use it in GitHub Desktop.
x86_64 Linux assmbely(nasm) example for printing Hello World.
; Thanks for:
; https://p403n1x87.github.io/getting-started-with-x86-64-assembly-on-linux.html
global _start
SYS_WRITE equ 1
SYS_EXIT equ 60
STDOUT equ 1
SECTION .data
hello db "Hello, World.", 10
hello_len equ $-hello
SECTION .text
_start:
mov rax, SYS_WRITE
mov rdi, STDOUT
mov rsi, hello
mov rdx, hello_len
syscall
push rax
mov rax, SYS_EXIT
pop rdi
sub rdi, hello_len
syscall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment