INCLUDE C:\IRVINE\IRVINE32.INC
.386
.STACK 4096
EXITPROCESS PROTO,DWEXITCODE:DWORD
.DATA
array DWORD 1,0,0,-4,-18,0,4,0,23,0,-4,-5
string1 byte "positive values are: ",0
string2 byte "negative values are: ",0
string3 byte "number of zeros are: ",0
pos DWORD 0
nega DWORD 0
zero DWORD 0
.CODE
MAIN PROC
mov edx,OFFSET array
mov ecx, LENGTHOF array
mov esi,0
l1:
cmp ecx,0
je next
mov eax,array[esi]
cmp eax,0
je zeroo
jl neg1
inc pos
add esi,4
dec ecx
jmp l1
neg1:
inc nega
add esi,4
dec ecx
jmp l1
zeroo:
inc zero
add esi,4
loop l1
next:
mov edx,OFFSET string1
call WriteString
mov eax,pos
call WriteInt
call crlf
mov edx,OFFSET string2
call WriteString
mov eax,nega
call WriteInt
call crlf
mov edx,OFFSET string3
call WriteString
mov eax,zero
call WriteInt
INVOKE EXITPROCESS,0
MAIN ENDP
END MAIN
No comments:
Post a Comment