. : : Assembly Language : : .  |  首页  |  我提出的问题  |  我参与的问题  |  我的收藏  |  消息中心   |  游客  登录  | 
提问 | 未解决 | 已解决 | 精华区 | 搜索 |
  《汇编语言》论坛 ->外中断
主题 : :  实验15:安装9号中断以及取消9号中断  [待解决] 回复[ 13次 ]   点击[ 827次 ]  
cnhnyu
[帖 主] [ 发表时间:2007-11-02 16:43 ] 
荣誉值:0
信誉值:0
注册日期:2007-10-22 14:47
下面是我写的安装9号中断的程序,当输入a并松开的时候,显示满屏幕的'A',按其它键默认处理

; p62.asm
assume cs:code

stack segment
        db 128 dup(0)
stack ends

code segment
        start:
                mov ax, stack
                mov ss, ax
                mov sp, 128

                push cs
                pop ds

                mov ax, 0
                mov es, ax

                mov si, offset int9
                mov di, 204h
                mov cx, offset int9end - offset int9
                cld
                rep movsb

                push es:[9*4]
                pop es:[200h]
                push es:[9*4+2]
                pop es:[202h]

                cli
                mov word ptr es:[9*4], 204h
                mov word ptr es:[9*4+2], 0
                sti

                mov ax, 4c00h
                int 21h

        int9:
                push ax
                push cx
                push si
                push es

                in al, 60h

                pushf
                call dword ptr cs:[200h]

                cmp al, 9eh
                jne int9ret

                mov ax, 0b800h
                mov es, ax
                xor si, si
                mov cx, 2000
        s:        mov byte ptr es:[si], 'A'
                add si, 2
                loop s
        int9ret:
                pop es
                pop si
                pop cx
                pop ax
                iret
        int9end:nop

code ends

end start

当安装了该中断之后,只要按'a'键,就会满屏幕的‘A’,如果你是在windows的dos窗口下运行该程序,那么你必须重新启动该窗口,否则你要是干其它的活,比如,你要继续用masm编译程序的话,是根本不可能的,所以,能安装,就能卸载,根据上面一个程序,我写了一个卸载程序,恢复原有的9号中断,不过,有一点要求,就是该程序的可执行文件不能含有字母'a',这样,你就可以随时安装,随时卸载了,下面是卸载程序:
assume cs:code

; p63.asm
; 清除p62.asm 安装的9号中断,恢复原有的9号中断
code segment
        start:
                mov ax, 0
                mov ds, ax

                cli
                mov ax, ds:[200h]
                mov ds:[9*4], ax
                mov ax, ds:[202h]
                mov ds:[9*4+2], ax
                sti

                mov ax, 4c00h
                int 21h

code ends

end start
yugong
[第9楼] [ 回复时间:2008-10-26 21:41 ] 
荣誉值:2
信誉值:8
注册日期:2008-09-15 09:10
请问 int9: 
        push ax 
        push cx 
        push si 
        push es 

        in al, 60h 

        pushf 
        call dword ptr cs:[200h] 
 这里写成call dword ptr es:[200h]不对吗,为什么呀?
我自己编写成这样通不过,真的不知道为什么。
需要登录后才能回帖 -->> 请单击此处登录
    Copyright © 2006-2024   ASMEDU.NET  All Rights Reserved