汇编网首页登录博客注册
proctiv的学习博客
博客首页博客互动【做检测题】论坛求助

我的博客

个人首页 |  我的文章 |  我的相册 |  我的好友 |  最新访客 |  文章收藏 |  论坛提问 |  友情链接 |  给我留言  
图片载入中
学习动态
最新留言
好友圈
文章收藏
友情链接

[2007-11-13 09:55] 实验15 安装新的int9中断

图片载入中
代码如下:
;Install new int9 interuppt

assume cs:code,ss:stack

stack segment
    db 64 dup (0)
stack ends

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

    mov ax,0
    mov es,ax
    mov di,204h

    mov ax,cs
    mov ds,ax
    mov si,offset int9

    mov cx,offset int9end - offset int9
    cld
    rep movsb       ;Copy new int9 interrupt program to 0:204h

    push es:[9*4]
    pop es:[200h]
    push es:[9*4+2]
    pop es:[202h]   ;Store old int9 interrupt address at 0:200h

    cli
    mov word ptr es:[9*4],204h
    mov word ptr es:[9*4+2],0   ;Install new int9 interrupte address
    sti

    mov ax,4c00h
    int 21h

int9:
    push ax
    push cx
    push es
    push si

    in al,60h                   ;Read the keyboad input

    pushf
    call dword ptr cs:[200h]    ;Call old int9 interrupt handling

    cmp al,9eh                  ;Compare al with 'A' loose key number '9EH'
    jne int9ret                 ;If not,just simply return

    mov cx,0b800h
    mov es,cx
    mov cx,2000                 ;Otherwise display 'A' all monitor
    mov ah,'A'
    mov si,0
s:
    mov es:[si],ah
    add si,2
    loop s

int9ret:
    pop si
    pop es
    pop cx
    pop ax
    iret

int9end:
    nop

code ends
end start
评论次数(1)  |  浏览次数(587)  |  类型(汇编作业) |  收藏此文  | 

[  bloom   发表于  2007-11-16 22:28  ]

呵呵,不错!

 
 请输入验证码  (提示:点击验证码输入框,以获取验证码