interruptbell.asm
来自「一些小程序,关于汇编语言中程序的中断的使用,例子中包括字符输出」· 汇编 代码 · 共 84 行
ASM
84 行
.model small
.stack
.data
cnt dw 1
mes db 'bell',0ah,0dh,'$'
.code
.startup
mov al, 1ch
mov ah, 35h
int 21h
push es
push bx
push ds
mov dx, offset ring
mov ax, seg ring
mov ds, ax
mov al, 1ch
mov ah, 25h
int 21h
pop ds
in al, 21h
and al, 11111110b
out 21h, al
sti
;call delay
mov ah,0
int 16h
pop dx
pop ds
mov al, 1ch
mov ah, 25h
int 21h
mov ax, 4c00h
int 21h
ring proc near
.386
pusha ;保存寄存器
mov ax, @data
mov ds, ax
sti ;开中断
dec cnt
jnz exit
mov dx, offset mes
mov ah, 09
int 21h
;call sound
mov ah,02h
mov dl,07h
int 21h
mov cnt,100
exit: cli ;关中断
.386
popa ;恢复寄存器
iret
ring endp
delay proc
push cx
push dx
mov dx,10000
dl500: mov cx,50000
dl10ms: loop dl10ms
dec dx
jnz dl500
pop dx
pop cx
ret
delay endp
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?