1、从键盘输入一字符,判断该字符是小写字母、大写字母、数字还是其它字符。若输入为小写字母,则显示“You Input a Lowercase Letter!”;若输入为大写字母,则显示“You Input a Uppercase Letter!”;若输入为数字,则显示“You Input a Digit!”;若输入为其它字符,则显示“You Input Other Letter!”。
-
DATAS SEGMENT
-
INFOR_I DB 'please input a char:$'
-
INFOR_L DB 0AH,0DH,'You Input a Lowercase Letter!$'
-
INFOR_U DB 0AH,0DH,'You Input a Uppercase Letter!$'
-
INFOR_N DB 0AH,0DH,'You Input a Digit!$'
-
INFOR_O DB 0AH,0DH,'You Input Other Letter!$'
-
DATAS ENDS
-
-
CODES SEGMENT
-
ASSUME CS:CODES,DS:DATAS
-
START:
-
MOV AX,DATAS
-
MOV DS,AX
-
-
MOV DX,OFFSET INFOR_I
-
MOV AH,9H
-
INT 21H
-
-
MOV AH,1
-
INT 21H
-
-
CMP AL,'0'
-
JL INPUT_OTHER
-
-
CMP AL,'9'
-
JNG INPUT_NUMBER
-
-
CMP AL,'A'
-
JL INPUT_OTHER
-
-
CMP AL,'Z'
-
JNG INPUT_UPPER
-
-
CMP AL,'a'
-
JL INPUT_OTHER
-
-
CMP AL,'z'
-
JNG INPUT_LOWER
-
JG INPUT_OTHER
-
-
INPUT_LOWER:
-
MOV DX,OFFSET INFOR_L
-
JMP RESULT
-
-
INPUT_UPPER:
-
MOV DX,OFFSET INFOR_U
-
JMP RESULT
-
-
INPUT_NUMBER:
-
MOV DX,OFFSET INFOR_N
-
JMP RESULT
-
-
INPUT_OTHER:
-
MOV DX,OFFSET INFOR_O
-
JMP RESULT
-
-
RESULT:
-
MOV AH,9H
-
INT 21H
-
-
MOV AH,4CH
-
INT 21H
-
CODES ENDS
-
END START
2、在屏幕上显示“Are you really want to exit?”,然后从键盘输入一字符,若输入“Y”或“y”,则显示“Thank you for your using!”;若输入“N”或“n”,则显示“Let’s continue!”;若输入其它字符,则显示“You press an error key!”后程序结束。
-
DATAS SEGMENT
-
INFOR DB 'Are you really want to exit?$'
-
INFOR_Y DB 0AH,0DH,'Thank you for your using!$'
-
INFOR_N DB 0AH,0DH,'Lets continue!$'
-
INFOR_O DB 0AH,0DH,'You press an error key!$'
-
DATAS ENDS
-
-
CODES SEGMENT
-
ASSUME CS:CODES,DS:DATAS
-
START:
-
MOV AX,DATAS
-
MOV DS,AX
-
-
MOV DX,OFFSET INFOR
-
MOV AH,09H
-
INT 21H
-
-
MOV AH,01H
-
INT 21H
-
-
AND AL,11011111B
-
-
CMP AL,01011001B
-
JE INPUT_Y
-
-
CMP AL,01001110B
-
JE INPUT_N
-
-
JMP INPUT_O
-
-
INPUT_Y:
-
MOV DX,OFFSET INFOR_Y
-
JMP RESULT
-
-
INPUT_N:
-
MOV DX,OFFSET INFOR_N
-
JMP RESULT
-
-
INPUT_O:
-
MOV DX,OFFSET INFOR_O
-
-
RESULT:
-
MOV AH,09H
-
INT 21H
-
-
MOV AH,4CH
-
INT 21H
-
CODES ENDS
-
END START