Modifications of keybi (using of box_lib) by IgorA

git-svn-id: svn://kolibrios.org@1919 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Albom 2011-04-28 04:02:05 +00:00
parent dcd377f304
commit 2ae48e0a00
2 changed files with 157 additions and 110 deletions

View File

@ -0,0 +1,3 @@
fasm keybi.asm keybi
kpack keybi
pause

View File

@ -1,162 +1,206 @@
; Keyboard indicators v0.2
; Keyboard indicators v0.1 ; by Albom and IgorA
; by Albom
use32 use32
org 0 org 0
db 'MENUET01' db 'MENUET01'
dd 1 dd 1
dd _start dd _start
dd _end dd _end
dd _memory dd _memory
dd _stack dd stacktop
dd _param dd 0
dd 0 dd sys_path
include '../../macros.inc'
include '../../proc32.inc'
include '../../develop/libraries/box_lib/load_lib.mac'
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
;include 'mem.inc'
;include 'dll.inc'
@use_library ;_mem mem.Alloc,mem.Free,mem.ReAlloc, dll.Load
align 4
_start: _start:
load_libraries l_libs_start,l_libs_end
call _key_set mcall 48,3,sc,sizeof.system_colors
call _wnd_draw mcall 40,0x27
_event_wait: init_checkboxes2 check_boxes,check_boxes_end
check_boxes_set_sys_color2 check_boxes,check_boxes_end,sc
call _key_set
mov eax, 10 align 4
int 0x40 red_win:
call draw_window
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 align 4
still:
mcall 10
cmp al,1 ;èçì. ïîëîæåíèå îêíà
jz red_win
cmp al,2
jz key
cmp al,3
jz button
;stdcall [check_box_mouse], ch1
;stdcall [check_box_mouse], ch2
;stdcall [check_box_mouse], ch3
jmp still
;óñòàíîâèòü îáùåñèñòåìíûå "ãîðÿ÷èå êëàâèøè"
align 4
_key_set: _key_set:
mov eax, 66 mov eax, 66
mov edx, 0
mov ebx, 4 mov ebx, 4
mov edx, 0
mov cl, 69 mov cl, 69
int 0x40 int 0x40
mov eax, 66 mov eax, 66
mov edx, 0
mov ebx, 4 mov ebx, 4
mov edx, 0
mov cl, 58 mov cl, 58
int 0x40 int 0x40
mov eax, 66 mov eax, 66
mov edx, 0
mov ebx, 4 mov ebx, 4
mov edx, 0
mov cl, 70 mov cl, 70
int 0x40 int 0x40
ret ret
align 4
draw_window:
pushad
mcall 12,1
xor eax,eax
mov ebx,(10 shl 16)+100
mov ecx,(10 shl 16)+75
mov edx,[sc.work]
or edx,(2 shl 24)+0x10000000+0x20000000
mov edi,[sc.grab] ;[sc.frame]
mov esi,[sc.grab]
int 0x40
_wnd_draw: mov eax,8
pusha mov ebx,(80 shl 16)+10
mov cx,-15
mov eax, 12 shl ecx,16
mov ebx, 1 mov cx,10
int 0x40 mov edx,1
mov esi,[sc.grab_button]
int 0x40
xor eax, eax stdcall [check_box_draw], ch1
mov ebx, 10*65536+100 stdcall [check_box_draw], ch2
mov ecx, 10*65536+30 stdcall [check_box_draw], ch3
mov edx, 0x34ffffff mcall 12,2
mov edi, _ind popad
int 0x40 ret
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
align 4
key:
mcall 2
call _indicators_check
jmp still
align 4
_indicators_check: _indicators_check:
pusha pusha
mov eax, 66 mov eax, 66
mov ebx, 3 mov ebx, 3
int 40h int 40h
test_ins: test_ins:
test eax, 0x80 test eax, 0x80
jz @f jz @f
mov [_ind], '*' bts dword[ch1.flags],1
jmp test_caps jmp test_caps
@@: @@:
mov [_ind], 'o' btr dword[ch1.flags],1
test_caps: test_caps:
test eax, 0x40 test eax, 0x40
jz @f jz @f
mov [_ind+1], '*' bts dword[ch2.flags],1
jmp test_scroll jmp test_scroll
@@: @@:
mov [_ind+1], 'o' btr dword[ch2.flags],1
test_scroll: test_scroll:
test eax, 0x100 test eax, 0x100
jz @f jz @f
mov [_ind+2], '*' bts dword[ch3.flags],1
jmp test_ok jmp test_ok
@@: @@:
mov [_ind+2], 'o' btr dword[ch3.flags],1
test_ok: test_ok:
mov eax, 71 call draw_window
mov ebx, 1
mov ecx, _ind
int 0x40
popa popa
ret ret
_ind db 'ooo', 0 align 4
button:
mcall 17
cmp ah,1
jne still
.exit:
mcall -1
_param:
rb 256 check_boxes:
ch1 check_box2 (5 shl 16)+15,(5 shl 16)+10,5, 0xffffff,0x8000,0xff,\
txt_160,0+ch_flag_middle
ch2 check_box2 (5 shl 16)+15,(17 shl 16)+10,5, 0xffffff,0x8000,0xff,\
txt_159,0+ch_flag_middle
ch3 check_box2 (5 shl 16)+15,(29 shl 16)+10,5, 0xffffff,0x8000,0xff,\
txt_158,0+ch_flag_middle
check_boxes_end:
txt_160 db 'Num',0
txt_159 db 'Caps',0
txt_158 db 'Scroll',0
head_f_i:
head_f_l db 'Ñèñòåìíàÿ îøèáêà',0
system_dir_0 db '/sys/lib/'
lib_name_0 db 'box_lib.obj',0
err_msg_found_lib_0 db 'Íå íàéäåíà áèáëèîòåêà box_lib.obj',0
err_msg_import_0 db 'Îøèáêà ïðè èìïîðòå áèáëèîòåêè box_lib',0
l_libs_start:
lib_0 l_libs lib_name_0, sys_path, library_path, system_dir_0,\
err_msg_found_lib_0,head_f_l,import_box_lib,err_msg_import_0,head_f_i
l_libs_end:
align 4
import_box_lib:
;init dd sz_init
init_checkbox dd sz_init_checkbox
check_box_draw dd sz_check_box_draw
check_box_mouse dd sz_check_box_mouse
dd 0,0
;sz_init db 'lib_init',0
sz_init_checkbox db 'init_checkbox2',0
sz_check_box_draw db 'check_box_draw2',0
sz_check_box_mouse db 'check_box_mouse2',0
;mouse_dd dd 0x0
sc system_colors
_end: _end:
align 32 align 32
rb 2048 rb 2048
_stack: stacktop:
sys_path rb 1024
library_path rb 1024
_memory: _memory: