-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLAB1.asm
More file actions
115 lines (87 loc) · 2.43 KB
/
LAB1.asm
File metadata and controls
115 lines (87 loc) · 2.43 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
format PE console
entry start
include 'win32a.inc'
section '.data' data readable writeable
resStr db 'result: %d ', 10, 13
;1.1
a dd 10
b dd 27
numb db 101b
;1.2
sum dd 0
dif dd 0
pon dd 1
rem dd ?
quo dd ?
NULL = 0
section '.code' code readable executable
start:
;1.3
mov eax, [a]
add eax, [b]
mov [sum], eax
push [sum]
push resStr
call[printf]
;1.4
mov eax, 0
mov eax, [a]
sub eax, [b]
mov [dif], eax
push [dif]
push resStr
call[printf]
;1.5
mov eax, 0
mov eax, [a]
mov ebx, [b]
neg ebx
sub eax, ebx
push eax
push resStr
call [printf]
;1.6
mov eax, 0
mov eax, [a]
imul eax, ebx
mov [pon], eax
push [pon]
push resStr
call [printf]
;1.7
mov eax, 0
mov eax, [b]
div [a]
mov [rem], eax
mov [quo], edx
push [rem]
push resStr
call [printf]
push [quo]
push resStr
call [printf]
;1.8 0111
mov edx, [rem]
or edx, 10001110b
and edx, 01101010b
push edx
push resStr
call[printf]
;1.9
mov eax, 0
mov eax, edx
xor eax, eax
push eax
push resStr
call[printf]
call[getch]
push NULL
call [ExitProcess]
section '.idata' import data readable
library kernel, 'kernel32.dll',\
msvcrt, 'msvcrt.dll'
import kernel,\
ExitProcess, 'ExitProcess'
import msvcrt,\
printf, 'printf',\
getch, '_getch'