Wednesday, 24 December 2014

MA: hello world(32 bit)

section .data

    hello:db'Hello World',10
    hellolen:equ $-hello

section .text
    global _start
    _start:

    mov eax,4;
    mov ebx,1;
    mov ecx,hello
    mov edx,hellolen;

    int 80h

    mov     ebx,0               ;first syscall argument: exit code
       mov     eax,1               ;system call number (sys_exit)
        int     80h                ;call kernel


[apcoer@localhost ~]$ nasm -f elf64 hellwrld.asm
[apcoer@localhost ~]$ ld -o hellwrld hellwrld.o
[apcoer@localhost ~]$ ./hellwrld
Hello World

No comments:

Post a Comment