Skip to content

Instantly share code, notes, and snippets.

@manvscode
Created November 4, 2012 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manvscode/4009855 to your computer and use it in GitHub Desktop.
Save manvscode/4009855 to your computer and use it in GitHub Desktop.
Hello World
# as -o hello-world.o hello-world.s ; ld -o hello-world hello-world.o
.data
hello_world_str: .ascii "Hello World!\n"
hello_world_len: .int 13
.text
.globl _start
_start:
movl $4, %eax # load sys call 4 into EAX
movl $1, %ebx # load stdout(1) into EBX
movl $hello_world_str, %ecx
movl hello_world_len, %edx
int $0x80
#exit the program
movl $1, %eax # load sys call 1 into EAX
movl $0, %ebx # load exit status into EBX
int $0x80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment