home *** CD-ROM | disk | FTP | other *** search
- ;
- ; *** Listing 10-4 ***
- ;
- ; Searches a word-sized array for the first element
- ; greater than 10,000, using non-string instructions.
- ;
- jmp Skip
- ;
- WordArray dw 1000 dup (0), 10001
- ;
- Skip:
- call ZTimerOn
- mov di,offset WordArray-2
- ;start 1 word early so the
- ; first preincrement points
- ; to the first element
- mov ax,10000 ;value we'll compare with
- SearchLoop:
- inc di ;point to the next element
- inc di
- cmp ax,[di] ;compare the next element
- ; to 10,000
- jae SearchLoop ;if not greater than 10,000,
- ; do the next element
- call ZTimerOff