1、 第四章1、内存有一个字节变量 VAL 中存放着小写字符a,请将该字符转换为大写字符并在屏幕中显示出来(要求在 debug 中调试出该程序) 。DATA SEGMENTVAL DB aDATA ENDSCODE SEGMENTASSUME CS:CODE,DS:DATASTART: MOV AX,DATAMOV DS,AXMOV BL,32SUB VAL,BL ;变为大写字母MOV DL,VALMOV AH,02H ;输出字符INT 21HMOV AH,4CHINT 21HCODE ENDSEND START运行结果:2、设存储单元 A 和 B 各有一带符号字节数,比较大小和正负,要求将较大数
2、送 RES1 单元;如果有负数,将一个负数送 RES2,否则 RES2 送-1(要求在 debug 中调试出该程序)DATA SEGMENTA DB 05HB DB -20HRES1 DB ?RES2 DB ?DATA ENDSCODE SEGMENTASSUME CS:CODE,DS:DATASTART: MOV AX,DATAMOV DS,AXMOV BL,ACMP BL,BJGE NEXT1MOV AH,BMOV AL,AJMP NEXT2NEXT1:MOV AH,AMOV AL,BNEXT2:CMP AL,0JL NEXT3MOV RES2,-1JMP EXITNEXT3:MOV RE
3、S2,ALEXIT :MOV AH,4CHINT 21HCODE ENDSEND START第五章1、在 STR 到 STR+99 单元中存放着一个字符串,试编写程序测试该字符串中是否有数字,若有将 CL 置 1,否则 CL 置 0 (要求在 debug 中调试出该程序) 。DATA SEGMENTSTR DB abfdeksjfs lsjsjsjsjsfjlkasdjflkfafkljkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffCODE SEGMENTASSUME CS:CODE,DS:DATASTART: M
4、OV AX,DATAMOV DS,AXLEA SI,STRMOV CX,100DEC SILOOP1: INC SIMOV AL,SICMP AL,30HJAE NEXT1LOOP LOOP1NEXT1: CMP AL,39HJNAE NEXT2LOOP LOOP1MOV CL,0JMP EXITNEXT2: MOV CL,1EXIT: MOV AH,4CHINT 21HCODE ENDSEND START2、在字节数组中找出第一个负数,并将该负数存入 RES 单元中;假设该数组中包含 20 个带符号数,且至少有 1 个负数(要求在 debug 中调试出该程序) 。DATA SEGMENTST
5、R DB 1H,2H,3H,10H,15H,-13H,52H,-34H,42H,72H,-81H,66H,45H,-63H,25H,94H,62H,28H,57H,-54HRES DB ?CODE SEGMENTASSUME CS:CODE,DS:DATASTART: MOV AX,DATAMOV DS,AXMOV CX,20MOV SI,-1LOOP1: INC SIMOV BL,STRSICMP BL,0JL NEXT1LOOP LOOP1JMP EXITNEXT1: MOV RES,BLEXIT: MOV AH,4CHINT 21HCODE ENDSEND START第六章1、试编写一个
6、汇编程序,能对键盘输入的小写字母用大写字母显示出来(要求采用子程序格式,即采用子程序完成将小写字母转化成大写字母) 。DATA SEGMENTRES DB ?DATA ENDSCODE SEGMENTASSUME CS:CODE,DS:DATASTART: MOV AX,DATAMOV DS,AXCALL STRSTR PROC NEARMOV AH,01INT 21HMOV RES,ALSUB RES,32MOV DL,RESMOV AH,02INT 21HMOV AH,4CHINT 21HCODE ENDSEND START2、有 2 个数组:ary1 db 12,-35,0,126,-9
7、0,-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 SEGMENTASSUME CS:CODE,DS:DATASTART: MOV AX,DATAMOV DS,AXLEA SI,ARY1LEA
8、DI,ARY2LEA BX,ARY3MOV CX,10DEC SIDEC DIDEC BXLOOP1: INC SIINC DIINC BXCALL STRLOOP LOOP1STR PROC NEARMOV AL,DICMP SI,ALJL NEXT1JMP NEXT2NEXT1: MOV BX,ALMOV AH,SI MOV DI,AHMOV SI,ALNEXT2: RETSTR ENDPMOV AH,4CHINT 21HCODE ENDSEND START第七章用 DOS 的 10 号功能调用输入一个字符串,并用 DOS 的 9 号功能调用将这个字符串输出到屏幕上显示。DATA SEGMENTMAXLEN DB 20,0,20 DUP ($) DATA ENDSCODE SEGMENTASSUMECS:CODE,DS:DATASTART: MOV AX,DATAMOV DS,AXMOV DX,OFFSET MAXLENMOV AH,0AHINT 21HMOV DX,OFFSET MAXLEN+2MOV AH,09HINT 21HMOV AH,4CHINT 21HCODE ENDSENDSTART