| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1452 人关注过本帖
标题:汇编初学者 请教一个关于字符串比较的问题 cmpsb
取消只看楼主 加入收藏
情.难言ゝ
Rank: 3Rank: 3
来 自:安徽安庆
等 级:论坛游侠
威 望:1
帖 子:74
专家分:137
注 册:2013-9-8
结帖率:83.33%
收藏
已结贴  问题点数:3 回复次数:0 
汇编初学者 请教一个关于字符串比较的问题 cmpsb
我用记事本写了个汇编程序,为什么跟我想要的结果不一样,求各位大神帮帮忙。。。。

程序代码:
data   segment
       MAXLEN       db       22
       ACTLEN       db       ?
       STRING1      db       20 dup(?)  
       STRING2      db       20 dup(?) 
       mess1        db       'please input the frist string:','$'
       mess2        db       'please input the second string:','$'
       mess3        db       'MATCH!',13,10,'$'
       mess4        db       'NOT MATCH!',13,10,'$'
data   ends

code   segment
main   proc    far
       assume  cs:code,ds:data
start:
      
       push  ds
       sub   ax,ax
       push  ax

       mov   ax,data
       mov   ds,ax
;input the frist string
       mov   ah,9
       mov   dx,seg mess1
       mov   ds,dx
       mov   dx,offset mess1
       int   21h
       
       lea   dx,MAXLEN
       mov   ah,0ah
       int   21h
       
;input the second string
       mov   ah,9
       mov   dx,seg mess2
       mov   ds,dx
       mov   dx,offset mess2
       int   21h
       
       lea   dx,MAXLEN
       mov   ah,0ah
       int   21h
       
       lea   si,STRING1
       lea   di,STRING2

       cld
       mov   cx,20
       repe  cmpsb
       jnz   next

       mov   ah,9
       mov   dx,seg mess2
       mov   ds,dx
       mov   dx,offset mess3       
       jmp   exit
next:
       mov   ah,9
       mov   dx,seg mess4
       mov   ds,dx
       mov   dx,offset mess4

exit:
       
       ret
main   endp

code   ends
       end   start
搜索更多相关主题的帖子: 记事本 字符串 
2014-05-14 23:14
快速回复:汇编初学者 请教一个关于字符串比较的问题 cmpsb
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015550 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved