quarta-feira, 9 de dezembro de 2009

geekest hello world assembly

; file geekest-hello-world.asm
section .text
 global _start
_start:
 push  ebx
 mov  ebp, esp
 sub  esp, 12
 

 mov  dword [ebp - 12], 0x6c6c6548  ; lleH 
 mov  dword [ebp - 8],  0x6f57206f  ; oW o
 mov  dword [ebp - 4],  0x0a646c72  ; \ndlr
 
 mov  eax, 4   ; sys_write
 mov  ebx, 1   ; stdout
 lea  ecx, [ebp - 12] ; from here
 mov  edx, 12   ; read 12 bytes
 int  0x80   ; DO IT! 

 pop  ebx

 mov  eax, 1
 mov  ebx, 0
 int  0x80
Compiling
nasm -f elf geekest-hello-world.asm
ld -s -o geekest geekest-hello-world.o

THIS IS F*CKING AWESOME!

Nenhum comentário:

Postar um comentário