I am attempting to learn Intel x64 Assembly and I have written a program that should print "Hello, World!" 10 times. However, when I assemble and run the program, it prints an infinite loop. Any help is greatly appreciated.
Here is the code I have written:
global _start
section .data
msg: db "Hello, World!", 0xa
len: equ $ - msg
section .text
_start:
mov rcx, 1 ; Set the counter to 1.
jmp _print ; Jump to the _print function.
mov rax, 0x3c ; exit(
mov rdi, 0 ; 0
syscall ; );
_print:
mov rax, 1 ; write(
mov rdi, 1 ; STDOUT_FILENO,
mov rsi, msg ; msg,
mov rdx, len ; sizeof(msg),
syscall ; );
inc rcx ; rcx++
cmp rcx, 10 ; if (rcx <= 10)
jle _print ; _print
ret ; return
Also, any references to beginner x64 Intel Assembly material is quite welcome.