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

我的博客

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

[2009-10-12 20:25] 实验 15 安装新的int9中断例程

图片载入中
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 bx
  push cx
  push es

  in al, 60h

  pushf
  call dword ptr cs:[200h]

  cmp al, 9eh ;1e+80h
  jne int9ret

  mov ax, 0b800h
  mov es, ax
  mov bx, 0
  mov cx, 2000
s:
  mov byte ptr es:[bx], 'A'
  add bx, 2
  loop s

int9ret:
  pop es
  pop cx
  pop bx
  pop ax
  iret
int9end:
  nop

code ends
end start

========一定要注意本程序仅能运行一次,运行第二次以后会出现错误:系统处理不了键盘中断了。这是因为第一次运行后将BIOS提供的键盘中断例程入口地址保存到了0000:0200h处,当第二次运行后,会将这个入口地址覆盖掉,导致系统处理不了键盘中断!!!!=====
另外本程序是在虚拟机下运行的,今后两章也要在虚拟机下运行,避免不必要的错误。
评论次数(0)  |  浏览次数(460)  |  类型(汇编作业) |  收藏此文  | 
 
 请输入验证码  (提示:点击验证码输入框,以获取验证码