Wednesday, 24 December 2014

MA: (hello world alike) 64-bit

section .data:
    input:db'Parashar',10
    inputLen: equ $-input

section .text
    global _start
    _start:
   
    mov rax,1
    mov rdi,1
    mov rsi,input
    mov rdx,inputLen

    syscall

    mov rax,60                ; The system call for exit (sys_exit)
     mov rbx,0                ; Exit with return code of 0 (no error)
     syscall  

[apcoer@localhost ~]$ nasm -f elf64 parashar.asm
[apcoer@localhost ~]$ ld -o parashar parashar.o
[apcoer@localhost ~]$ ./parashar
Parashar

No comments:

Post a Comment