-
Notifications
You must be signed in to change notification settings - Fork 0
/
operations.asm
69 lines (54 loc) · 892 Bytes
/
operations.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
63
64
65
66
67
68
69
BITS 32
extern printf
extern scanf
section .data
fmt: db "%d",0
sum: db "sum is %d",10,0
difference: db "difference is %d",10,0
product: db "product is %d",10,0
divide:db "qoutient is %d",10,0
remainder:db "remainder is %d",10,0
section .text
global main
main:
push ebp
mov ebp,esp
lea eax, [ebp-0x4]
push eax
push fmt
call scanf
lea edx, [ebp-0x8]
push edx
push fmt
call scanf
mov ebx, dword [ebp-0x4]
mov eax, dword [ebp-0x8]
add eax, ebx
push eax
push sum
call printf
mov ebx, dword [ebp-0x4]
mov eax, dword [ebp-0x8]
sub ebx,eax
push ebx
push difference
call printf
mov ebx, dword [ebp-0x4]
mov eax, dword [ebp-0x8]
mul ebx
push eax
push product
call printf
mov edx, 0
mov eax, dword [ebp-0x4]
mov ecx, dword [ebp-0x8]
div ecx
mov ebx, edx
push eax
push divide
call printf
push ebx
push remainder
call printf
leave
ret