Thursday, July 26, 2012

My first assembly shell code

My first "Hello World" program in assembly language (shell code) .

  #------------------start--------------------------------------
.data

HelloWorldString:
        .ascii "Hello World\n"

.text

.globl _start

_start:

        movl $4, %eax
        movl $1, %ebx
        movl $HelloWorldString, %ecx
        movl $12, %edx
        int $0x80

        movl $1, %eax
        movl $0, %ebx
        int $0x80
#------------------end--------------------------------------

Let compile it

$ as -o Helloword.o Helloword.s

Let link it.

$ ld -o Helloword Helloword.o

Let run it.

 $ ./Helloword
Hello World

Voila!!!!


No comments:

Post a Comment