Created
November 28, 2015 21:31
-
-
Save razvand/49aa3bbc13ee29f4f46b to your computer and use it in GitHub Desktop.
Hello, World! program written in NASM assembly for x86_64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; | |
; 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