Skip to content

Instantly share code, notes, and snippets.

@overdrive3000
Created December 19, 2014 20:40
Show Gist options
  • Save overdrive3000/5dfd4e72791a7a772fad to your computer and use it in GitHub Desktop.
Save overdrive3000/5dfd4e72791a7a772fad to your computer and use it in GitHub Desktop.
Hello world in assembly!
# ----------------------------------------------------------------------------------------
# helloworld.s. Hello world in assembly!
# ----------------------------------------------------------------------------------------
.global _start
.text
_start:
# write(1, message, 13)
mov $1, %rax # system call ID. 1 is write
mov $1, %rdi # file handle 1 is stdout
mov $message, %rsi # address of string to output
mov $13, %rdx # string length
syscall # system call invocation!
# exit(0)
mov $60, %rax # system call ID. 60 is exit
xor %rdi, %rdi # we want return code 0
syscall # system call invocation!
message:
.ascii "Hello, world\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment