• 安装一个新的int 9中断例程【在DOS下,按Tab建后改变当前屏幕的显示颜色,其它键照常处理】


    ;任务:
    ; 安装一个新的int 9中断例程
    ;功能:
    ; 在DOS下,按Tab建后改变当前屏幕的显示颜色,其它键照常处理

     1 assume cs:code
     2 
     3 stack segment
     4 db 128 dup(0)
     5 stack ends
     6 
     7 code segment
     8 start:
     9 mov ax, stack
    10 mov ss, ax
    11 mov sp, 128
    12 
    13 push cs
    14 pop ds
    15 
    16 ;把自己的int9中断例程安装到0:[204h]
    17 mov ax, 0
    18 mov es, ax
    19 mov si, offset int9
    20 mov di, 204h
    21 mov cx, offset int9end - offset int9
    22 cld
    23 rep movsb
    24 
    25 ;将BIOS提供的int9中断例程的入口地址保存到0:[200]
    26 push es:[9*4]
    27 pop es:[200h]
    28 push es:[9*4+2]
    29 pop es:[202h]
    30 
    31 ;设置自己的int9中断例程的入口地址
    32 cli    ;设置IF=0 当IF=0时,禁止其它的可屏蔽中断
    33 mov word ptr es:[9*4], 204h
    34 mov word ptr es:[9*4+2], 0
    35 sti     ;设置IF=1, 检测到可屏蔽中断信息时,执行完当前指令后,引发中断过程
    36 
    37 mov ax, 4c00h
    38 int 21h
    39 
    40 int9:    
    41 push ax
    42 push bx
    43 push cx
    44 push es
    45 
    46 ;从60h端口中得到按键的扫描码
    47 in al, 60h
    48 
    49 ;此中断例程执行时CS=0
    50 ;执行BIOS的int9中断例程
    51 pushf
    52 call dword ptr cs:[200h]
    53 
    54 ;Tab的扫描码为0fh
    55 cmp al, 0fh
    56 jne int9ret
    57 
    58 ;当F1按下时改变屏幕背景颜色
    59 mov ax, 0b800h
    60 mov es, ax
    61 mov bx, 1
    62 mov cx, 2000
    63 s:
    64 inc byte ptr es:[bx]
    65 add bx, 2
    66 loop s
    67 
    68 int9ret:
    69 pop es
    70 pop cx
    71 pop bx
    72 pop ax
    73 iret
    74 
    75 int9end:
    76 nop
    77 
    78 code ends
    79 end start
    80 
    81  
  • 相关阅读:
    读书笔记之理想设计的特征
    一些javascript 变量声明的 疑惑
    LINQ 使用方法
    Google MySQL tool releases
    读书笔记之设计的层次
    EF之数据库连接问题The specified named connection is either not found in the configuration, not intended to be used with the Ent
    转载 什么是闭包
    javascript面向对象起步
    Tips
    数据结构在游戏中的应用
  • 原文地址:https://www.cnblogs.com/qintangtao/p/2872849.html
Copyright © 2020-2023  润新知