Rev 3550 | Rev 5044 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3550 | Rev 5031 | ||
---|---|---|---|
Line 34... | Line 34... | ||
34 | 34 | ||
Line 35... | Line 35... | ||
35 | 35 | ||
36 | proc START stdcall, state:dword |
36 | proc START stdcall, state:dword |
37 | 37 | ||
- | 38 | cmp [state], DRV_ENTRY |
|
- | 39 | jne .nothing |
|
- | 40 | .init: |
|
- | 41 | ; disable keyboard and mouse interrupts |
|
- | 42 | ; keyboard IRQ handler can interfere badly otherwise |
|
- | 43 | pushf |
|
- | 44 | cli |
|
- | 45 | mov bl, 0x20 ; read command byte |
|
- | 46 | call kbd_cmd |
|
- | 47 | test ah,ah |
|
- | 48 | jnz .fin |
|
- | 49 | call kbd_read |
|
- | 50 | test ah,ah |
|
- | 51 | jnz .fin |
|
- | 52 | popf |
|
- | 53 | and al, 0xFC ; disable interrupts |
|
- | 54 | or al, 0x10 ; disable keyboard |
|
- | 55 | push eax |
|
- | 56 | mov bl, 0x60 ; write command byte |
|
Line 38... | Line 57... | ||
38 | cmp [state], DRV_ENTRY |
57 | call kbd_cmd |
39 | jne .fin |
58 | pop eax |
40 | .init: |
59 | call kbd_write |
Line 55... | Line 74... | ||
55 | jnz .stop_try |
74 | jnz .stop_try |
56 | mov [MouseType],MT_5BScroll |
75 | mov [MouseType],MT_5BScroll |
Line 57... | Line 76... | ||
57 | 76 | ||
Line -... | Line 77... | ||
- | 77 | .stop_try: |
|
- | 78 | ||
- | 79 | mov al, 0xF4 ; enable data reporting |
|
- | 80 | call mouse_cmd |
|
58 | .stop_try: |
81 | |
59 | 82 | ; enable keyboard and mouse interrupts |
|
60 | mov bl, 0x20 ; read command byte |
- | |
61 | call kbd_cmd |
- | |
62 | cmp ah,1 |
- | |
63 | je .exit |
83 | mov bl, 0x20 ; read command byte |
64 | - | ||
65 | call kbd_read |
84 | call kbd_cmd |
66 | cmp ah,1 |
- | |
67 | je .exit |
85 | call kbd_read |
68 | 86 | or al, 3 ; enable interrupts |
|
69 | or al, 10b |
87 | and al, not 0x10 ; enable keyboard |
70 | push eax |
88 | push eax |
71 | mov bl, 0x60 ; write command byte |
- | |
72 | call kbd_cmd |
- | |
73 | cmp ah,1 |
- | |
74 | je .exit |
89 | mov bl, 0x60 ; write command byte |
75 | 90 | call kbd_cmd |
|
76 | pop eax |
- | |
77 | call kbd_write |
- | |
Line 78... | Line -... | ||
78 | cmp ah,1 |
- | |
79 | je .exit |
- | |
80 | - | ||
81 | mov al, 0xF4 ; enable data reporting |
- | |
82 | call mouse_cmd |
- | |
83 | - | ||
84 | mov bl, 0xAE ; enable keyboard interface |
91 | pop eax |
85 | call kbd_cmd |
92 | call kbd_write |
86 | 93 | ||
Line 87... | Line 94... | ||
87 | stdcall AttachIntHandler, 12, irq_handler, dword 0 |
94 | stdcall AttachIntHandler, 12, irq_handler, 0 |
- | 95 | stdcall RegService, my_service, service_proc |
|
88 | stdcall RegService, my_service, service_proc |
96 | ret |
89 | ret |
97 | |
90 | 98 | .fin: |
|
- | 99 | popf |
|
91 | .fin: |
100 | ;stdcall DetachIntHandler, 12, irq_handler |
92 | ;stdcall DetachIntHandler, 12, irq_handler |
101 | mov bl, 0xA7 ; disable mouse interface |
Line 93... | Line 102... | ||
93 | mov bl, 0xA7 ; disable mouse interface |
102 | call kbd_cmd |
94 | call kbd_cmd |
103 | .nothing: |
95 | xor eax, eax |
104 | xor eax, eax |
- | 105 | ret |
|
- | 106 | ||
- | 107 | .exit: |
|
- | 108 | mov bl, 0xA7 ; disable mouse interface |
|
- | 109 | call kbd_cmd |
|
96 | ret |
110 | |
- | 111 | ; enable keyboard interrupt, leave mouse interrupt disabled |
|
- | 112 | mov bl, 0x20 ; read command byte |
|
- | 113 | call kbd_cmd |
|
97 | 114 | call kbd_read |
|
- | 115 | or al, 1 ; enable keyboard interrupt |
|
- | 116 | and al, not 0x10 ; enable keyboard |
|
- | 117 | push eax |
|
98 | .exit: |
118 | mov bl, 0x60 ; write command byte |
99 | mov bl, 0xA7 ; disable mouse interface |
119 | call kbd_cmd |
100 | call kbd_cmd |
120 | pop eax |
Line 101... | Line 121... | ||
101 | mov bl, 0xAE ; enable keyboard interface |
121 | call kbd_write |
Line 135... | Line 155... | ||
135 | jmp .ok |
155 | jmp .ok |
136 | endp |
156 | endp |
Line 137... | Line 157... | ||
137 | 157 | ||
Line 138... | Line -... | ||
138 | detect_mouse: |
- | |
139 | - | ||
140 | mov bl, 0xAD ; disable keyboard interface |
- | |
141 | call kbd_cmd |
- | |
142 | cmp ah,1 |
- | |
143 | je .fail |
158 | detect_mouse: |
144 | 159 | ||
145 | mov bl, 0xA8 ; enable mouse interface |
160 | mov bl, 0xA8 ; enable mouse interface |
146 | call kbd_cmd |
161 | call kbd_cmd |
Line 159... | Line 174... | ||
159 | ; get device ID |
174 | ; get device ID |
160 | call mouse_read |
175 | call mouse_read |
161 | jc .fail |
176 | jc .fail |
162 | cmp al, 0x00 |
177 | cmp al, 0x00 |
163 | jne .fail ; unknown device |
178 | jne .fail ; unknown device |
- | 179 | ||
164 | xor eax,eax |
180 | xor eax,eax |
165 | ret |
181 | ret |
Line 166... | Line 182... | ||
166 | 182 | ||
167 | .fail: |
183 | .fail: |