-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_write.s
35 lines (30 loc) · 1.15 KB
/
ft_write.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
# **************************************************************************** #
# #
# ::: :::::::: #
# ft_write.s :+: :+: :+: #
# +:+ +:+ +:+ #
# By: masboula <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/03/25 14:52:07 by masboula #+# #+# #
# Updated: 2021/03/25 14:52:08 by masboula ### ########.fr #
# #
# **************************************************************************** #
bits 64
extern __errno_location
section .text
global ft_write
ft_write :
mov rax, 1
syscall
cmp rax, 0
jl _error
ret
_error :
push rdi
neg rax
mov rdi, rax
call __errno_location wrt ..plt
mov [rax], rdi
mov rax, -1
pop rdi
ret