initial import
[staff/goc4/2018bti7061.git] / asm-8-strings / examples / clib / eatclib.asm
1 extern printf
2 extern scanf
3 section .data
4
5 a db "set: ", 0
6 b db "not set: ", 0
7 reading db "Please enter a number: ", 0
8 message db "\n", 0
9 printsent db "%s", 10, 0
10 printint db "%d", 10, 0
11 printchar db "%c", 10, 0
12
13 readInt db "%d", 0
14 input db "%d", 0
15
16 section .text
17 global main
18
19 main:
20
21 hatta:
22 push rbp,
23 mov rbp, rsp,
24 push rbx,
25 xor rax, rax,
26 mov rdi, printsent,
27 mov rsi, reading
28 call printf,
29 pop rbx,
30
31 xor rax, rax,
32 mov rdi, readInt,
33 call scanf,
34 mov rbx, rdi
35
36 push rbx,
37 xor rax, rax,
38 mov rdi, printint,
39
40 mov rsi, rbx,
41 call printf,
42 pop rbx,
43
44 pop rbp,
45 ret
46