21,458
社区成员
发帖
与我相关
我的任务
分享
stack_seg segment 'stack'
dw 10h dup(0)
stack_seg ends
code_seg segment 'code'
assume ss:stack_seg
BEGIN: MOV AH, 1 ;从键盘输入一个字符的DOS调用
INT 21H
SUB AL, '0'
JB STOP ;输入字符 <‘0’吗?
CMP AL, 9 ;输入字符>‘9’吗?
JA STOP
CBW
MOV CX, AX ;响铃次数N
JCXZ STOP
BELL: MOV DL, 07H ;准备响铃
MOV AH, 2 ;显示一个字符的DOS调用,实际为响铃
INT 21H
CALL DELAY100ms ;延时100ms
LOOP BELL
STOP:; RET
mov ah,4ch
int 21h
delay100ms proc uses cx
mov cx, 100;;;;;
call delay_1ms
ret
delay100ms endp
delay_1ms proc near public uses ax cx
mov cx,60 ;63*15.8us=995.4us
@@:
in al,61h
and al,10h
cmp al,ah
je @b
mov ah,al
loop @b
ret
delay_1ms endp
code_seg ends
end BEGIN
stack_seg segment 'stack'
dw 10h dup(0)
stack_seg ends
code_seg segment 'code'
assume ss:stack_seg
BEGIN: MOV AH, 1 ;从键盘输入一个字符的DOS调用
INT 21H
SUB AL, '0'
JB STOP ;输入字符 <‘0’吗?
CMP AL, 9 ;输入字符>‘9’吗?
JA STOP
CBW
MOV CX, AX ;响铃次数N
JCXZ STOP
BELL: MOV DL, 07H ;准备响铃
MOV AH, 2 ;显示一个字符的DOS调用,实际为响铃
INT 21H
CALL DELAY100ms ;延时100ms
LOOP BELL
STOP:; RET
mov ah,4ch
int 21h
delay100ms proc uses cx
mov cx, 120
call delay_1ms
ret
delay100ms endp
delay_1ms proc near public uses ax cx
mov cx,60 ;63*15.8us=995.4us
@@:
in al,61h
and al,10h
cmp al,ah
je @b
mov ah,al
loop @b
ret
delay_1ms endp
code_seg ends
end BEGIN