编写中断处理程序,要求主程序运行时,每10秒响铃一次,同时屏幕上显示信息“The bell is ring!”
程序代码:
dseg segment count dw 1 mess db 'The bell is ring!',0dh,0ah,'$' dseg ends cseg segment main proc far assume cs:cseg,ds:dseg,es:dseg start: push ds sub ax,ax push ax mov ax,dseg mov ds,ax 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,11111110b out 21h,al sti mov di,2000 delay: mov si,3000 delay1: dec si jnz delay1 dec di jnz delay pop dx pop ds mov al,1ch mov ah,25h int 21h ret main endp ring proc near push ds push ax push cx push dx mov ax,dseg mov ds,ax sti dec count jnz exit mov dx,offset mess mov ah,09h int 21h mov dx,100 in al,61h and al,0fch sound: xor al,02 out 61h,al mov cx,140h wait1: loop wait1 dec dx jne sound mov count 182 exit: cli pop dx pop cx pop ax pop ds iret ring endp cseg ends end start