Skip to content

Instantly share code, notes, and snippets.

@alexdantas
Created December 6, 2013 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexdantas/7831245 to your computer and use it in GitHub Desktop.
Save alexdantas/7831245 to your computer and use it in GitHub Desktop.
"Hello, World" in IA-32 (NASM, Linux)
;; My first IA-32 program!
;;
;; It shows "Hello, World" and exits normally
section .data
msg db "Hello, World!", 0xA ; Message to show
size EQU $ - msg ; Length of the message
global _starting_here ; Global entry for `ld`
section .text
_starting_here: ; "main"
mov eax, 4 ; Syscall number (sys_write)
mov ebx, 1 ; File descriptor (stdout)
mov ecx, msg ; Message to show
mov edx, size ; Message length
int 80h ; syscall (eax->edx: arguments)
mov eax, 1 ; Syscall number (sys_exit)
mov ebx, 0 ; Exit status ("return 0")
int 80h ; syscall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment