Subversion Repositories Kolibri OS

Rev

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

Rev 3626 Rev 5201
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2014. 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: 3626 $
8
$Revision: 5201 $
9
 
9
 
10
 
10
 
Line 23... Line 23...
23
VKEY_SHIFT    = 0000000000000011b
23
VKEY_SHIFT    = 0000000000000011b
24
VKEY_CONTROL  = 0000000000001100b
24
VKEY_CONTROL  = 0000000000001100b
25
VKEY_ALT      = 0000000000110000b
25
VKEY_ALT      = 0000000000110000b
Line 26... Line 26...
26
 
26
 
27
uglobal
-
 
28
  align 4
-
 
29
  kb_state      dd 0
27
uglobal
Line 30... Line 28...
30
  ext_code      db 0
28
  ext_code      db 0
31
 
29
 
Line 32... Line 30...
32
  keyboard_mode db 0
30
  keyboard_mode db 0
33
  keyboard_data db 0
31
  keyboard_data db 0
Line 34... Line -...
34
 
-
 
35
  altmouseb     db 0
32
 
Line 36... Line 33...
36
  ctrl_alt_del  db 0
33
  altmouseb     db 0
37
 
34
  ctrl_alt_del  db 0
38
  kb_lights     db 0
35
 
39
  old_kb_lights db 0
36
  old_kb_lights db 0
40
 
37
 
Line 41... Line 38...
41
align 4
38
align 4
-
 
39
        hotkey_scancodes        rd      256     ; we have 256 scancodes
-
 
40
        hotkey_list             rd      256*4   ; max 256 defined hotkeys
-
 
41
        hotkey_buffer           rd      120*2   ; buffer for 120 hotkeys
-
 
42
endg
-
 
43
 
-
 
44
iglobal
-
 
45
  kb_lights     db 2
42
        hotkey_scancodes        rd      256     ; we have 256 scancodes
46
  align 4
43
        hotkey_list             rd      256*4   ; max 256 defined hotkeys
47
  kb_state      dd VKEY_NUMLOCK
44
        hotkey_buffer           rd      120*2   ; buffer for 120 hotkeys
48
endg
45
endg
49
 
46
 
50
iglobal
Line 455... Line 459...
455
        jnz     .exit.irq1
459
        jnz     .exit.irq1
Line 456... Line 460...
456
        
460
        
457
        test    bl, bl
461
        test    bl, bl
Line 458... Line 462...
458
        jz      .exit.irq1
462
        jz      .exit.irq1
459
 
463
 
Line 460... Line 464...
460
        test    [kb_state], VKEY_NUMLOCK
464
        cmp     cl, 0xE0        ; extended keycode
-
 
465
        jne     @f
-
 
466
 
-
 
467
        cmp     ch, 53
461
        jz      .dowrite
468
        jne     .dowrite
-
 
469
        
Line 462... Line 470...
462
        
470
        mov     bl, '/'
463
        cmp     cl, 0xE0
471
        jmp     .dowrite
Line 464... Line 472...
464
        jz      .dowrite
472
@@:
465
        
473
        
466
        cmp     ch, 55
-
 
467
        jnz     @f
474
        cmp     ch, 55
-
 
475
        jne     @f
-
 
476
        
-
 
477
        mov     bl, '*'
-
 
478
        jmp     .dowrite
-
 
479
@@:
-
 
480
 
-
 
481
        cmp     ch, 74
-
 
482
        jne     @f
-
 
483
        
-
 
484
        mov     bl, '-'
-
 
485
        jmp     .dowrite
-
 
486
@@:
-
 
487
 
-
 
488
        cmp     ch, 78
-
 
489
        jne     @f
-
 
490
        
-
 
491
        mov     bl, '+'
-
 
492
        jmp     .dowrite
468
        
493
@@:
469
        mov     bl, 0x2A        ;*
494
 
Line 470... Line 495...
470
        jmp     .dowrite
495
        test    [kb_state], VKEY_NUMLOCK
471
;--------------------------------------
496
        jz      .dowrite
Line 486... Line 511...
486
        movzx   eax, byte[KEY_COUNT]
511
        movzx   eax, byte[KEY_COUNT]
487
        cmp     al, 120
512
        cmp     al, 120
488
        jae     .exit.irq1
513
        jae     .exit.irq1
489
        inc     eax
514
        inc     eax
490
        mov     [KEY_COUNT], al
515
        mov     [KEY_COUNT], al
-
 
516
; store ascii or scancode
491
        mov     [KEY_COUNT+eax], bl
517
        mov     [KEY_COUNT+eax], bl ; actually KEY_BUFF + EAX - 1
-
 
518
; store original scancode
-
 
519
        add     eax, 120+2
-
 
520
        push    ecx
-
 
521
        cmp     [keyboard_mode], 0; return from keymap
-
 
522
        je      @f
-
 
523
 
-
 
524
        xor     ch, ch
-
 
525
@@:
-
 
526
        mov     [KEY_COUNT+eax], ch ; actually KEY_BUFF + EAX - 1
-
 
527
        pop     ecx
-
 
528
        sub     eax, 120+2
492
.exit.irq1:
529
.exit.irq1:
493
        ret
530
        ret
494
;---------------------------------------------------------------------
531
;---------------------------------------------------------------------
495
set_lights:
532
set_lights:
496
        push    ebx esi
533
        push    ebx esi
Line 516... Line 553...
516
        ret
553
        ret
Line 517... Line 554...
517
 
554
 
518
ps2_set_lights:
555
ps2_set_lights:
519
        stdcall disable_irq, 1
556
        stdcall disable_irq, 1
520
        mov     al, 0xED
557
        mov     al, 0xED
521
        call    kb_write
558
        call    kb_write_wait_ack
522
        mov     al, [esp+8]
559
        mov     al, [esp+8]
523
        call    kb_write
560
        call    kb_write_wait_ack
524
        stdcall enable_irq, 1
561
        stdcall enable_irq, 1
Line 525... Line 562...
525
        ret     8
562
        ret     8
526
 
563