汇编实验集锦(共18页).doc
《汇编实验集锦(共18页).doc》由会员分享,可在线阅读,更多相关《汇编实验集锦(共18页).doc(18页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、精选优质文档-倾情为你奉上1-1.将存放在数据段中的变量VAR1中的三个数,传送到该段中的变量VAR2中。DATA SEGMENT VAR1 DW 35,24,0451H VAR2 DW 3DUP(?)DATA ENDSCODE SEGMENT ASSUME DS:DATA,CS:CODE START: MOV AX,DATA MOV DS,AX LEA SI,VAR1 LEA DI,VAR2 MOV AX,SI MOV DI,AX ADD SI,2 ADD DI,2 MOV AX,SI MOV DI,AX ADD SI,2 ADD DI,2 MOV AX,SI MOV DI,AX MOV A
2、H,4CH INT 21HCODE ENDS END START1-2.将存放在数据段STR1的字符串“ABCDEF”传送到该段的STR2储存区中,DATA SEGMENT STR1 DB “ABCDEF” STR2 DB 6 DUP(?)DATA ENDSCODE SEGMENT ASSUME DS:DATA,CS:CODE START: MOV AX,DATA MOV DS,AX LEA SI, STR1 LEA DI, STR2 REST: MOV AL,SIMOV DI,ALINC SIINC DIDEC CXJNZ RESTMOV AH,4CH INT 21H CODE ENDS E
3、ND START2-1.从键盘输入一个数字就会自动输出两个相同的数字。DSEG SEGMENT STRBUF DB 10 DUP(?)DSEG ENDSCSEG SEGMENT ASSUME CS:CSEG,DS:DSEGSTART:MOV AX,DSEG MOV DS,AX MOV CX,10 MOV DI,0REST:MOV AH,01H INT 21H MOV STRBUFDI,AL MOV DL,AL MOV AH,02H INT 21H INC DI LOOP REST MOV AH,4CH INT 21HCSEG ENDS END START2-2.程序示例:从键盘输入10个数字,
4、并且存入STRBUF缓冲区中,并将这十个字符显示。DSEG SEGMENT STRBUF DB 10DUP(?)DSEG ENDSCSEG SEGMENT ASSUME CS:CSEG,DS:DSEGSTART: MOV AX,DSEG MOV DS,AX MOV CX,10 MOV DI,0RSET: MOV AH,01H INT 21H MOV STRBUFDI,AL MOV DL,AL MOV AH,02H INT 21H INC DI LOOP REST MOV AH,4CH INT 21HCSEG ENDS END START3-1.将实验一中的寄存器间接寻址改为寄存器直接寻址。并将
5、实验二中的寄存器相对寻址改为基址变址寻址。实验一:DATA SEGMENT VAR1 DW 35,24,0451H VAR2 DW 3 DUP(?)DATA ENDSCODE SEGMENT ASSUME DS:DATA,CS:CODESTART:MOV AX,DATA MOV DS,AX MOV DI,0 MOV AX,VAR1DI MOV SI,0 MOV VAR2SI,AX ADD SI,2 ADD DI,2 MOV AX,SI MOV DI,AX ADD SI,2 ADD DI,2 MOV AX,SI MOV DI,AX MOV AH,4CH INT 21HCODE ENDS END
6、START实验二:DSEG SEGMENT STRBUF DB 10 DUP(?)DSEG ENDSCSEG SEGMENT ASSUME CS:CSEG,DS:DSEGSTART:MOV AX,DSEG MOV DS,AX MOV CX,10 MOV DI,0REST:MOV AH,01H INT 21H LEA BX,STRBUF MOV SI,DI MOV BXSI,AL MOV DL,AL MOV AH,02H INT 21H INC DI LOOP REST MOV AH,4CH INT 21HCSEG ENDS END START3-2.完成将一个一位十进制数转换成ASC码存入单元
7、ASC中。DATA SEGMENT TAB DB 40H,79H,24H,30H,19H DB 12H,02H,78H,00H,18H DEN DB 6 NUM DB ?DATA ENDSCODE SEGMENT ASSUME DS:DATA,CS:CODESTART:MOV AX,DATA MOV DS,AX LEA BX,TAB MOV AL,DEN XLAT MOV NUM,AL MOV AH,4CH INT 21HCODE ENDS END START4-1.计算(X+(Y*Z-100)/W其中:X,Y,Z,W均为十六位有符号数,其储存形式如下, X DW -13Y DW 30Z DW
8、 24W DW 50DSEG SEGMENTX DW -13Y DW 30Z DW 24W DW 50 。DSEG ENDSCSEG SEGMENT ASSUME CS:CSEG,DS:DSEGSTART:MOV AX,Y IMUL Z MOV CX,AX MOV BX,DX MOV AX,X CWD ADD CX,AX ADC BX,DX SUB CX,100 CWD SUB AX,CX SBB DX,BX IDIV WCSEG ENDS END START4-2.设X,Y,Z均为双精度数,它们分别存在X,X+2,Y,Y+2,Z,Z+2储存单元中,存放时高位字存放在高地址,低位字存放在低地址
9、,编写程序实现下面表达式的计算:X+(Y-Z)=WDSEG SEGMENTX DW -13,-13Y DW 30,30Z DW 24,24W DW 50,50DSEG ENDSCSEG SEGMENT ASSUME CS:CSEG,DS:DSEGSTART:MOV AX,X MOV DX,X+2 ADD AX,Y ADC DX,Y+2 SUB AX,Z SBB DX,Z+2 MOV W,AX MOV W+2,DX CSEG ENDS END START5-1.、编写完整程序,从键盘输入一个字符串STRING,同时,把字符串 STRING中的&字符用空格符替代.EXDATA SEGMENT ST
10、RING DB 8 DUP(?) ADDR DW ? DC DB ?,?EXDATA ENDSCODE SEGMENT ASSUME ES:EXDATA,CS:CODESTART:MOV AX,EXDATA MOV ES,AX MOV CX,8 MOV DI,0AGAIN:MOV AH,01H INT 21H MOV STRINGDI,AL INC DI LOOP AGAIN LEA DI,STRING MOV CX,8 CLD MOV AL,& REPNZ SCASB MOV AL, XCHG AL,STRINGDI-1 MOV SI,0 MOV BX,8 SUB BX,CX MOV ADD
11、R,BX MOV CX,8REST: MOV AH,02H MOV AL,STRINGSI MOV DL,AL INT 21H INC SI LOOP REST ADD BX,30H AND BX,00FFH MOV DL,BX MOV AH,02H INT 21H MOV AH,4CH INT 21HCODE ENDSEND START5-2.编写完整程序,从键盘输入两串字符OLDS和NEWS,如果两个字符串相同显示“YES”串,不同显示“NO”串。DATA SEGMENT OLDS DB 8 DUP(?) NEWS DB 8 DUP(?)DATA ENDSCODE SEGMENT ASSU
12、ME DS:DATA,CS:CODESTART:MOV AX,DATA MOV DS,AX MOV CX,10H CLD MOV DI,0REST1: MOV AX,01H INT 21H MOV OLDSDI,AL INC DI LOOP REST1 MOV DI,0 MOV CX,10REST2: MOV AX,01H INT 21H MOV NEWSDI,AL INC DI LOOP REST2 MOV CX,8 LEA SI,WORD PTR OLDS LEA DI,WORD PTR NEWS CLD REPZ CMPSB JNZ BUTONG MOV SI,0 CLD MOV CX,
13、8AGAIN1: MOV AH,02H MOV DL,OLDSSI INT 21H INC SI LOOP AGAIN1 JMP EDBUTONG: MOV SI,0 CLD MOV CX,8AGAIN2: MOV AH,02H MOV DL,NEWSSI INT 21H INC SI LOOP AGAIN2ED: MOV AH,4CH INT 21HCODE ENDSEND START6-1. 数组ARRAY存放着10个字数据,求数组的最大数和最小数,并分别存放在变量MAX和MIN中。DATA SEGMENT ARRAY DB 1,2,13,14,5,6,7,8,11,10 MAX DB ?
14、 MIN DB ?DATA ENDSCODE SEGMENT ASSUME DS:DATA,CS:CODESTART: MOV AX,DATA MOV DS,AX MOV DI,1 MOV AL,ARRAY MOV AH,ARRAYDI MOV CX,9 CMP AL,AH JAE DAXIAO: MOV MIN,AL MOV BL,MIN MOV MAX,AH MOV BH,MAX JMP GOONDA: MOV MAX,AL MOV AH,MAX MOV MIN,AH MOV BL,MINGOON: INC DI MOV DL,ARRAYDI CMP DL,MAX JAE BIG CMP
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 汇编 实验 集锦 18
限制150内