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
外部可屏蔽中断服务程序
最新推荐文章于 2022-03-19 15:49:09 发布