From dcd377f30489919ae32edcf02eb6bb84b4f43a59 Mon Sep 17 00:00:00 2001 From: Albom Date: Sun, 24 Apr 2011 07:51:34 +0000 Subject: [PATCH] Keyboard indicators utility keybi added git-svn-id: svn://kolibrios.org@1918 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/system/keybi/keybi.asm | 162 ++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 programs/system/keybi/keybi.asm diff --git a/programs/system/keybi/keybi.asm b/programs/system/keybi/keybi.asm new file mode 100644 index 0000000000..033b70dc5a --- /dev/null +++ b/programs/system/keybi/keybi.asm @@ -0,0 +1,162 @@ + +; Keyboard indicators v0.1 +; by Albom + +use32 +org 0 +db 'MENUET01' +dd 1 +dd _start +dd _end +dd _memory +dd _stack +dd _param +dd 0 + + +_start: + +call _key_set +call _wnd_draw + +_event_wait: + +mov eax, 10 +int 0x40 + +cmp eax, 1 +jne @f +call _wnd_draw + +@@: +cmp eax, 2 +jne @f +call _key_check + +@@: +cmp eax, 3 +jne @f +call _btn_check + +@@: + + +jmp _event_wait + +_key_set: +mov eax, 66 +mov edx, 0 +mov ebx, 4 +mov cl, 69 +int 0x40 + +mov eax, 66 +mov edx, 0 +mov ebx, 4 +mov cl, 58 +int 0x40 + +mov eax, 66 +mov edx, 0 +mov ebx, 4 +mov cl, 70 +int 0x40 + +ret + + +_wnd_draw: +pusha + +mov eax, 12 +mov ebx, 1 +int 0x40 + +xor eax, eax +mov ebx, 10*65536+100 +mov ecx, 10*65536+30 +mov edx, 0x34ffffff +mov edi, _ind +int 0x40 + +call _indicators_check + +mov eax, 12 +mov ebx, 2 +int 0x40 + +popa +ret + +_key_check: +pusha +mov eax, 2 +int 0x40 + +call _indicators_check + +popa +ret + +_btn_check: +pusha +mov eax, 17 +int 0x40 +cmp ah, 1 +jne @f +mov eax, -1 +int 0x40 +@@: +popa +ret + + +_indicators_check: +pusha + mov eax, 66 + mov ebx, 3 + int 40h + +test_ins: + test eax, 0x80 + jz @f + mov [_ind], '*' + jmp test_caps +@@: + mov [_ind], 'o' + +test_caps: + test eax, 0x40 + jz @f + mov [_ind+1], '*' + jmp test_scroll +@@: + mov [_ind+1], 'o' + +test_scroll: + test eax, 0x100 + jz @f + mov [_ind+2], '*' + jmp test_ok +@@: + mov [_ind+2], 'o' + +test_ok: + mov eax, 71 + mov ebx, 1 + mov ecx, _ind + int 0x40 +popa +ret + +_ind db 'ooo', 0 + +_param: +rb 256 + +_end: + +align 32 +rb 2048 +_stack: +_memory: