From b4b6364c2fc4b14a0aaac406891c3880243a9733 Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 23 Nov 2019 02:54:37 +0100 Subject: refactored mandatory functions, to respect c calling convention --- ft_strcpy.s | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'ft_strcpy.s') 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 -- cgit