-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassemblyExercicioPratico
70 lines (54 loc) · 1.05 KB
/
assemblyExercicioPratico
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
63
64
65
66
67
68
69
70
add rdx,rbx,rdx = rdx+rbx
mov eax,[a]
mov ebx, [b]
mov ecx, [c]
mov edx, eax; rdx = a
add edx, ebx; rdx = a+b
add edx, ecx; rdx = a+b+c
mov [aux], edx
//assembly
extern printf
extern scanf
SECTION .data
str0 db "Entre com a: ", 0
str1 db "Entre com b: ", 0
str2 db "Entre com c: ", 0
str3 db "%d", 0
str4 db "a é maior que b", 13, 10, 0
str5 db "a é maior que c", 13, 10, 0 ;terminar de arrumar
str6 db "c é o maior", 13, 10, 0
str7 db "todos são iguais", 13, 10, 0
SECTION .bss
a resd 1
b resd 1
c resd 1
SECTION .text
global main
main:
push rbp
mov rbp, rsp
mov rdi, str0
mov rax, 0
call printf
mov rdi, str3
lea rsi, [a]
call scanf
mov rdi, str3
lea rsi, [b]
call scanf
mov rdi, str3
lea rsi, [c]
call scanf
mov eax, [a]
mov ebx, [b]
mov ecx, [c]
cmp eax, ebx
jle ELSE_EXT
mov, rdi, str4
mov rax, 0
call printf
jmp FIM_IF_EXT
ELSE_EXT:
mov eax, [a]
mov ebx, [b]
;terminar código, ver exemplo do exercicio