-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_puts.s
46 lines (38 loc) · 1.37 KB
/
ft_puts.s
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# **************************************************************************** #
# #
# ::: :::::::: #
# ft_puts.s :+: :+: :+: #
# +:+ +:+ +:+ #
# By: vtarasiu <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/07/19 14:24:09 by vtarasiu #+# #+# #
# Updated: 2019/07/19 17:49:49 by vtarasiu ### ########.fr #
# #
# **************************************************************************** #
global ft_puts
global _ft_puts
extern _ft_strlen
ft_puts:
_ft_puts:
push rbp
mov rbp, rsp
push rdi
call _ft_strlen
mov rdx, rax
pop rsi
mov rax, 0x2000004 ; 'write' syscall number
mov rdi, 1 ; fd
; rsi string pointer
; rdx string len
syscall
mov rax, 0x2000004
mov rdi, 1
lea rsi, [rel newline.nl]
mov rdx, 1
syscall
mov rdi, rsi
pop rbp
ret
segment .data
newline:
.nl db 0xA