您的位置:首页 > 其它

查找键值为key的元素

2014-04-26 17:53 423 查看
;
;查找键值为key的元素
; author:  wangguolaing
; date:  revised 4/14

.386
.MODEL FLAT

INCLUDE io.h
includelib Kernel32.lib
ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD

cr          EQU    0dh
Lf          EQU    0ah
maxNbrs     EQU    100

.STACK      4096

.DATA
Array    DWORD   23,12,5,-78,27,33,4,32
count    DWORD   ?
Lable    BYTE    cr,Lf,'Can not find the key',cr,Lf,Lf,0

keyLable BYTE    cr,Lf,Lf,'The key is in : '
su       BYTE    11 DUP (?)

.CODE
_start:
mov eax,27          ;键值key
mov edx,0
lea ebx,Array

whilenot    :
inc edx
;mov ecx,count
cmp edx,9
je  endthat

cmp eax,[ebx]
je endwhile
add ebx,4
jmp whilenot

endwhile    :
mov eax,edx
dtoa su,eax
output keyLable
jmp quit

endthat     :
output Lable

quit:       INVOKE ExitProcess, 0   ; exit with return code 0

PUBLIC _start                       ; make entry point public
END                     ; end of source code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  80x86 汇编语言