Subversion Repositories Kolibri OS

Rev

Rev 2288 | Rev 2611 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2288 Rev 2601
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
4
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa      ;;
4
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa      ;;
5
;; Distributed under terms of the GNU General Public License    ;;
5
;; Distributed under terms of the GNU General Public License    ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 2288 $
8
$Revision: 2601 $
9
 
9
 
10
 
10
 
Line 32... Line 32...
32
 
32
 
33
  altmouseb     db 0
33
  altmouseb     db 0
Line 34... Line 34...
34
  ctrl_alt_del  db 0
34
  ctrl_alt_del  db 0
-
 
35
 
Line 35... Line 36...
35
 
36
  kb_lights     db 0
36
  kb_lights     db 0
37
  old_kb_lights db 0
37
 
38
 
38
align 4
39
align 4
Line 111... Line 112...
111
        push    ebx esi edi ebp
112
        push    ebx esi edi ebp
112
        call    send_scancode
113
        call    send_scancode
113
        pop     ebp edi esi ebx
114
        pop     ebp edi esi ebx
114
        ret
115
        ret
115
;---------------------------------------------------------------------
116
;---------------------------------------------------------------------
-
 
117
struct KEYBOARD
-
 
118
next           dd      ?
-
 
119
prev           dd      ?
-
 
120
functions      dd      ?
-
 
121
userdata       dd      ?
-
 
122
ends
-
 
123
struct KBDFUNC
-
 
124
strucsize      dd      ?
-
 
125
close          dd      ?
-
 
126
setlights      dd      ?
-
 
127
ends
-
 
128
 
-
 
129
iglobal
-
 
130
keyboards:
-
 
131
        dd      keyboards
-
 
132
        dd      keyboards
-
 
133
endg
-
 
134
uglobal
-
 
135
keyboard_list_mutex     MUTEX
-
 
136
endg
-
 
137
 
-
 
138
register_keyboard:
-
 
139
        push    ebx
-
 
140
        push    sizeof.KEYBOARD
-
 
141
        pop     eax
-
 
142
        call    malloc
-
 
143
        test    eax, eax
-
 
144
        jz      .nothing
-
 
145
        mov     ecx, [esp+4+4]
-
 
146
        mov     [eax+KEYBOARD.functions], ecx
-
 
147
        mov     ecx, [esp+8+4]
-
 
148
        mov     [eax+KEYBOARD.userdata], ecx
-
 
149
        xchg    eax, ebx
-
 
150
        mov     ecx, keyboard_list_mutex
-
 
151
        call    mutex_lock
-
 
152
        mov     ecx, keyboards
-
 
153
        mov     edx, [ecx+KEYBOARD.prev]
-
 
154
        mov     [ebx+KEYBOARD.next], ecx
-
 
155
        mov     [ebx+KEYBOARD.prev], edx
-
 
156
        mov     [edx+KEYBOARD.next], ebx
-
 
157
        mov     [ecx+KEYBOARD.prev], ebx
-
 
158
        mov     ecx, [ebx+KEYBOARD.functions]
-
 
159
        cmp     [ecx+KBDFUNC.strucsize], KBDFUNC.setlights
-
 
160
        jbe     .unlock
-
 
161
        mov     ecx, [ecx+KBDFUNC.setlights]
-
 
162
        test    ecx, ecx
-
 
163
        jz      .unlock
-
 
164
        stdcall ecx, [ebx+KEYBOARD.userdata], dword [kb_lights]
-
 
165
.unlock:
-
 
166
        mov     ecx, keyboard_list_mutex
-
 
167
        call    mutex_unlock
-
 
168
        xchg    eax, ebx
-
 
169
.nothing:
-
 
170
        pop     ebx
-
 
171
        ret     8
-
 
172
 
-
 
173
delete_keyboard:
-
 
174
        push    ebx
-
 
175
        mov     ebx, [esp+4+4]
-
 
176
        mov     ecx, keyboard_list_mutex
-
 
177
        call    mutex_lock
-
 
178
        mov     eax, [ebx+KEYBOARD.next]
-
 
179
        mov     edx, [ebx+KEYBOARD.prev]
-
 
180
        mov     [eax+KEYBOARD.prev], edx
-
 
181
        mov     [edx+KEYBOARD.next], eax
-
 
182
        call    mutex_unlock
-
 
183
        mov     ecx, [ebx+KEYBOARD.functions]
-
 
184
        cmp     [ecx+KBDFUNC.strucsize], KBDFUNC.close
-
 
185
        jbe     .nothing
-
 
186
        mov     ecx, [ecx+KBDFUNC.close]
-
 
187
        test    ecx, ecx
-
 
188
        jz      .nothing
-
 
189
        stdcall ecx, [ebx+KEYBOARD.userdata]
-
 
190
.nothing:
-
 
191
        pop     ebx
-
 
192
        ret     4
-
 
193
;---------------------------------------------------------------------
116
align 4
194
align 4
117
irq1:
195
irq1:
118
        movzx   eax, word[TASK_COUNT]; top window process
196
        movzx   eax, word[TASK_COUNT]; top window process
119
        movzx   eax, word[WIN_POS+eax*2]
197
        movzx   eax, word[WIN_POS+eax*2]
120
        shl     eax, 8
198
        shl     eax, 8
Line 279... Line 357...
279
        test    ch, ch
357
        test    ch, ch
280
        js      .writekey
358
        js      .writekey
Line 281... Line 359...
281
        
359
        
282
        xor     [kb_state], eax
360
        xor     [kb_state], eax
-
 
361
        xor     [kb_lights], bl
283
        xor     [kb_lights], bl
362
        push    ecx
-
 
363
        call    set_lights
284
        call    set_lights
364
        pop     ecx
285
.writekey:
365
.writekey:
286
; test for system hotkeys
366
; test for system hotkeys
287
        movzx   eax, ch
367
        movzx   eax, ch
288
        cmp     bh, 1
368
        cmp     bh, 1
Line 382... Line 462...
382
.exit.irq1:
462
.exit.irq1:
383
        mov     [check_idle_semaphore], 5
463
        mov     [check_idle_semaphore], 5
384
        ret
464
        ret
385
;---------------------------------------------------------------------
465
;---------------------------------------------------------------------
386
set_lights:
466
set_lights:
-
 
467
        push    ebx esi
-
 
468
        mov     ecx, keyboard_list_mutex
-
 
469
        call    mutex_lock
-
 
470
        mov     esi, keyboards
-
 
471
.loop:
-
 
472
        mov     esi, [esi+KEYBOARD.next]
-
 
473
        cmp     esi, keyboards
-
 
474
        jz      .done
-
 
475
        mov     eax, [esi+KEYBOARD.functions]
-
 
476
        cmp     dword [eax], KBDFUNC.setlights
-
 
477
        jbe     .loop
-
 
478
        mov     eax, [eax+KBDFUNC.setlights]
-
 
479
        test    eax, eax
-
 
480
        jz      .loop
-
 
481
        stdcall eax, [esi+KEYBOARD.userdata], dword [kb_lights]
-
 
482
        jmp     .loop
-
 
483
.done:
-
 
484
        mov     ecx, keyboard_list_mutex
-
 
485
        call    mutex_unlock
-
 
486
        pop     esi ebx
-
 
487
        ret
-
 
488
 
-
 
489
ps2_set_lights:
387
        mov     al, 0xED
490
        mov     al, 0xED
388
        call    kb_write
491
        call    kb_write
389
        mov     al, [kb_lights]
492
        mov     al, [esp+8]
390
        call    kb_write
493
        call    kb_write
-
 
494
        ret     8
-
 
495
 
-
 
496
;// mike.dld ]
-
 
497
check_lights_state:
-
 
498
        mov     al, [kb_lights]
-
 
499
        cmp     al, [old_kb_lights]
-
 
500
        jz      .nothing
-
 
501
        mov     [old_kb_lights], al
-
 
502
        call    set_lights
-
 
503
.nothing:
391
        ret
504
        ret
392
;---------------------------------------------------------------------
505
;---------------------------------------------------------------------
393
numlock_map:
506
numlock_map:
394
    db   0x37   ;Num 7
507
    db   0x37   ;Num 7
395
    db   0x38   ;Num 8
508
    db   0x38   ;Num 8