If you need to print a string you'll need to pass the size of this string or, at least, use C style strings and put a NULL char at the and to get this size:
; Entry RDI - pointer to char
; Exit: EAX, size of string
; Destroys RDI.
strlen_:
xor eax,eax
.loop:
cmp byte [rdi],0
je .exit
inc eax
inc rdi
jmp .loop
.exit:
ret
; Entry ECX = stdout handle. RDX = pointer to string.
; Destroys RDI, R8 and R9.
printstr:
sub rsp,40 ; Win64 calling convetion reserves 32 bytes on stack (will reserve 8 bytes more)
mov rdi,rdx
call strlen_
mov r8d,eax
mov r9,rsp
push 0
call [__imp_WriteConsoleA]
add rsp,40
ret
Usage:
section .data
msg: db 'hello', 0
section .text
...
; rcx must have the stdout handle
lea rdx,[msg]
call printstr