Created
October 14, 2012 04:40
-
-
Save maxdeliso/3887364 to your computer and use it in GitHub Desktop.
linux console mode hello, world in assembly
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
probe: probe.o makefile.linux | |
ld -o probe -e probe probe.o | |
probe.o: probe.asm makefile.linux | |
nasm -o probe.o -felf32 probe.asm | |
clean: | |
rm -f probe.o probe |
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
global probe | |
section .text | |
probe: | |
push ebp | |
mov ebp, esp | |
sub esp, 4 | |
mov eax, 4 | |
mov ebx, 1 | |
mov ecx, msg | |
mov edx, msgLen | |
int 0x80 ; write | |
mov eax, 3 | |
xor ebx, ebx | |
mov ecx, esp | |
mov edx, 4 | |
int 0x80 ; read | |
mov eax, 1 | |
xor ebx, ebx | |
int 0x80 ; exit | |
section .rodata | |
msg: db 'hello, world', 10, 0 | |
msgLen: equ $-msg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment