安装新的int 9中断例程2

    安装一个新的 int 9 中断例程,功能:在 DOS 下,按下 "A" 键后,除非不再松开,如果松开,就显示满屏幕的 "A";其他的键照常处理。
        提示:按下一个键时产生的扫描码称为通码,松开一个键产生的扫描码称为断码。断码=通码+80h。
A 的通码:1Eh        断码:9Eh
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:[4*9]        ; 保存原int 9中断例程入口地址
        pop es:[200h]
        push es:[4*9+2]
        pop es:[202h]

        cli
        mov word ptr es:[4*9] , 204h        ; 设置新的int 9中断入口地址
        mov word ptr es:[4*9+2] , 0h
        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        ; 'A' 的断码
        jne int9ret

        mov ax , 0b800h
        mov es , ax
        mov bx , 0
        mov cx , 2000        ; 25*80=2000 一页可以存2000个字符,每个字符要存一个字符属性,25*160=4000
s:        mov byte ptr es:[bx] , 'A'
        mov byte ptr es:[bx+1] , 00000100b
        add bx , 2
        loop s

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

code ends
end start
wfmEWyw3s5QEgAAAABJRU5ErkJggg== // 按其他键没事,按下 'A' 键松开后全屏幕变红色 'A' ;  


转载于:https://www.cnblogs.com/meihao1203/p/8023365.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值