-
Notifications
You must be signed in to change notification settings - Fork 0
/
read_from_user_input.asm
62 lines (52 loc) · 1009 Bytes
/
read_from_user_input.asm
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
%define s_exit 60
%define s_read 0
%define s_print 1
%define newline 10
section .data
askInfo db "Please enter something to print: "
askInfoL equ $-askInfo
prefixToUserInput db "Your provided string was --> "
prefixToUserInputL equ $-prefixToUserInput
section .bss
buff resb 100
section .text
global main
main:
call printAskInfo
call getUserInput
call printPrefixToUserInput
call printUserInput
call exit
exit:
mov rax, s_exit
mov rdi, 0
syscall
ret
printAskInfo:
mov rax, s_print
mov rdi, 1
mov rsi, askInfo
mov rdx, askInfoL
syscall
ret
getUserInput:
mov rax, s_read
mov rdi, 0
mov rsi, buff
mov rdx, 100
syscall
ret
printPrefixToUserInput:
mov rax, s_print
mov rdi, 1
mov rsi, prefixToUserInput
mov rdx, prefixToUserInputL
syscall
ret
printUserInput:
mov rax, s_print
mov rdi, 1
mov rsi, buff
mov rdx, 100
syscall
ret