aboutsummaryrefslogtreecommitdiff
path: root/ft_strcpy.s
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-11-22 02:35:31 +0100
committerCharles <sircharlesaze@gmail.com>2019-11-22 02:35:31 +0100
commitb22183ba021d9ab3418d8f47545708597247e583 (patch)
tree079af4d3d360a72908782abead1f4b272155bd18 /ft_strcpy.s
parent0931febe3e178b4e484259c9cdc79ef452208ae7 (diff)
downloadlibasm-b22183ba021d9ab3418d8f47545708597247e583.tar.gz
libasm-b22183ba021d9ab3418d8f47545708597247e583.tar.bz2
libasm-b22183ba021d9ab3418d8f47545708597247e583.zip
strcpy, strcmp, write, read
Diffstat (limited to 'ft_strcpy.s')
-rw-r--r--ft_strcpy.s20
1 files changed, 11 insertions, 9 deletions
diff --git a/ft_strcpy.s b/ft_strcpy.s
index 2b7bbb9..228ea04 100644
--- a/ft_strcpy.s
+++ b/ft_strcpy.s
@@ -1,11 +1,13 @@
+.globl _ft_strcpy
+
_ft_strcpy:
- pop ax
- pop bx
- mov ecx, eax ; copy
-FT_STRCPY_LOOP:
- mov [ecx], ebx
- inc ebx
- inc ecx
- cmp ebx, 0
- jneq FT_STRCPY_LOOP
+ mov rax, rdi # dst
+ mov rbx, rsi # src
+ xor rcx, rcx
+ FT_STRCPY_LOOP:
+ mov dl, [rbx + rcx]
+ mov [rax + rcx], dl
+ inc rcx
+ cmp byte ptr [rbx + rcx], 0
+ jne FT_STRCPY_LOOP
ret