386 model flat stdcall includelib kernel32 lib ExitProcess PROTO DWORD

 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
.386
.model flat, stdcall
includelib kernel32.lib
ExitProcess PROTO ,:DWORD
.data
arr dd 4,5,-13,3
N=4
res db N dup (0)
.code
Winmain PROC
lea ebx, arr
xor edi, edi
mov ecx, N
lea eax, res
cycle:
push eax
xor eax, eax
mov eax, [ebx]
push ecx
mov ecx, 16
mov cl, 16
cycle1:
dec cl
sar eax, cl
and eax, 1
test eax, 1
jne x
inc edi
x:
loop cycle1
pop ecx
pop eax
mov [eax], edi
add ebx, 4
add eax, 2
loop cycle
push 0
call ExitProcess
Winmain endp
end Winmain