微机原理与接口技术设计实验(12页).doc
《微机原理与接口技术设计实验(12页).doc》由会员分享,可在线阅读,更多相关《微机原理与接口技术设计实验(12页).doc(12页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、-实验一:编写程序,比较两个字符串STRING1和STRING2所含的字符是否相同,若字符相同则显示“Match”,否则显示“No Match”参考程序:DATA SEGMENTSTRING1 DB HAPPY ASMLEN EQU $-STRING1STRING2 DB HAPPY ASMMESSAGE1 DB MATCH,0DH,0AH,$MESSAGE2 DB NO MATCH,0DH,0AH,$DATA ENDSCODE SEGMENT ASSUME CS:CODE,DS:DATA,ES:DATASTART:MOV AX,DATAMOV DS,AXMOV ES,AXLEA SI,STR
2、ING1LEA DI,STRING2MOV CX,LENCOMPARE:MOV AL,SIMOV BL,DICMP AL,BLJNE DISMATCHINC SIINC DILOOP COMPAREMATCH:LEA DX,MESSAGE1JMP DISPDISMATCH:LEA DX,MESSAGE2DISP: MOV AH,09HINT 21HMOV AH,4CHINT 21HCODE ENDSEND START实验二:编写程序,从键盘输入一串字符,以$或回车结束,将其中的小写字母转变为大写字母,其余字符不做转换,原样输出,结果显示在屏幕上。参考程序:DATA SEGMENTBUF DB
3、50 DB ? DB 50 DUP(?)INPUTSTRING DB PLEASE INPUT A STRING:,$OUTPUTSTRING DB OUTPUTSTRING IS:,$ENTERSTRING DB 0DH,0AH,$DATA ENDSCODE SEGMENTASSUME CS:CODE,DS:DATASTART:MOV AX,DATAMOV DS,AXLEA DX,INPUTSTRINGMOV AH,09HINT 21HLEA DX,BUFMOV AH,0AHINT 21HLEA DX,ENTERSTRINGMOV AH,09HINT 21H LEA BX,BUFADD BX
4、,2NEXT1:MOV AL,BXINC BXCOMPARE:CMP AL,24H JZ DISP CMP AL,61H JB NEXT1 CMP AL,7AH JA NEXT1 SUB AL,20H MOV BX-1,AL JMP NEXT1DISP:LEA DX,OUTPUTSTRING MOV AH,09H INT 21H LEA DX,BUF+2 MOV AH,09H INT 21H MOV AH,4CH INT 21HCODE ENDSEND START实验三:利用子程序方法编写程序,设有10个无符号数的字节序列,查找该序列中的最大值和最小值,并把结果显示在屏幕上。参考程序1:(针对
5、一位10进制数)STACK SEGMENT STACKDW 256 DUP(?) TOP LABEL WORDSTACK ENDSDATA SEGMENTBUF DB 00H,01H,02H,03H,04HDB 05H,06H,07H,08H,09HCOUNT EQU $-BUFENTERSTRING DB 0DH,0AH,$MAXSTRING DB THE MAXIMUN NUMBER IS:,$MINSTRING DB THE MINIMUN NUMBER IS:,$DATA ENDSCODE SEGMENTASSUME CS:CODE,DS:DATA,SS:STACKSTART:MOV
6、AX,DATAMOV DS,AXMOV AX,STACKMOV SS,AXLEA SP,TOPMOV SI,OFFSET BUFMOV CX,COUNTCALL BRANCHPUSH AXLEA DX,MAXSTRINGMOV AH,09HINT 21HPOP AXMOV DL,AHADD DL,30HPUSH AXMOV AH,02HINT 21HLEA DX,ENTERSTRINGMOV AH,09HINT 21HLEA DX,MINSTRINGMOV AH,09HINT 21HPOP AXMOV DL,ALADD DL,30HMOV AH,02HINT 21HMOV AH,4CHINT
7、21HBRANCHPROC NEARJCXZ NEXT4PUSH SIPUSH CXPUSH BXMOV BH,SIMOV BL,BHCLDNEXT1:LODSBCMP AL,BHJBE NEXT2MOV BH,ALJMP NEXT3NEXT2:CMP AL,BLJAE NEXT3MOV BL,ALNEXT3:LOOP NEXT1MOV AX,BXPOP BXPOP CXPOP SINEXT4:RETBRANCHENDPCODE ENDS END START参考程序二:(针对两位十六进制数或无符号数)STACK SEGMENT STACKDW 256 DUP(?) TOP LABEL WORD
8、STACK ENDSDATA SEGMENTBUF DB 0FFH,55H,33H,44H,54HDB 45H,46H,47H,48H,1AHCOUNT EQU $-BUFENTERSTRING DB 0DH,0AH,$MAXSTRING DB THE MAXIMUN NUMBER IS:,$MINSTRING DB THE MINIMUN NUMBER IS:,$DATA ENDSCODE SEGMENTASSUME CS:CODE,DS:DATA,SS:STACKSTART:MOV AX,DATAMOV DS,AXMOV AX,STACKMOV SS,AXLEA SP,TOPMOV SI,
9、OFFSET BUFMOV CX,COUNTCALL BRANCHMOV DX,AXPUSH DXLEA DX,MAXSTRINGMOV AH,09HINT 21HPOP DXMOV AL,DHPUSH DXCALL DISPGAO4POP DXMOV AL,DHPUSH DXCALL DISPDI4LEA DX,ENTERSTRINGMOV AH,09HINT 21HLEA DX,MINSTRINGMOV AH,09HINT 21HPOP DXMOV AL,DLPUSH DXCALL DISPGAO4POP DXMOV AL,DLCALL DISPDI4MOV AH,4CHINT 21HBR
10、ANCHPROC NEARJCXZ NEXT4PUSH SIPUSH CXPUSH BXMOV BH,SIMOV BL,BHCLDNEXT1:LODSBCMP AL,BHJBE NEXT2MOV BH,ALJMP NEXT3NEXT2:CMP AL,BLJAE NEXT3MOV BL,ALNEXT3:LOOP NEXT1MOV AX,BXPOP BXPOP CXPOP SINEXT4:RETBRANCHENDPDISPDI4PROC NERR ;低四位AND AL,0FHMOV DL,ALCMP DL,9JLE NUM1ADD DL,7NUM1:ADD DL,30HMOV AH,02HINT
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 微机 原理 接口 技术设计 实验 12
限制150内