-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathKEYBOARD.X86
84 lines (79 loc) · 1.6 KB
/
KEYBOARD.X86
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
keyint_proc: push ax
push bx
push cx
push ds
push es
mov ax, DATASEG ; dsレジスタは設定しなくてもいいん
mov ds, ax ; だけど DEBUG時に困るね…
xor ax, ax
mov es, ax
in al, 43h
test al, 2
je short keyint_ed
in al, 41h
mov ds:[KEYSTAT], al
mov cl, al
and cl, 7
mov ah, 1
shl ah, cl
xor bx, bx
mov bl, al
mov cl, 3
shr bl, cl
and bl, 0fh
add bx, MEM_KB_KY_STS
test al, 80h
jne short keyrelease
or es:[bx], ah
jmp short keyint_shift
keyrelease: not ah
and es:[bx], ah
and al, 7fh
keyint_shift: cmp al, 70h
jb short keyint_ed
cmp al, 75h
ja short keyint_ed
mov al, es:[bx]
inc bx
inc bx
and al, 1fh
and byte ptr es:[bx], 0e0h
or es:[bx], al
keyint_ed: mov al, 20h
out 0, al
pop es
pop ds
pop cx
pop bx
pop ax
iret
boot_keycheck: push ds
xor cx, cx
mov ds, cx
cmp byte ptr ds:[0531h], cl
jns short bkc_nonhelp
mov al, BOOT_WFLASH
mov cl, ds:[0532h]
test cl, 8 ; '8'
jne short bkc_helpret
mov al, BOOT_REVISION
test byte ptr ds:[0533h], 4 ; '1'
jne short bkc_helpret
mov al, BOOT_RFLASH
test cl, 10h ; '9'
jne short bkc_helpret
mov al, BOOT_MENU
bkc_helpret: pop ds
ret
bkc_nonhelp: mov cl, ds:[053ah]
mov ch, cl
and cx, 111eh
cmp cl, 1eh
mov al, BOOT_FIRMWARE
je short bkc_end
cmp ch, 11h
mov al, BOOT_DIPSWINIT
je short bkc_end
mov al, BOOT_NORMAL
bkc_end: pop ds
ret