[求助]怎样使程序发出“警报”?
要求:输入无效数据时,发出警报声,然后提示重新输入大家帮我出出主意,谢谢啦!
程序代码:
DATA SEGMENT
X DB ?
Y DB ?
S DB ?,?
mess1 db "Input x=(0 quit)","$"
mess3 db 'Input y=','$'
mess2 db 'x+y=$'
DATA ENDS
stack segment para stack 'stack'
dw 100 dup(?)
stack ends
CODE SEGMENT
ASSUME CS:CODE,DS:DATA,ss:stack
START: MOV AX,DATA
MOV DS,AX
l1: lea dx,mess1
mov ah,9
int 21h
MOV AH,1
INT 21H
cmp al,'0'
je l2
MOV X,AL
call cr_lf
lea dx,mess3
mov ah,9
int 21h
MOV AH,1
INT 21H
MOV Y,AL
MOV AL,X
AND AL,0FH
MOV BL,Y
AND BL,0FH
ADD AL,BL
cbw
mov bl,10
div bl
or al,30h
mov s,al
or ah,30h
mov [s+1],ah
call cr_lf
mov dx,offset mess2
mov ah,9
int 21h
MOV AH,2
MOV DL,s
INT 21H
mov ah,2
mov dl,[s+1]
int 21h
call cr_lf
jmp l1
l2: MOV AH,4CH
INT 21H
cr_lf proc
push ax
push dx
mov ah,2
mov dl,0ah
int 21h
mov ah,2
mov dl,0dh
int 21h
pop dx
pop ax
ret
cr_lf endp
CODE ENDS
END START