%macro PRINT 1


    ; Save state
    push rax
    push rdi
    push rsi
    push rdx

    jmp %%astr ;salta para evitar de ler como codigo os dados abaixo

    ;section .rodata 
    %%str    db  %1, 10,0       ; arg0 + null terminator
    %%strln  equ $ - %%str   ; current position - string start 
    
    ;section .text
    ; Write
    ;_syscall_write %%str, 13 ;%%strln

    ; Restore state
    %%astr: _syscall_write %%str, %%strln
    pop rdx
    pop rsi
    pop rdi
    pop rax

%endmacro

%macro _syscall_write 2
    mov rax, 1
    mov rdi, 1
    mov rsi, %1  ; str
    mov rdx, %2  ; strln
    syscall
%endmacro



section .data

    SYS_EXIT   equ 60
    EXIT_CODE  equ 0


section .text

    global _start
    _start:
        push rbp
        PRINT "Hello World!"
        pop rbp
    exit:

        mov rax, SYS_EXIT
        mov rdi, EXIT_CODE
        syscall
   nop

