中断

;*******************************;

;*            中断实验         *;

;*******************************;

 

data segment

mess db 'TPCA interrupt!',0dh,0ah,'$'

data ends

code segment

assume cs:code,ds:data

start:

    mov ax,cs

    mov ds,ax

    mov dx,offset int3  ;USB设备中断为IRQ3

    mov ax,250bh        ;设置中断3的中断矢量

    int 21h

    cli                ;CPU清中断标志位

    in al,21h          ;设置中断屏蔽寄存器

    and al,0f7h        ;开放IRQ3中断

    out 21h,al

    mov cx,10

    sti                ;CPU开中断

ll:    jmp ll

int3:                  ;中断服务程序

    mov ax,data

    mov ds,ax

    mov dx,offset mess ;显示提示信息

    mov ah,09

    int 21h

 

    mov al,20h         ;发出EOI结束中断

    out 20h,al

    loop next

 

    in al,21h          ;关闭IR3中断

    or al,08h

    out 21h,al

    sti                ;CPU开中断

    mov ah,4ch

    int 21h

next:    iret

    code ends

    end start

posted on 2010-12-13 16:14  yming0221  阅读(175)  评论(0)    收藏  举报

导航