Fixed read loop glitch

This commit is contained in:
2025-06-23 13:12:31 +03:00
parent 15311ca7d1
commit ceb84c9e3d
4 changed files with 20 additions and 3 deletions

View File

@@ -64,6 +64,7 @@ read:
# rsi = char*
write:
push r15
push r11
mov r15, rdi
mov rdi, rsi # no need to touch rsi
call count
@@ -73,6 +74,7 @@ write:
mov rdi, r15
syscall
pop r11
pop r15
ret
@@ -80,9 +82,9 @@ write:
count:
mov rax, rdi
count_loop:
mov r8b, [rax]
mov r9b, [rax]
inc rax
cmp r8b, 0
cmp r9b, 0
jnz count_loop
dec rax
sub rax, rdi