aboutsummaryrefslogtreecommitdiff
path: root/ft_strcpy.s
blob: 5d32f2daf1ed9bc12f2a9d3a3378f5bf9339e916 (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
28
29
30
; **************************************************************************** ;
;                                                                              ;
;                                                         :::      ::::::::    ;
;    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        ;
;                                                                              ;
; **************************************************************************** ;

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
	mov rcx, -1
	FT_STRCPY_LOOP:
		inc rcx
		mov dl, byte [rbx + rcx]
		mov byte [rax + rcx], dl
		cmp byte [rbx + rcx], 0
		jne FT_STRCPY_LOOP
	pop rcx
	pop rbx
	ret