⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interruptbell.asm

📁 一些小程序,关于汇编语言中程序的中断的使用,例子中包括字符输出
💻 ASM
字号:
.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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -