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