Created
December 6, 2013 20:04
-
-
Save alexdantas/7831245 to your computer and use it in GitHub Desktop.
"Hello, World" in IA-32 (NASM, Linux)
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
;; 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