2个回答
展开全部
;------------------------------------
PRINT MACRO PARA ; 定义一个显示字符串的宏
LEA DX, PARA
MOV AH, 9
INT 21H
ENDM
;------------------------------------
DSEG SEGMENT
MSG_LOWER DB ' lower', 0DH, 0AH, 24H
MSG_UPPER DB ' upper', 0DH, 0AH, 24H
MSG_NO DB ' no', 0DH, 0AH, 24H
MSG1 DB 'please press a key (press [esc] key to end program): $'
DSEG ENDS
;------------------------------------
CSEG SEGMENT
ASSUME CS:CSEG, DS:DSEG
START:
MOV AX, DSEG
MOV DS, AX
;------------------------
LB_1:
PRINT MSG1 ;显示提示信息
MOV AH, 1
INT 21H ;输入一个字符
CMP AL, 1BH ;是[esc]?
JZ EXIT
CMP AL, 'A' ;小于'A'?
JB LB_NO
CMP AL, 'z' ;大于'z'?
JA LB_NO
CMP AL, 'Z' ;小于等于'Z'?
JBE UUU
CMP AL, 'a' ;小于'a'?
JB LB_NO
;------------------
PRINT MSG_LOWER
JMP LB_1
UUU:
PRINT MSG_UPPER
JMP LB_1
LB_NO:
PRINT MSG_NO
JMP LB_1
;------------------------
EXIT:
MOV AX, 4C00H
INT 21H
CSEG ENDS
END START
PRINT MACRO PARA ; 定义一个显示字符串的宏
LEA DX, PARA
MOV AH, 9
INT 21H
ENDM
;------------------------------------
DSEG SEGMENT
MSG_LOWER DB ' lower', 0DH, 0AH, 24H
MSG_UPPER DB ' upper', 0DH, 0AH, 24H
MSG_NO DB ' no', 0DH, 0AH, 24H
MSG1 DB 'please press a key (press [esc] key to end program): $'
DSEG ENDS
;------------------------------------
CSEG SEGMENT
ASSUME CS:CSEG, DS:DSEG
START:
MOV AX, DSEG
MOV DS, AX
;------------------------
LB_1:
PRINT MSG1 ;显示提示信息
MOV AH, 1
INT 21H ;输入一个字符
CMP AL, 1BH ;是[esc]?
JZ EXIT
CMP AL, 'A' ;小于'A'?
JB LB_NO
CMP AL, 'z' ;大于'z'?
JA LB_NO
CMP AL, 'Z' ;小于等于'Z'?
JBE UUU
CMP AL, 'a' ;小于'a'?
JB LB_NO
;------------------
PRINT MSG_LOWER
JMP LB_1
UUU:
PRINT MSG_UPPER
JMP LB_1
LB_NO:
PRINT MSG_NO
JMP LB_1
;------------------------
EXIT:
MOV AX, 4C00H
INT 21H
CSEG ENDS
END START
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询