资源描述:
《微机原理和接口技术设计实验.doc》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、实验一:编写程序,比较两个字符串STRING1和STRING2所含的字符是否相同,若字符相同则显示“Match”,否则显示“NoMatch”参考程序:DATASEGMENTSTRING1DB'HAPPYASM'LENEQU$-STRING1STRING2DB'HAPPYASM'MESSAGE1DB'MATCH',0DH,0AH,'$'MESSAGE2DB'NOMATCH',0DH,0AH,'$'DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATA,ES:DATASTART:MOVAX,D
2、ATAMOVDS,AXMOVES,AXLEASI,STRING1LEADI,STRING2MOVCX,LENCOMPARE:MOVAL,[SI]MOVBL,[DI]CMPAL,BLJNEDISMATCHINCSIINCDILOOPCOMPAREMATCH:LEADX,MESSAGE1JMPDISPDISMATCH:LEADX,MESSAGE2DISP:MOVAH,09HINT21HMOVAH,4CHINT21HCODEENDSENDSTART实验二:编写程序,从键盘输入一串字符,以‘$’或回车结束,将其中的小写字母
3、转变为大写字母,其余字符不做转换,原样输出,结果显示在屏幕上。参考程序:DATASEGMENTBUFDB50DB?DB50DUP(?)INPUTSTRINGDB'PLEASEINPUTASTRING:','$'OUTPUTSTRINGDB'OUTPUTSTRINGIS:','$'ENTERSTRINGDB0DH,0AH,'$'DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:MOVAX,DATAMOVDS,AXLEADX,INPUTSTRINGMOVAH,09HINT21H
4、LEADX,BUFMOVAH,0AHINT21HLEADX,ENTERSTRINGMOVAH,09HINT21HLEABX,BUFADDBX,2NEXT1:MOVAL,[BX]INCBXCOMPARE:CMPAL,24HJZDISPCMPAL,61HJBNEXT1CMPAL,7AHJANEXT1SUBAL,20HMOV[BX-1],ALJMPNEXT1DISP:LEADX,OUTPUTSTRINGMOVAH,09HINT21HLEADX,BUF+2MOVAH,09HINT21HMOVAH,4CHINT21HCODE
5、ENDSENDSTART实验三:利用子程序方法编写程序,设有10个无符号数的字节序列,查找该序列中的最大值和最小值,并把结果显示在屏幕上。参考程序1:(针对一位10进制数)STACKSEGMENTSTACKDW256DUP(?)TOPLABELWORDSTACKENDSDATASEGMENTBUFDB00H,01H,02H,03H,04HDB05H,06H,07H,08H,09HCOUNTEQU$-BUFENTERSTRINGDB0DH,0AH,'$'MAXSTRINGDB'THEMAXIMUNNUMBERIS:'
6、,'$'MINSTRINGDB'THEMINIMUNNUMBERIS:','$'DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATA,SS:STACKSTART:MOVAX,DATAMOVDS,AXMOVAX,STACKMOVSS,AXLEASP,TOPMOVSI,OFFSETBUFMOVCX,COUNTCALLBRANCHPUSHAXLEADX,MAXSTRINGMOVAH,09HINT21HPOPAXMOVDL,AHADDDL,30HPUSHAXMOVAH,02HINT21HLEAD
7、X,ENTERSTRINGMOVAH,09HINT21HLEADX,MINSTRINGMOVAH,09HINT21HPOPAXMOVDL,ALADDDL,30HMOVAH,02HINT21HMOVAH,4CHINT21HBRANCHPROCNEARJCXZNEXT4PUSHSIPUSHCXPUSHBXMOVBH,[SI]MOVBL,BHCLDNEXT1:LODSBCMPAL,BHJBENEXT2MOVBH,ALJMPNEXT3NEXT2:CMPAL,BLJAENEXT3MOVBL,ALNEXT3:LOOPNEXT1
8、MOVAX,BXPOPBXPOPCXPOPSINEXT4:RETBRANCHENDPCODEENDSENDSTART参考程序二:(针对两位十六进制数或无符号数)STACKSEGMENTSTACKDW256DUP(?)TOPLABELWORDSTACKENDSDATASEGMENTBUFDB0FFH,55H,33H,44H,54HDB45H,46H,47H,4