; print_row(10, '<') Prints character N-times - this case 10x '<'
print_row:
mov ecx, edi ; num
push rbx ; preserving callee-saved register value
mov ebx, esi ; using callee-saved register for the char value
sub ecx, 1
loop_print:
mov edi, ebx
mov al, 0
push rcx ; preserving rcx register value (number), because its caller-saved register
call putchar ; calling putchar func
pop rcx ; retrieving rcx value, which was preserved by stack
sub ecx, 1
jns loop_print ; we loop untill ecx has negative value
mov edi, 10 ; '\n' at the end
mov al, 0
call putchar
pop rbx ; setting rbx to its original value before calling print_row func
ret
I think the problem is in the push pop rcx, but I really dont understand why as the code makes logical sense to me. I tried searching for answer, but unfortunately couldn't find anything.