Skip to content

Instantly share code, notes, and snippets.

@razvand
Created November 28, 2015 21:29
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save razvand/782d6471f23352300f11 to your computer and use it in GitHub Desktop.
Save razvand/782d6471f23352300f11 to your computer and use it in GitHub Desktop.
Hello, World! program written in NASM assembly for x86 (32 bit)
;
; 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