-
Notifications
You must be signed in to change notification settings - Fork 1
/
arryScan.asm
executable file
·38 lines (30 loc) · 750 Bytes
/
arryScan.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
TITLE Scanning an Array - J. Gavin Ray (6/14/12)
INCLUDE Irvine32.inc
.data
;intArray SWORD 0,0,0,0,1,20,35,-12,66,4,0
;intArray SWORD 1,0,0,0
intArray SWORD 0,0,0,0
;intArray SWORD 0,0,0,1
noneMsg BYTE "A non-zero value was not found",0
.code
main PROC
mov ebx,OFFSET intArray ; point to the array
mov ecx,LENGTHOF intArray ; loop counter
L1:
cmp WORD PTR [ebx],0 ; compare value to zero
jnz found ; found a value
add ebx,2 ; point to next
loop L1 ; continue the loop
jmp notFound ; none found
found:
movsx eax,WORD PTR [ebx] ; otherwise, display it
call WriteInt
jmp quit
notFound:
mov edx,OFFSET noneMsg ; display "not found" message
call WriteString
quit:
call crlf
exit
main ENDP
END main