Skip to content

Instantly share code, notes, and snippets.

@soardex
Last active August 29, 2015 14:20
Show Gist options
  • Save soardex/c3a5a71fd1db26c0596f to your computer and use it in GitHub Desktop.
Save soardex/c3a5a71fd1db26c0596f to your computer and use it in GitHub Desktop.
Hello World Assembly Language
; compiling on x86-64
; nasm -f elf64 hello.asm -o hello.o
; ld -s -o hello hello.o
section .text
global _start
_start:
mov eax,4 ; system call ID: sys_write
mov ebx,1 ; file descriptor for standard output
mov ecx,string ; string address
mov edx,length ; string length
int 0x80 ; system call
mov eax,1 ; system call ID: sys_exit
mov ebx,0 ; exit code 0: no error
int 0x80 ; system call
section .data
string: db 'Hello, world', 0x0A ; output string
length: equ 13 ; lenght of string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment