1、下面是按要求实现的源程序,现要求将源程序中的重复部分指令改用宏指令实现。
从键盘输入一字符,判断该字符是小写字母、大写字母、数字还是其它字符。若输入为小写字母,则显示“You Input a Lowercase Letter!”; 若输入为大写字母,则显示“You Input a Uppercase Letter!”; 若输入为数字,则显示“You Input a Digit!”; 若输入为其它字符,则显示“You Input Other Letter!”。
-
data SEGMENT
-
INfor1 DB 0ah, 0dh, 'please press any key to input a letter:$'
-
INfor2 DB 0ah, 0dh, 'you input a lowetcase letter!$'
-
INfor3 DB 0ah, 0dh, 'you input a uppercase letter!$'
-
INfor4 DB 0ah, 0dh, 'you input a digit!$'
-
INfor5 DB 0ah, 0dh, 'you input a other letter!$'
-
data ENDS
-
code SEGMENT
-
ASSUME CS: code, DS: data
-
start: MOV AX, data
-
MOV DS, AX
-
MOV DX, OFFSET INfor1
-
MOV AH, 09
-
INT 21h
-
MOV AH, 01h
-
INT 21h
-
CMP AL, '0'
-
JB other
-
CMP AL, '9'
-
JBE DIgit
-
CMP AL, 'A'
-
JB other
-
CMP AL, 'Z'
-
JBE upper
-
CMP AL, 'a'
-
JB other
-
CMP AL, 'z'
-
JBE LOWer
-
JMP pend
-
LOWer: MOV DX, OFFSET INfor2
-
MOV AH, 09h
-
INT 21h
-
JMP pend
-
upper: MOV DX, OFFSET INfor3
-
MOV AH, 09h
-
INT 21h</