-
Notifications
You must be signed in to change notification settings - Fork 1
/
keyboard.inc
49 lines (39 loc) · 918 Bytes
/
keyboard.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
ConfigKeyboard PROC
MOV AX, 3509h ; DOS.GetInterruptVector
INT 21h ; -> ES:BX
MOV INT09_ES, ES
MOV INT09_BX, BX
mov dx, offset Int09
PUSH DS
MOV AX,CS
MOV DS,AX
mov ax, 2509h ; DOS.SetInterruptVector
int 21h
POP DS
RET
ConfigKeyboard ENDP
ResetKeyboard PROC
push ds
push dx
mov dx,INT09_BX
MOV DS,INT09_ES
mov ax, 2509h ; DOS.SetInterruptVector
int 21h
pop DX
pop ds
RET
ResetKeyboard ENDP
Int09 PROC
push ax bx
in al, 60h
mov ah, 0
mov bx, ax
and bx, 127 ; 7-bit scancode goes to BX
shl ax, 1 ; 1-bit press/release goes to AH
xor ah, 1 ; -> AH=1 Press, AH=0 Release
mov [KeyList+bx], ah
mov al, 20h ; The non specific EOI (End Of Interrupt)
out 20h, al
pop bx ax
iret
Int09 ENDP