. : : Assembly Language : : .  |  首页  |  我提出的问题  |  我参与的问题  |  我的收藏  |  消息中心   |  游客  登录  | 
提问 | 未解决 | 已解决 | 精华区 | 搜索 |
  《汇编语言》论坛 ->外中断
主题 : :  实验15代码和注释  [待解决] 回复[ 1次 ]   点击[ 620次 ]  
ruder
[帖 主] [ 发表时间:2011-01-26 19:53 ] 
荣誉值:0
信誉值:0
注册日期:2011-01-02 12:37
assume cs:code

code segment
old:
  dw 0, 0                                ;用于保存原中断地址
color:
  push es
  push ax
  push bx
  push cx
  
  in al, 60h
  cmp al, 1eh + 80h
  jne def
  mov ax, 0b800h
  mov es, ax
  xor bx, bx
  mov cx, 4000
s:
  mov byte ptr es:[bx], 'A'
  inc bx
  mov byte ptr es:[bx], 1100b
  inc bx
  loop s
def:
  pushf
  call dword ptr cs:[200h]

  pop cx
  pop bx
  pop ax
  pop es
  iret

main:
  xor ax, ax                             ;保存原中断
  mov es, ax
  mov ax, es:[9 * 4]
  mov cs:[0], ax
  mov ax, es:[9 * 4 + 2]
  mov cs:[2], ax

  mov ax, cs                             ;安装新中断代码
  mov ds, ax
  mov di, 200h
  mov si, offset old
  mov cx, offset main - offset old
  cld
  rep movsb

  cli                                    ;更改中断
  mov word ptr es:[9 * 4], 204h
  mov word ptr es:[9 * 4 + 2], 0
  sti

  mov ax, 4c00h                          ;退出
  int 21h
code ends
end main
需要登录后才能回帖 -->> 请单击此处登录
    Copyright © 2006-2024   ASMEDU.NET  All Rights Reserved