Created
November 28, 2015 21:29
-
-
Save razvand/782d6471f23352300f11 to your computer and use it in GitHub Desktop.
Hello, World! program written in NASM assembly for x86 (32 bit)
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 (32 bit). | |
; | |
; Use commands below to assemble, link and run ($ is the prompt): | |
; $ nasm -f elf32 hello.asm | |
; $ gcc -m32 -o hello hello.o | |
; $ ./hello | |
; Hello, world! | |
; | |
extern printf | |
section .text | |
global main | |
main: | |
push ebp | |
mov ebp, esp | |
push msg | |
call printf | |
add esp, 4 | |
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