From b22183ba021d9ab3418d8f47545708597247e583 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 22 Nov 2019 02:35:31 +0100 Subject: strcpy, strcmp, write, read --- ft_strcpy.s | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'ft_strcpy.s') 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 -- cgit