外部可屏蔽中断服务程序

stack       segment
	db 1024 dup(?)
stack       ends


data        segment
	esccode db 0
data        ends

code        segment
	assume  cs:code,ds:data,ss:stack
start:      
            mov ax,3509h
            int 21h
            push es
            push bx
            cli
            push ds
            mov ax,2509h
            mov dx,seg scancode
            mov ds,dx
            mov dx,offset scancode
            int 21h
            pop ds
            in al,21h
            push ax
            and al,0fdh
            out 21h,al
            mov byte ptr esccode,0
            sti
waiting:    cmp byte ptr esccode,81h
            jne waiting
            cli
            pop ax
            out 21h,al
            pop dx
            pop ds
            mov ax,2509h
            int 21h
            sti
            
            ;子程序
scancode    proc
            sti
            push ax
            push bx
            in al,60h
            push ax
            in al,61h
            or al,80h
            out 61h,al
            and al,7fh
            out 61h,al
            pop ax
            cmp al,81h
            jne scan1
            push ds
            mov bx,data
            mov ds,bx
            mov esccode,al
            pop ds
scan1:      push ax
            mov cl,4
            shr al,cl
            cmp al,0ah
            jb scan2
            add al,7
scan2:      add al,30h
            mov bx,0
            mov ah,0eh
            int 10h
            pop ax
            add al,0fh
            cmp al,0ah
            jb scan3
            add al,7
scan3:      add al,30h
            mov ah,0eh
            int 10h
            mov ax,0e20h
            int 20h
            mov ax,0e20h
            int 20h;显示两个空白
            mov al,20h
            out 20h,al
            pop bx
            pop ax
            iret
scancode    endp

code        ends
end         start
                     
            
  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值