Last active
January 9, 2018 17:45
-
-
Save itsecurityco/975a0c2bab501d7548fef0e572c2c109 to your computer and use it in GitHub Desktop.
Hello world in asm
This file contains hidden or 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
| ; Author: Juan Escobar | |
| ; /usr/include/i386-linux-gnu/asm/unistd_32.h | |
| ; nasm -f elf -o HelloWorld.o HelloWorld.asm | |
| ; ld -o HelloWorld HelloWorld.asm | |
| global _start | |
| section .text | |
| _start: | |
| ; print "Hello World!" on the screen | |
| mov eax, 0x4 ; system call _write(fd, *buf, lenght) | |
| mov ebx, 0x1 ; file descriptor (standart output) | |
| mov ecx, message ; *buf | |
| mov edx, 0x0c ; lenght (12) | |
| int 0x80 ; interruptor | |
| ; exit the program | |
| mov eax, 0x1 ; system call _exit(status) | |
| mov ebx, 0x5 ; status (5) | |
| int 0x80 ; interruptor | |
| section .data | |
| ; label | |
| message: db "Hello World!" ; define byte |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment