Skip to content

Instantly share code, notes, and snippets.

@razvand
Created November 28, 2015 21:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save razvand/49aa3bbc13ee29f4f46b to your computer and use it in GitHub Desktop.
Save razvand/49aa3bbc13ee29f4f46b to your computer and use it in GitHub Desktop.
Hello, World! program written in NASM assembly for x86_64
;
; Simple NASM syntax assembly program for x86_64.
;
; Use commands below to assemble, link and run ($ is the prompt):
; $ nasm -f elf64 hello_x86_64.asm
; $ gcc -o hello_x86_64 hello_x86_64.o
; $ ./hello_x86_64
; Hello, world!
;
extern printf
section .text
global main
main:
push rbp
mov rbp, rsp
mov rdi, msg
call printf
leave
ret
section .data
msg db 'Hello, world!', 13, 10, 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment