aboutsummaryrefslogtreecommitdiff
path: root/ft_strcpy.s
diff options
context:
space:
mode:
Diffstat (limited to 'ft_strcpy.s')
-rw-r--r--ft_strcpy.s11
1 files changed, 7 insertions, 4 deletions
diff --git a/ft_strcpy.s b/ft_strcpy.s
index 1857933..5d32f2d 100644
--- a/ft_strcpy.s
+++ b/ft_strcpy.s
@@ -14,14 +14,17 @@ global _ft_strcpy
; char *ft_strcpy(char *dst, const char *src);
_ft_strcpy:
+ push rbx
+ push rcx
mov rax, rdi ; dst
mov rbx, rsi ; src
- xor rcx, rcx
+ mov rcx, -1
FT_STRCPY_LOOP:
- mov dl, [rbx + rcx]
- mov [rax + rcx], dl
inc rcx
+ mov dl, byte [rbx + rcx]
+ mov byte [rax + rcx], dl
cmp byte [rbx + rcx], 0
jne FT_STRCPY_LOOP
- mov byte [rax + rcx], 0
+ pop rcx
+ pop rbx
ret