DATAS SEGMENT
data1 db 'A','D','X','Z'
DATAS ENDS
STACKS SEGMENT
;此处输入堆栈段代码
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
mov cx,4 ;循环4次
s1:
mov ah,7 ;接收字符不回显
int 21h
cmp al,30h ;如果大于3 小于0重新输入
jb s1
cmp al,33h
ja s1
lea bx,data1 ;把输入的数字转换为数据中的字符
mov dl,al
mov dh,0
sub dl,30h
add bx,dx
mov al,[bx]
mov dl,al ;显示DATA1中的字符
mov ah,2
int 21h
mov dl,' ' ;显示空格
mov ah,2
int 21h
s2:
loop s1
MOV AH,4CH
INT 21H
CODES ENDS
END START