%macro PRINT 1
    ; Save state
    push rax
    push rdi
    push rsi
    push rdx

    section .rodata ; secao dados somente de leitura
    %%str    db  %1, 10,0       ; arg0 + null terminator
    %%strln  equ $ - %%str   ; current position - string start 
    
    section .text
    ; Write
      
    _syscall_write %%str, %%strln
    
    ; Restore state
    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
  
        mov rax, SYS_EXIT
        mov rdi, EXIT_CODE
        syscall
  

