1、此文档仅供收集于网络,如有侵权请联系网站删除 第四章1、内存有一个字节变量VAL中存放着小写字符a,请将该字符转换为大写字符并在屏幕中显示出来(要求在debug中调试出该程序)。DATA SEGMENTVAL DB aDATA ENDSCODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX MOV BL,32 SUB VAL,BL ;变为大写字母 MOV DL,VAL MOV AH,02H ;输出字符 INT 21H MOV AH,4CH INT 21HCODE ENDS END START运行结果:2、设存储单元A和B
2、各有一带符号字节数,比较大小和正负,要求将较大数送RES1单元;如果有负数,将一个负数送RES2,否则RES2送-1(要求在debug中调试出该程序)DATA SEGMENTA DB 05HB DB -20HRES1 DB ?RES2 DB ?DATA ENDSCODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX MOV BL,A CMP BL,B JGE NEXT1 MOV AH,B MOV AL,A JMP NEXT2 NEXT1:MOV AH,A MOV AL,B NEXT2:CMP AL,0 JL NEXT3
3、MOV RES2,-1 JMP EXIT NEXT3:MOV RES2,AL EXIT :MOV AH,4CH INT 21HCODE ENDS END START 第五章1、在STR到STR+99单元中存放着一个字符串,试编写程序测试该字符串中是否有数字,若有将CL置1,否则CL置0 (要求在debug中调试出该程序)。 DATA SEGMENTSTR DB abfdeksjfs lsjsjsjsjsfjlkasdjflkfafkljkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffCODE SEGMENT ASSU
4、ME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA SI,STR MOV CX,100 DEC SI LOOP1: INC SI MOV AL,SI CMP AL,30H JAE NEXT1 LOOP LOOP1 NEXT1: CMP AL,39H JNAE NEXT2 LOOP LOOP1 MOV CL,0 JMP EXIT NEXT2: MOV CL,1 EXIT: MOV AH,4CH INT 21HCODE ENDS END START2、在字节数组中找出第一个负数,并将该负数存入RES单元中;假设该数组中包含20个带符号数,且至少有
5、1个负数(要求在debug中调试出该程序)。DATA SEGMENTSTR DB 1H,2H,3H,10H,15H,-13H,52H,-34H,42H,72H,-81H,66H,45H,-63H,25H,94H,62H,28H,57H,-54HRES DB ?CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX MOV CX,20 MOV SI,-1 LOOP1: INC SI MOV BL,STRSI CMP BL,0 JL NEXT1 LOOP LOOP1 JMP EXIT NEXT1: MOV RES,BL EX
6、IT: MOV AH,4CH INT 21HCODE ENDS END START 第六章1、试编写一个汇编程序,能对键盘输入的小写字母用大写字母显示出来(要求采用子程序格式,即采用子程序完成将小写字母转化成大写字母)。DATA SEGMENTRES DB ?DATA ENDSCODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX CALL STR STR PROC NEAR MOV AH,01 INT 21H MOV RES,AL SUB RES,32 MOV DL,RES MOV AH,02 INT 21H MOV
7、AH,4CH INT 21HCODE ENDS END START 2、有2个数组:ary1 db 12,-35,0,126,-90,-5,68,120,1,-19ary2 db 24,25,0,-38,-89,99,68,100,2,-20比较两个数组的对应位,将大的数放在ary1数组中,小的数放在ary2中(要求采用子程序格式)DATA SEGMENTARY1 DB 12,-35,0,126,-90,-5,68,120,1,-19ARY2 DB 24,25,0,-38,-89,99,68,100,2,-20ARY3 DB 10 DUP(?) DATA ENDSCODE SEGMENT AS
8、SUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA SI,ARY1 LEA DI,ARY2 LEA BX,ARY3 MOV CX,10 DEC SI DEC DI DEC BX LOOP1: INC SI INC DI INC BX CALL STR LOOP LOOP1 STR PROC NEAR MOV AL,DI CMP SI,AL JL NEXT1 JMP NEXT2 NEXT1: MOV BX,AL MOV AH,SI MOV DI,AH MOV SI,AL NEXT2: RET STR ENDP MOV AH,4CH INT 21HCODE ENDS END START 第七章用DOS的10号功能调用输入一个字符串,并用DOS的9号功能调用将这个字符串输出到屏幕上显示。DATA SEGMENTMAXLEN DB 20,0,20 DUP ($) DATA ENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:MOVAX,DATAMOVDS,AXMOVDX,OFFSET MAXLENMOVAH,0AHINT21H MOV DX,OFFSET MAXLEN+2 MOV AH,09H INT 21HMOVAH,4CHINT21HCODEENDSENDSTART 只供学习与交流