aboutsummaryrefslogtreecommitdiff
path: root/ft_strcpy.s
blob: 820d9703d50304bc6aed45e6353a204ba7e1e3d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# **************************************************************************** #
#                                                                              #
#                                                         :::      ::::::::    #
#    ft_strcpy.s                                        :+:      :+:    :+:    #
#                                                     +:+ +:+         +:+      #
#    By: cacharle <marvin@42.fr>                    +#+  +:+       +#+         #
#                                                 +#+#+#+#+#+   +#+            #
#    Created: 2019/11/22 03:04:28 by cacharle          #+#    #+#              #
#    Updated: 2019/11/22 21:18:38 by cacharle         ###   ########.fr        #
#                                                                              #
# **************************************************************************** #

.globl _ft_strcpy

# char *ft_strcpy(char *dst, const char *src);
_ft_strcpy:
	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
	mov byte ptr [rax + rcx], 0
	ret