Last active
August 29, 2015 14:09
-
-
Save jcrubino/e956ba64a4dcdad617ab to your computer and use it in GitHub Desktop.
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
| ;Hello world in x86 assembly syntax (for nasm) | |
| ;to compile and run: | |
| ;$ yasm -f elf hello.asm 2>&1 | |
| ;$ ld -m elf_i386 -s -o hello *.o 2>&1 | |
| section .text | |
| global _start ;declared for linker | |
| _start: ;linker entry point | |
| mov edx,len ;message len | |
| mov ecx,msg ;message to write | |
| mov ebx,1 ;stdout | |
| mov eax,4 ;sys_write | |
| int 0x80 ;kernel | |
| mov eax,1 ;sys_exit | |
| int 0x80 ;kernel | |
| section .data | |
| msg db 'Hello, world!', 0xa ;the string | |
| len equ $ - msg ;length the string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment