;凑个数:
code segment
assume cs:code
org 100h
start:
push cs
pop ds
Q0:lea dx,tips ;提示
mov ah,9
int 21h
Q1: mov ah,0 ;接收一字符
int 16h
cmp al,1bh ;ESC 退出
jz exit
cmp al,'1' ;校验数据
jb Q1
cmp al,'7'
ja Q1
call show ;显示有效结果
mov ah,0 ;暂停
int 16h
jmp Q0 ;再次查询
exit:mov ah,4ch ;返回DOS
int 21h
show:
mov ah,0eh ;显示输入的1-7
int 10h
and ax,0fh ;化为2进制数
dec al
mov dl,10
mul dl ;求串内偏移
mov bp,ax
mov ax,0e0dh ;换行
int 10h
mov al,0ah
int 10h
lea dx,week ;指向串首
add dx,bp ;加上偏移
mov ah,9
int 21h ;显示
ret
tips db 0dh,0ah,'Please Input Week No.(1-12)[Esc to Quit]: $'
week db 'Monday...$Tuesday..$Wednesday$Thursday.$Friday...$Saturday.$Sunday...$'
code ends
end start