aboutsummaryrefslogtreecommitdiff
path: root/ft_strcpy.s
blob: a1aa4a8e485eada089eb6466460d5128ca1b2f15 (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