资源描述:
《微机原理实验五 字符串匹配程序》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、实验五字符串匹配程序一、要求:编写程序,实现两个字符串比较。若相同,则显示’MATCH’,否则显示’NOMATCH’。二、目的:掌握提示信息的使用方法及键盘输入信息的用法。程序CRLFMACROMOVDL,0DHMOVAH,02HINT21HMOVAH,02HMOVDL,0AHINT21HENDMDATASEGMENTMESS1DB'MATCH',0DH,0AH,'$'MESS2DB'NOMATCH',0DH,0AH,'$'MESS3DB'INPUTSTRING1!',0DH,0AH,'$'MESS4DB'INP
2、UTSTRING2!',0DH,0AH,'$'MAXLEN1DB81STRING1DB81DUP(?)MAXLEN2DB81STRING2DB81DUP(?)DATAENDSSTACKSEGMENTSTADB64DUP(?)TOPEQULENGTHSTASTACKENDSCODESEGMENTASSUMECS:CODE,DS:DATA,ES:DATA,SS:STACKSTART:MOVAX,DATAMOVDS,AXMOVES,AXMOVAX,STACKMOVSS,AXMOVAX,TOPMOVSP,AXMOVAH,
3、09HMOVDX,OFFSETMESS3INT21HMOVAL,MAXLEN1MOVBX,OFFSETSTRING1MOV[BX],ALMOVAH,0AHMOVDX,OFFSETSTRING1INT21HCRLFMOVAH,09HMOVDX,OFFSETMESS4INT21HMOVAL,MAXLEN2MOVBX,OFFSETSTRING2MOV[BX],ALMOVAH,0AHMOVDX,OFFSETSTRING2INT21HCRLFCLDLEASI,STRING1MOVCL,[SI+1]MOVCH,0KKK:LE
4、ADI,STRING2MOVDL,[DI+1]MOVDH,0ZJ2:MOVAL,[SI+2]CMP[DI+2],ALJEZJ3ZJ1:INCDIDECDXJZGGGJMPZJ2ZJ3:DECCXJZMMMDECDXJZGGGINCSIINCDIMOVAL,[SI+2]CMP[DI+2],ALJEZJ3DECDXJZGGGLEASI,STRING1MOVCL,[SI+1]MOVCH,0INCDIJMPZJ2MMM:MOVAH,09HMOVDX,OFFSETMESS1INT21HJMPPPPGGG:MOVAH,09H
5、MOVDX,OFFSETMESS2INT21HPPP:MOVAX,4C00HINT21HCODEENDSENDSTART