/programs/develop/libraries/box_lib/trunk/box_lib.asm |
---|
9,8 → 9,8 |
section '.flat' code readable align 16 |
include 'macros.inc' |
include 'editbox.mac' ;¬ ªà®á ª®â®àë© ¤®«¦¥ ®¡«¥£ç¨âì ¦¨§ì :) á¯¥æ¨ «ì® ¤«ï editbox |
include 'checkbox.mac' ;¬ ªà®á ᮤ¥à¦¨â ॠ«¨§ æ¨î checkbox |
include 'editbox.mac' ;¬ ªà®á ª®â®àë© ¤®«¦¥ ®¡«¥£ç¨âì ¦¨§ì :) á¯¥æ¨ «ì® ¤«ï editbox |
include 'checkbox.mac' ;¬ ªà®á ᮤ¥à¦¨â ॠ«¨§ æ¨î checkbox |
include 'optionbox.mac' ;¬ ªà®á ᮤ¥à¦¨â ॠ«¨§ æ¨î optionbox |
include 'scrollbar.mac' ;¬ ªà®á ᮤ¥à¦¨â ॠ«¨§ æ¨î scrollbar |
include 'd_button.mac' ;¬ ªà®á ᮤ¥à¦¨â ॠ«¨§ æ¨î dinamic button |
18,106 → 18,129 |
;---------------------------------------------------- |
;EditBox |
;---------------------------------------------------- |
align 4 |
use_editbox_draw ;¬ ªà®á à ááªàë¢ ¥â äãªæ¨î ®â®¡à ¦¥¨ï ¡®ªá . |
align 4 |
use_editbox_key ;¬ ªà®á à ááªàë¢ ¥â äãªæ¨î ®¡à ¡®âª¨ ª« ¢¨èì. |
align 4 |
use_editbox_mouse ;¬ ªà®á à ááªàë¢ ¥â äãªæ¨î ®¡à ¡®âª¨ ¬ëè¨. |
use_editbox_draw ;¬ ªà®á à ááªàë¢ ¥â äãªæ¨î ®â®¡à ¦¥¨ï ¡®ªá . |
use_editbox_key ;¬ ªà®á à ááªàë¢ ¥â äãªæ¨î ®¡à ¡®âª¨ ª« ¢¨èì. |
use_editbox_mouse ;¬ ªà®á à ááªàë¢ ¥â äãªæ¨î ®¡à ¡®âª¨ ¬ëè¨. |
;---------------------------------------------------- |
;CheckBox |
;---------------------------------------------------- |
use_checkbox_draw ;¬ ªà®á à ááªàë¢ ¥â äãªæ¨î ®â®¡à ¦¥¨ï ¡®ªá . |
use_checkbox_mouse ;¬ ªà®á à ááªàë¢ ¥â äãªæ¨î ®¡à ¡®âª¨ ¬ëè¨. |
align 4 |
use_checkbox_draw ;¬ ªà®á à ááªàë¢ ¥â äãªæ¨î ®â®¡à ¦¥¨ï ¡®ªá . |
align 4 |
use_checkbox_mouse ;¬ ªà®á à ááªàë¢ ¥â äãªæ¨î ®¡à ¡®âª¨ ¬ëè¨. |
;-------------------------------------------------- |
;radiobutton Group |
;-------------------------------------------------- |
use_optionbox_driver ;¬ ªà®áë ª®â®àë¥ ã¯à ¢«ïîâ à ¡®â®© ¡®ªá ) |
use_optionbox_draw ;¬ ªà®á à ááªàë¢ ¥â äãªæ¨î ®â®¡à ¦¥¨ï ¡®ªá . |
use_optionbox_mouse ;¬ ªà®á à ááªàë¢ ¥â äãªæ¨î ®¡à ¡®âª¨ ¬ëè¨. |
align 4 |
use_optionbox_driver ;¬ ªà®áë ª®â®àë¥ ã¯à ¢«ïîâ à ¡®â®© ¡®ªá ) |
align 4 |
use_optionbox_draw ;¬ ªà®á à ááªàë¢ ¥â äãªæ¨î ®â®¡à ¦¥¨ï ¡®ªá . |
align 4 |
use_optionbox_mouse ;¬ ªà®á à ááªàë¢ ¥â äãªæ¨î ®¡à ¡®âª¨ ¬ëè¨. |
;-------------------------------------------------- |
;scrollbar Group |
;-------------------------------------------------- |
align 4 |
use_scroll_bar |
align 4 |
use_scroll_bar_vertical |
align 4 |
use_scroll_bar_horizontal |
;-------------------------------------------------- |
;dinamic button Group |
;-------------------------------------------------- |
align 4 |
use_dinamic_button |
;-------------------------------------------------- |
;menubar Group |
;-------------------------------------------------- |
align 4 |
use_menu_bar |
;-------------------------------------------------- |
init: |
ret |
;;;;;;;;;;; |
;;Data |
;;;;;;;;;;; |
align 4 |
mouse_flag dd 0x0 |
align 16 |
EXPORTS: |
dd sz_init, init |
dd sz_version, 0x00000001 |
dd sz_edit_box, edit_box |
dd sz_edit_box_key, edit_box_key |
dd sz_edit_box_mouse, edit_box_mouse |
dd szVersion_ed, 0x00000001 |
dd sz_check_box_draw, check_box_draw |
dd sz_check_box_mouse, check_box_mouse |
dd szVersion_ch, 0x00000001 |
dd sz_option_box_draw, option_box_draw |
dd sz_option_box_mouse, option_box_mouse |
dd szVersion_op, 0x00000001 |
dd sz_Scrollbar_ver_draw, scroll_bar_vertical.draw |
dd sz_Scrollbar_ver_mouse, scroll_bar_vertical.mouse |
dd sz_Scrollbar_hor_draw, scroll_bar_horizontal.draw |
dd sz_Scrollbar_hor_mouse, scroll_bar_horizontal.mouse |
dd szVersion_scrollbar, 0x00010001 |
dd sz_Dbutton_draw, dinamic_button.draw |
dd sz_Dbutton_mouse, dinamic_button.mouse |
dd szVersion_dbutton, 0x00010001 |
dd sz_Menu_bar_draw, menu_bar.draw |
dd sz_Menu_bar_mouse, menu_bar.mouse |
dd szVersion_menu_bar, 0x00010001 |
dd 0,0 |
dd sz_init, init |
dd sz_version, 0x00000001 |
dd sz_edit_box, edit_box |
dd sz_edit_box_key, edit_box_key |
dd sz_edit_box_mouse, edit_box_mouse |
dd szVersion_ed, 0x00000001 |
sz_init db 'lib_init',0 |
sz_version db 'version',0 |
sz_edit_box db 'edit_box',0 |
dd sz_check_box_draw, check_box_draw |
dd sz_check_box_mouse, check_box_mouse |
dd szVersion_ch, 0x00000001 |
dd sz_option_box_draw, option_box_draw |
dd sz_option_box_mouse, option_box_mouse |
dd szVersion_op, 0x00000001 |
dd sz_Scrollbar_ver_draw, scroll_bar_vertical.draw |
dd sz_Scrollbar_ver_mouse, scroll_bar_vertical.mouse |
dd sz_Scrollbar_hor_draw, scroll_bar_horizontal.draw |
dd sz_Scrollbar_hor_mouse, scroll_bar_horizontal.mouse |
dd szVersion_scrollbar, 0x00010001 |
dd sz_Dbutton_draw, dinamic_button.draw |
dd sz_Dbutton_mouse, dinamic_button.mouse |
dd szVersion_dbutton, 0x00010001 |
dd sz_Menu_bar_draw, menu_bar.draw |
dd sz_Menu_bar_mouse, menu_bar.mouse |
dd szVersion_menu_bar, 0x00010001 |
dd 0,0 |
sz_init db 'lib_init',0 |
sz_version db 'version',0 |
sz_edit_box db 'edit_box',0 |
sz_edit_box_key db 'edit_box_key',0 |
sz_edit_box_mouse db 'edit_box_mouse',0 |
szVersion_ed db 'version_ed',0 |
szVersion_ed db 'version_ed',0 |
sz_check_box_draw db 'check_box_draw',0 |
sz_check_box_mouse db 'check_box_mouse',0 |
szVersion_ch db 'version_ch',0 |
szVersion_ch db 'version_ch',0 |
sz_option_box_draw db 'option_box_draw',0 |
sz_option_box_mouse db 'option_box_mouse',0 |
szVersion_op db 'version_op',0 |
sz_Scrollbar_ver_draw db 'scrollbar_v_draw',0 |
sz_Scrollbar_ver_mouse db 'scrollbar_v_mouse',0 |
sz_Scrollbar_hor_draw db 'scrollbar_h_draw',0 |
sz_Scrollbar_hor_mouse db 'scrollbar_h_mouse',0 |
szVersion_scrollbar db 'version_scrollbar',0 |
sz_Dbutton_draw db 'dbutton_draw',0 |
sz_Dbutton_mouse db 'dbutton_mouse',0 |
szVersion_dbutton db 'version_dbutton',0 |
sz_Menu_bar_draw db 'menu_bar_draw',0 |
sz_Menu_bar_mouse db 'menu_bar_mouse',0 |
szVersion_menu_bar db 'version_menu_bar',0 |
szVersion_op db 'version_op',0 |
;;;;;;;;;;; |
;;Data |
;;;;;;;;;;; |
align 16 |
mouse_flag dd 0x0 |
sz_Scrollbar_ver_draw db 'scrollbar_v_draw',0 |
sz_Scrollbar_ver_mouse db 'scrollbar_v_mouse',0 |
sz_Scrollbar_hor_draw db 'scrollbar_h_draw',0 |
sz_Scrollbar_hor_mouse db 'scrollbar_h_mouse',0 |
szVersion_scrollbar db 'version_scrollbar',0 |
sz_Dbutton_draw db 'dbutton_draw',0 |
sz_Dbutton_mouse db 'dbutton_mouse',0 |
szVersion_dbutton db 'version_dbutton',0 |
sz_Menu_bar_draw db 'menu_bar_draw',0 |
sz_Menu_bar_mouse db 'menu_bar_mouse',0 |
szVersion_menu_bar db 'version_menu_bar',0 |
/programs/develop/libraries/box_lib/trunk/ctrldemo.asm |
---|
5,14 → 5,14 |
; |
; Redistribution and use in source and binary forms, with or without |
; modification, are permitted provided that the following conditions are met: |
; * Redistributions of source code must retain the above copyright |
; notice, this list of conditions and the following disclaimer. |
; * Redistributions in binary form must reproduce the above copyright |
; notice, this list of conditions and the following disclaimer in the |
; documentation and/or other materials provided with the distribution. |
; * Neither the name of the <organization> nor the |
; names of its contributors may be used to endorse or promote products |
; derived from this software without specific prior written permission. |
; * Redistributions of source code must retain the above copyright |
; notice, this list of conditions and the following disclaimer. |
; * Redistributions in binary form must reproduce the above copyright |
; notice, this list of conditions and the following disclaimer in the |
; documentation and/or other materials provided with the distribution. |
; * Neither the name of the <organization> nor the |
; names of its contributors may be used to endorse or promote products |
; derived from this software without specific prior written permission. |
; |
; THIS SOFTWARE IS PROVIDED BY Mario79 ''AS IS'' AND ANY |
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
28,404 → 28,356 |
; import_boxlib procedure written by <Lrz> |
;--------------------------------------------------------------------- |
use32 |
org 0x0 |
use32 |
org 0x0 |
db 'MENUET01' |
dd 0x01 |
dd START |
dd IM_END |
dd I_END |
dd stacktop |
dd 0x0 |
dd path |
db 'MENUET01' |
dd 0x01 |
dd START |
dd IM_END |
dd I_END |
dd stacktop |
dd 0x0 |
dd path |
include 'MACROS.INC' |
include 'load_lib.mac' |
;--------------------------------------------------------------------- |
;--- Start of program ---------------------------------------------- |
;--- Start of program ---------------------------------------------- |
;--------------------------------------------------------------------- |
START: |
mcall 68, 11 |
mcall 66, 1, 1 |
mcall 40, 0x27 |
;--------------------------------------------------------------------- |
mcall 68, 11 |
mcall 66, 1, 1 |
mcall 40, 0x27 |
;--------------------------------------------------------------------- |
; Procinfo area for function 9 in MenuBar |
mcall 68,12,1024 |
mov [menu_data_1.procinfo],eax |
mov [menu_data_2.procinfo],eax |
;--------------------------------------------------------------------- |
mcall 68,12,1024 |
mov [menu_data_1.procinfo],eax |
mov [menu_data_2.procinfo],eax |
;--------------------------------------------------------------------- |
; loading Box_Lib library |
mov ebx,boxlib_name |
mov esi,path |
mov edi,file_name |
call copy_path |
load_libraries l_libs_start,end_l_libs |
;sys_load_library boxlib_name, path, file_name, system_dir, \ |
;er_message_found_lib, ihead_f_l, myimport, er_message_import, ihead_f_i |
; test eax,eax |
; jnz button.exit |
mcall 68,19,file_name ; load of alternative |
test eax,eax |
jnz @f |
mcall 68,19,system_dir ; load of sys directory |
test eax,eax |
jz button.exit |
@@: |
call import_boxlib |
;----------------------------------old |
; mov ebx,boxlib_name |
; mov esi,path |
; mov edi,file_name |
; call copy_path |
; |
; mcall 68,19,file_name ; load of alternative |
; test eax,eax |
; jnz @f |
; |
; mcall 68,19,system_dir ; load of sys directory |
; test eax,eax |
; jz button.exit |
;@@: |
; call import_boxlib |
;--------------------------------------------------------------------- |
; Load and convert BMP file for DinamicButton |
; This procedures use cnv_bmp.obj and this module used only for |
; demonstration of use DinamicButton |
; mov ebx,plugin_BMP_name |
; mov esi,path |
; mov edi,file_name |
copy_path plugin_BMP_name,path,file_name |
; |
mcall 68,19,file_name |
test eax,eax |
jz button.exit |
mov eax,[eax+4] |
mov [plugin],eax |
mov ebx,plugin_BMP_name |
mov esi,path |
mov edi,file_name |
call copy_path |
mcall 68,19,file_name |
test eax,eax |
jz button.exit |
mov eax,[eax+4] |
mov [plugin],eax |
mov ebx,icons_file_name |
mov esi,path |
mov edi,file_name |
call copy_path |
mcall 70, fileinfo |
;ïðîâåðêà íà ñêîëüêî óäà÷íî çàãóçèëàñü íàøà ëèáà |
mov ebp,library01 |
cmp dword [ebp+ll_struc_size-4],0 |
jnz button.exit |
; |
; mov ebp,library02 |
; cmp dword [ebp+ll_struc_size-4],0x2 |
; jnz button.exit |
; mov eax,dword [ebp+36] |
; mov eax,[eax+4] |
; mov [plugin],eax |
mov [fileinfo+0],dword 0 |
; mov ebx,icons_file_name |
; mov esi,path |
; mov edi,file_name |
copy_path icons_file_name,path,file_name |
mcall 70, fileinfo |
mov ecx,[file_info+32] |
mov [fileinfo+12],ecx |
mov [img_size],ecx |
mov [fileinfo+0],dword 0 |
mcall 68, 12 |
mov ecx,[file_info+32] |
mov [fileinfo+12],ecx |
mov [img_size],ecx |
mcall 68, 12 |
mov [fileinfo+16],eax |
mov [image_file],eax |
mov [fileinfo+16],eax |
mov [image_file],eax |
mcall 70, fileinfo |
xor eax,eax |
mov [return_code],eax |
mov eax,image_file |
call [plugin] |
mov ecx,[image_file] |
mcall 68, 13, |
cmp [return_code],dword 0 |
jne button.exit |
mov ebx,[raw_pointer] |
mov eax,[ebx+4] |
; set of button size |
mov [dinamic_button_data_1.size_x],ax |
mov [dinamic_button_data_1.size_y],ax |
mov [dinamic_button_data_2.size_x],ax |
mov [dinamic_button_data_2.size_y],ax |
mov eax,[ebx+12] |
; set of RAW resolution to pixel |
mov [dinamic_button_data_1.resolution_raw],eax |
mov [dinamic_button_data_2.resolution_raw],eax |
mov eax,[ebx+20] |
add eax,ebx |
; set RAW palette, use else resolution 8bit or less |
mov [dinamic_button_data_1.palette_raw],eax |
mov [dinamic_button_data_2.palette_raw],eax |
mov eax,[ebx+28] |
add eax,ebx |
; set RAW area for passive button |
mov [dinamic_button_data_1.passive_raw],eax |
mov [dinamic_button_data_2.passive_raw],eax |
mov ecx,[ebx+4] |
imul ecx,[ebx+4] |
imul ecx,[ebx+12] |
shr ecx,3 |
add eax,ecx |
; set RAW area for active button |
mov [dinamic_button_data_1.active_raw],eax |
mov [dinamic_button_data_2.active_raw],eax |
add eax,ecx |
; RAW area for click button |
mov [dinamic_button_data_1.click_raw],eax |
mov [dinamic_button_data_2.click_raw],eax |
;--------------------------------------------------------------------- |
mcall 70, fileinfo |
xor eax,eax |
mov [return_code],eax |
mov eax,image_file |
call [plugin] |
mov ecx,[image_file] |
mcall 68, 13, |
cmp [return_code],dword 0 |
jne button.exit |
mov ebx,[raw_pointer] |
mov eax,[ebx+4] |
; set of button size |
mov [dinamic_button_data_1.size_x],ax |
mov [dinamic_button_data_1.size_y],ax |
mov [dinamic_button_data_2.size_x],ax |
mov [dinamic_button_data_2.size_y],ax |
mov eax,[ebx+12] |
; set of RAW resolution to pixel |
mov [dinamic_button_data_1.resolution_raw],eax |
mov [dinamic_button_data_2.resolution_raw],eax |
mov eax,[ebx+20] |
add eax,ebx |
; set RAW palette, use else resolution 8bit or less |
mov [dinamic_button_data_1.palette_raw],eax |
mov [dinamic_button_data_2.palette_raw],eax |
mov eax,[ebx+28] |
add eax,ebx |
; set RAW area for passive button |
mov [dinamic_button_data_1.passive_raw],eax |
mov [dinamic_button_data_2.passive_raw],eax |
mov ecx,[ebx+4] |
imul ecx,[ebx+4] |
imul ecx,[ebx+12] |
shr ecx,3 |
add eax,ecx |
; set RAW area for active button |
mov [dinamic_button_data_1.active_raw],eax |
mov [dinamic_button_data_2.active_raw],eax |
add eax,ecx |
; RAW area for click button |
mov [dinamic_button_data_1.click_raw],eax |
mov [dinamic_button_data_2.click_raw],eax |
;--------------------------------------------------------------------- |
red: |
call draw_window |
call draw_window |
still: |
mcall 10 |
mcall 10 |
cmp eax,1 |
je red |
cmp eax,2 |
je key |
cmp eax,3 |
je button |
cmp eax,6 |
je mouse |
jmp still |
cmp eax,1 |
je red |
cmp eax,2 |
je key |
cmp eax,3 |
je button |
cmp eax,6 |
je mouse |
jmp still |
;--------------------------------------------------------------------- |
key: |
mcall 2 |
jmp still |
key: |
mcall 2 |
jmp still |
;--------------------------------------------------------------------- |
button: |
mcall 17 |
cmp ah, 1 |
jne still |
.exit: |
mcall -1 |
button: |
mcall 17 |
cmp ah, 1 |
jne still |
.exit: |
mcall -1 |
;--------------------------------------------------------------------- |
mouse: |
;----------------------------------------------- |
cmp [scroll_bar_data_horizontal.delta2],0 |
jne .horizontal |
cmp [scroll_bar_data_horizontal.delta2],0 |
jne .horizontal |
.vertical: |
mov eax,[scroll_bar_data_vertical.max_area] |
cmp eax,[scroll_bar_data_vertical.cur_area] |
jbe .horizontal |
; mouse event for Vertical ScrollBar |
push dword scroll_bar_data_vertical |
call [scrollbar_ver_mouse] |
mov eax,scroll_bar_data_vertical.redraw |
xor ebx,ebx |
cmp [eax],ebx |
je @f |
mov [eax],ebx |
jmp .draw_cube |
push dword scroll_bar_data_vertical |
call [scrollbar_ver_mouse] |
mov eax,scroll_bar_data_vertical.redraw |
xor ebx,ebx |
cmp [eax],ebx |
je @f |
mov [eax],ebx |
jmp .draw_cube |
@@: |
cmp [scroll_bar_data_vertical.delta2],0 |
jne still |
cmp [scroll_bar_data_vertical.delta2],0 |
jne still |
.horizontal: |
mov eax,[scroll_bar_data_horizontal.max_area] |
cmp eax,[scroll_bar_data_horizontal.cur_area] |
jbe .other |
; mouse event for Horizontal ScrollBar |
push dword scroll_bar_data_horizontal |
call [scrollbar_hor_mouse] |
mov eax,scroll_bar_data_horizontal.redraw |
xor ebx,ebx |
cmp [eax],ebx |
je .other |
mov [eax],ebx |
push dword scroll_bar_data_horizontal |
call [scrollbar_hor_mouse] |
mov eax,scroll_bar_data_horizontal.redraw |
xor ebx,ebx |
cmp [eax],ebx |
je .other |
mov [eax],ebx |
.draw_cube: |
call draw_cube |
jmp still |
call draw_cube |
jmp still |
.other: |
cmp [scroll_bar_data_vertical.delta2],0 |
jne still |
cmp [scroll_bar_data_horizontal.delta2],0 |
jne still |
cmp [scroll_bar_data_vertical.delta2],0 |
jne still |
cmp [scroll_bar_data_horizontal.delta2],0 |
jne still |
;----------------------------------------------- |
.menu_bar_1: |
call .set_mouse_flag |
call .set_mouse_flag |
@@: |
; mouse event for Menu 1 |
push dword menu_data_1 |
call [menu_bar_mouse] |
push dword menu_data_1 |
call [menu_bar_mouse] |
cmp [menu_data_1.click],dword 1 |
jne .menu_bar_2 |
cmp [menu_data_1.cursor_out],dword 0 |
jne analyse_out_menu_1 |
jmp .menu_bar_1 |
jne .menu_bar_2 |
cmp [menu_data_1.cursor_out],dword 0 |
jne analyse_out_menu_1 |
jmp .menu_bar_1 |
;-------------------------------------------- |
.menu_bar_2: |
; mouse event for Menu 2 |
push dword menu_data_2 |
call [menu_bar_mouse] |
push dword menu_data_2 |
call [menu_bar_mouse] |
cmp [menu_data_2.click],dword 1 |
jne .mouse_dinamic_button |
cmp [menu_data_2.cursor_out],dword 0 |
jne analyse_out_menu_2 |
jne .mouse_dinamic_button |
cmp [menu_data_2.cursor_out],dword 0 |
jne analyse_out_menu_2 |
jmp .menu_bar_1 |
;-------------------------------------------- |
.mouse_dinamic_button: |
; mouse event for Dinamic Button 1 |
push dword dinamic_button_data_1 |
call [dinamic_button_mouse] |
mov eax,dinamic_button_data_1.click |
push dword dinamic_button_data_1 |
call [dinamic_button_mouse] |
mov eax,dinamic_button_data_1.click |
cmp [eax],dword 1 |
jne @f |
jne @f |
mov [eax],dword 0 |
jmp about |
jmp about |
@@: |
; mouse event for Dinamic Button 2 |
push dword dinamic_button_data_2 |
call [dinamic_button_mouse] |
mov eax,dinamic_button_data_2.click |
push dword dinamic_button_data_2 |
call [dinamic_button_mouse] |
mov eax,dinamic_button_data_2.click |
cmp [eax],dword 1 |
jne still ;@f |
jne still ;@f |
mov [eax],dword 0 |
jmp button.exit |
jmp button.exit |
;--------------------------------------------------------------------- |
.set_mouse_flag: |
xor eax,eax |
inc eax |
mov [menu_data_1.get_mouse_flag],eax |
mov [menu_data_2.get_mouse_flag],eax |
ret |
.set_mouse_flag: |
xor eax,eax |
inc eax |
mov [menu_data_1.get_mouse_flag],eax |
mov [menu_data_2.get_mouse_flag],eax |
ret |
;--------------------------------------------------------------------- |
analyse_out_menu_1: |
; analyse result of Menu 1 |
cmp [menu_data_1.cursor_out],dword 3 |
je button.exit |
jmp still |
cmp [menu_data_1.cursor_out],dword 3 |
je button.exit |
jmp still |
analyse_out_menu_2: |
; analyse result of Menu 2 |
cmp [menu_data_2.cursor_out],dword 2 |
je about |
jmp still |
cmp [menu_data_2.cursor_out],dword 2 |
je about |
jmp still |
;--------------------------------------------------------------------- |
about: |
mcall 51,1,thread3,thread |
jmp still |
about: |
mcall 51,1,thread3,thread |
jmp still |
;--------------------------------------------------------------------- |
draw_window: |
mcall 12, 1 |
mcall 0, <0,400>, <0,400>, 0x03AABBCC, 0x805080D0, 0x005080D0 |
mcall 71, 1, header_1 |
mcall 12, 1 |
mcall 0, <0,400>, <0,400>, 0x03AABBCC, 0x805080D0, 0x005080D0 |
mcall 71, 1, header_1 |
;--------------------------------------------- |
; draw for Menu 1 |
push dword menu_data_1 |
call [menu_bar_draw] |
push dword menu_data_1 |
call [menu_bar_draw] |
; draw for Menu 2 |
push dword menu_data_2 |
call [menu_bar_draw] |
push dword menu_data_2 |
call [menu_bar_draw] |
;--------------------------------------------- |
; draw for Dinamic Button 1 |
push dword dinamic_button_data_1 |
call [dinamic_button_draw] |
push dword dinamic_button_data_1 |
call [dinamic_button_draw] |
; draw for Dinamic Button 2 |
push dword dinamic_button_data_2 |
call [dinamic_button_draw] |
push dword dinamic_button_data_2 |
call [dinamic_button_draw] |
;--------------------------------------------- |
; set all_redraw flag for draw all ScrollBar |
; In some cases it is necessity to draw only the area |
; of moving of a "runner", for acceleration of output - |
; in this case the flag needs to be reset to 0 (zero). |
xor eax,eax |
inc eax |
mov [scroll_bar_data_vertical.all_redraw],eax |
mov [scroll_bar_data_horizontal.all_redraw],eax |
xor eax,eax |
inc eax |
mov [scroll_bar_data_vertical.all_redraw],eax |
mov [scroll_bar_data_horizontal.all_redraw],eax |
; draw for Vertical ScrollBar |
push dword scroll_bar_data_vertical |
call [scrollbar_ver_draw] |
push dword scroll_bar_data_vertical |
call [scrollbar_ver_draw] |
; draw for Horizontal ScrollBar |
push dword scroll_bar_data_horizontal |
call [scrollbar_hor_draw] |
; reset all_redraw flag |
xor eax,eax |
mov [scroll_bar_data_vertical.all_redraw],eax |
mov [scroll_bar_data_horizontal.all_redraw],eax |
push dword scroll_bar_data_horizontal |
call [scrollbar_hor_draw] |
; reset all_redraw flag |
xor eax,eax |
mov [scroll_bar_data_vertical.all_redraw],eax |
mov [scroll_bar_data_horizontal.all_redraw],eax |
;--------------------------------------------- |
call draw_cube |
mcall 12, 2 |
ret |
call draw_cube |
mcall 12, 2 |
ret |
;--------------------------------------------------------------------- |
draw_cube: |
mcall 13,<30,301>,<50,301>,0xafafaf |
mov ecx,[scroll_bar_data_vertical.position] |
add ecx,50 |
shl ecx,16 |
mov cx,30 |
mov ebx,[scroll_bar_data_horizontal.position] |
add ebx,30 |
shl ebx,16 |
mov bx,30 |
mcall 13, , , 0x0 |
ret |
;--------------------------------------------------------------------- |
copy_path: |
xor eax,eax |
@@: |
cld |
lodsb |
stosb |
test eax,eax |
jnz @b |
mov esi,edi |
@@: |
std |
lodsb |
cmp al,'/' |
jnz @b |
mov edi,esi |
add edi,2 |
mov esi,ebx |
@@: |
cld |
lodsb |
stosb |
test eax,eax |
jnz @b |
ret |
;--------------------------------------------------------------------- |
; Import procedure written by <Lrz> |
; Copyright (c) 2008, 2009, <Lrz> |
; All rights reserved. |
; importing Box_lib entry |
mcall 13,<30,301>,<50,301>,0xafafaf |
mov ecx,[scroll_bar_data_vertical.position] |
add ecx,50 |
shl ecx,16 |
mov cx,30 |
mov ebx,[scroll_bar_data_horizontal.position] |
add ebx,30 |
shl ebx,16 |
mov bx,30 |
mcall 13, , , 0x0 |
ret |
import_boxlib: |
; initialize import |
mov edx, eax |
mov esi,myimport |
.import_loop: |
lodsd |
test eax, eax |
jz .import_done |
push edx |
.import_find: |
mov ebx, [edx] |
test ebx, ebx |
jz .exit ;import_not_found |
push eax |
@@: |
mov cl, [eax] |
cmp cl, [ebx] |
jnz .import_find_next |
test cl, cl |
jz .import_found |
inc eax |
inc ebx |
jmp @b |
.import_find_next: |
pop eax |
add edx, 8 |
jmp .import_find |
.import_found: |
pop eax |
mov eax, [edx+4] |
mov [esi-4], eax |
pop edx |
jmp .import_loop |
.import_done: |
ret |
.exit: |
add esp,4 |
jmp button.exit |
;--------------------------------------------------------------------- |
include 'data.inc' |
include 'w_about.inc' |
include 'data.inc' |
include 'w_about.inc' |
IM_END: |
rb 1024 |
rb 1024 |
thread: |
rb 1024 |
rb 1024 |
stacktop: |
path: |
rb 4096 |
rb 4096 |
file_name: |
rb 4096 |
rb 4096 |
file_info: |
rb 40 |
rb 40 |
I_END: |
/programs/develop/libraries/box_lib/trunk/data.inc |
---|
1,18 → 1,43 |
;--------------------------------------------------------------------- |
;--- ÄÀÍÍÛÅ ÏÐÎÃÐÀÌÌÛ ---------------------------------------------- |
;--------------------------------------------------------------------- |
@use_library |
header_1 db 'Box_lib Control Demo by Mario79',0 |
ok_btn db 'Ok',0 |
labelt3 db 'About program',0 |
;--------------------------------------------------------------------- |
icons_file_name: db 'reload_16x16_8b.bmp',0 |
system_dir1 db '/sys/lib/' |
plugin_BMP_name db 'cnv_bmp.obj',0 |
boxlib_name db 'box_lib.obj',0 |
system_dir db '/sys/lib/box_lib.obj',0 |
system_dir db '/sys/lib/' |
boxlib_name db 'box_lib.obj',0 |
; Åñëè åñòü æåëàíèå ðàçúåäèíèòü, òî íóæíî èñïîëüçîâàòü ñëåäóþùèþ êîíñòðóêöèþ |
;system_path db '/sys/lib/box_lib.obj',0 |
;... ëþáàÿ ïîñëåäîâàòåëüíîñòü äðóãèõ êîìàíä è îïðåäåëåíèé. |
;library_name db 'box_lib.obj',0 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
ihead_f_i: |
ihead_f_l db 'System error',0 |
er_message_found_lib db 'Sorry I cannot load library box_lib.obj',0 |
er_message_import db 'Error on load import library box_lib.obj',0 |
er_message_found_lib2 db 'Sorry I cannot load library cnv_bmp.obj',0 |
er_message_import2 db 'Error on load import library cnv_bmp.obj',0 |
align 4 |
l_libs_start: |
library01 l_libs boxlib_name, path, file_name, system_dir, \ |
er_message_found_lib, ihead_f_l, myimport, er_message_import, ihead_f_i |
;library02 l_libs plugin_BMP_name, path, file_name, system_dir1,\ |
;er_message_found_lib2, ihead_f_l, myimport, er_message_import2, ihead_f_i |
end_l_libs: |
;--------------------------------------------------------------------- |
fileinfo: |
dd 5 |
22,8 → 47,8 |
dd file_info |
string: |
db 0 |
dd file_name |
dd file_name |
plugin dd 0 |
;--------------------------------------------------------------------- |
; not change this section!!! |
41,7 → 66,10 |
;--------------------------------------------------------------------- |
align 4 |
myimport: |
init_lib dd a_init |
version_lib dd a_version |
edit_box_draw dd aEdit_box_draw |
edit_box_key dd aEdit_box_key |
edit_box_mouse dd aEdit_box_mouse |
55,22 → 83,25 |
option_box_mouse dd aOption_box_mouse |
version_op dd aVersion_op |
scrollbar_ver_draw dd aScrollbar_ver_draw |
scrollbar_ver_mouse dd aScrollbar_ver_mouse |
scrollbar_hor_draw dd aScrollbar_hor_draw |
scrollbar_hor_mouse dd aScrollbar_hor_mouse |
version_scrollbar dd aVersion_scrollbar |
scrollbar_ver_draw dd aScrollbar_ver_draw |
scrollbar_ver_mouse dd aScrollbar_ver_mouse |
scrollbar_hor_draw dd aScrollbar_hor_draw |
scrollbar_hor_mouse dd aScrollbar_hor_mouse |
version_scrollbar dd aVersion_scrollbar |
dinamic_button_draw dd aDbutton_draw |
dinamic_button_mouse dd aDbutton_mouse |
version_dbutton dd aVersion_dbutton |
dinamic_button_draw dd aDbutton_draw |
dinamic_button_mouse dd aDbutton_mouse |
version_dbutton dd aVersion_dbutton |
menu_bar_draw dd aMenu_bar_draw |
menu_bar_mouse dd aMenu_bar_mouse |
version_menu_bar dd aVersion_menu_bar |
menu_bar_draw dd aMenu_bar_draw |
menu_bar_mouse dd aMenu_bar_mouse |
version_menu_bar dd aVersion_menu_bar |
dd 0 |
dd 0 |
a_init db 'lib_init',0 |
a_version db 'version',0 |
aEdit_box_draw db 'edit_box',0 |
aEdit_box_key db 'edit_box_key',0 |
aEdit_box_mouse db 'edit_box_mouse',0 |
84,22 → 115,22 |
aOption_box_mouse db 'option_box_mouse',0 |
aVersion_op db 'version_op',0 |
aScrollbar_ver_draw db 'scrollbar_v_draw',0 |
aScrollbar_ver_mouse db 'scrollbar_v_mouse',0 |
aScrollbar_hor_draw db 'scrollbar_h_draw',0 |
aScrollbar_hor_mouse db 'scrollbar_h_mouse',0 |
aVersion_scrollbar db 'version_scrollbar',0 |
aScrollbar_ver_draw db 'scrollbar_v_draw',0 |
aScrollbar_ver_mouse db 'scrollbar_v_mouse',0 |
aScrollbar_hor_draw db 'scrollbar_h_draw',0 |
aScrollbar_hor_mouse db 'scrollbar_h_mouse',0 |
aVersion_scrollbar db 'version_scrollbar',0 |
aDbutton_draw db 'dbutton_draw',0 |
aDbutton_mouse db 'dbutton_mouse',0 |
aVersion_dbutton db 'version_dbutton',0 |
aDbutton_draw db 'dbutton_draw',0 |
aDbutton_mouse db 'dbutton_mouse',0 |
aVersion_dbutton db 'version_dbutton',0 |
aMenu_bar_draw db 'menu_bar_draw',0 |
aMenu_bar_mouse db 'menu_bar_mouse',0 |
aVersion_menu_bar db 'version_menu_bar',0 |
aMenu_bar_draw db 'menu_bar_draw',0 |
aMenu_bar_mouse db 'menu_bar_mouse',0 |
aVersion_menu_bar db 'version_menu_bar',0 |
;--------------------------------------------------------------------- |
;--------------------------------------------------------------------- |
;--------------------------------------------------------------------- |
align 4 |
scroll_bar_data_vertical: |
.x: |
132,7 → 163,7 |
.position2 dd 0 ;+72 |
.work_size dd 0 ;+76 |
.all_redraw dd 0 ;+80 |
.ar_offset dd 10 ;+84 |
.ar_offset dd 10 ;+84 |
;--------------------------------------------------------------------- |
align 4 |
scroll_bar_data_horizontal: |
166,48 → 197,48 |
.position2 dd 0 ;+72 |
.work_size dd 0 ;+76 |
.all_redraw dd 0 ;+80 |
.ar_offset dd 10 ;+84 |
.ar_offset dd 10 ;+84 |
;--------------------------------------------------------------------- |
align 4 |
menu_data_1: |
.type: dd 0 ;+0 |
.type: dd 0 ;+0 |
.x: |
.size_x dw 40 ;+4 |
.start_x dw 20 ;+6 |
.size_x dw 40 ;+4 |
.start_x dw 20 ;+6 |
.y: |
.size_y dw 15 ;+8 |
.start_y dw 25 ;+10 |
.text_pointer: dd menu_text_area ;0 ;+12 |
.pos_pointer: dd menu_text_area.1 ;0 ;+16 |
.text_end dd menu_text_area.end ;0 ;+20 |
.mouse_pos dd 0 ;+24 |
.mouse_keys dd 0 ;+28 |
.size_y dw 15 ;+8 |
.start_y dw 25 ;+10 |
.text_pointer: dd menu_text_area ;0 ;+12 |
.pos_pointer: dd menu_text_area.1 ;0 ;+16 |
.text_end dd menu_text_area.end ;0 ;+20 |
.mouse_pos dd 0 ;+24 |
.mouse_keys dd 0 ;+28 |
.x1: |
.size_x1 dw 40 ;+32 |
.start_x1 dw 20 ;+34 |
.size_x1 dw 40 ;+32 |
.start_x1 dw 20 ;+34 |
.y1: |
.size_y1 dw 100 ;+36 |
.start_y1 dw 40 ;+38 |
.size_y1 dw 100 ;+36 |
.start_y1 dw 40 ;+38 |
.bckg_col dd 0xeeeeee ;+40 |
.frnt_col dd 0xff ;+44 |
.menu_col dd 0xffffff ;+48 |
.select dd 0 ;+52 |
.out_select dd 0 ;+56 |
.buf_adress dd 0 ;+60 |
.procinfo dd 0 ;+64 |
.click dd 0 ;+68 |
.cursor dd 0 ;+72 |
.cursor_old dd 0 ;+76 |
.interval dd 16 ;+80 |
.cursor_max dd 0 ;+84 |
.buf_adress dd 0 ;+60 |
.procinfo dd 0 ;+64 |
.click dd 0 ;+68 |
.cursor dd 0 ;+72 |
.cursor_old dd 0 ;+76 |
.interval dd 16 ;+80 |
.cursor_max dd 0 ;+84 |
.extended_key dd 0 ;+88 |
.menu_sel_col dd 0x00cc00 ;+92 |
.bckg_text_col dd 0 ; +96 |
.menu_sel_col dd 0x00cc00 ;+92 |
.bckg_text_col dd 0 ; +96 |
.frnt_text_col dd 0xffffff ;+100 |
.mouse_keys_old dd 0 ;+104 |
.font_height dd 8 ;+108 |
.cursor_out dd 0 ;+112 |
.get_mouse_flag dd 0 ;+116 |
.font_height dd 8 ;+108 |
.cursor_out dd 0 ;+112 |
.get_mouse_flag dd 0 ;+116 |
;------------------------- |
menu_text_area: |
db 'File',0 |
220,44 → 251,44 |
;--------------------------------------------------------------------- |
align 4 |
menu_data_2: |
.type: dd 0 ;+0 |
.type: dd 0 ;+0 |
.x: |
.size_x dw 40 ;+4 |
.start_x dw 60 ;+6 |
.size_x dw 40 ;+4 |
.start_x dw 60 ;+6 |
.y: |
.size_y dw 15 ;+8 |
.start_y dw 25 ;+10 |
.text_pointer: dd menu_text_area_2 ;0 ;+12 |
.pos_pointer: dd menu_text_area_2.1 ;0 ;+16 |
.text_end dd menu_text_area_2.end ;0 ;+20 |
.mouse_pos dd 0 ;+24 |
.mouse_keys dd 0 ;+28 |
.size_y dw 15 ;+8 |
.start_y dw 25 ;+10 |
.text_pointer: dd menu_text_area_2 ;0 ;+12 |
.pos_pointer: dd menu_text_area_2.1 ;0 ;+16 |
.text_end dd menu_text_area_2.end ;0 ;+20 |
.mouse_pos dd 0 ;+24 |
.mouse_keys dd 0 ;+28 |
.x1: |
.size_x1 dw 50 ;+32 |
.start_x1 dw 60 ;+34 |
.size_x1 dw 50 ;+32 |
.start_x1 dw 60 ;+34 |
.y1: |
.size_y1 dw 100 ;+36 |
.start_y1 dw 40 ;+38 |
.size_y1 dw 100 ;+36 |
.start_y1 dw 40 ;+38 |
.bckg_col dd 0xeeeeee ;+40 |
.frnt_col dd 0xff ;+44 |
.menu_col dd 0xffffff ;+48 |
.select dd 0 ;+52 |
.out_select dd 0 ;+56 |
.buf_adress dd 0 ;+60 |
.procinfo dd 0 ;+64 |
.click dd 0 ;+68 |
.cursor dd 0 ;+72 |
.cursor_old dd 0 ;+76 |
.interval dd 16 ;+80 |
.cursor_max dd 0 ;+84 |
.buf_adress dd 0 ;+60 |
.procinfo dd 0 ;+64 |
.click dd 0 ;+68 |
.cursor dd 0 ;+72 |
.cursor_old dd 0 ;+76 |
.interval dd 16 ;+80 |
.cursor_max dd 0 ;+84 |
.extended_key dd 0 ;+88 |
.menu_sel_col dd 0x00cc00 ;+92 |
.bckg_text_col dd 0 ; +96 |
.menu_sel_col dd 0x00cc00 ;+92 |
.bckg_text_col dd 0 ; +96 |
.frnt_text_col dd 0xffffff ;+100 |
.mouse_keys_old dd 0 ;+104 |
.font_height dd 8 ;+108 |
.cursor_out dd 0 ;+112 |
.get_mouse_flag dd 0 ;+116 |
.font_height dd 8 ;+108 |
.cursor_out dd 0 ;+112 |
.get_mouse_flag dd 0 ;+116 |
;------------------------ |
menu_text_area_2: |
db 'Help',0 |
269,43 → 300,43 |
;--------------------------------------------------------------------- |
align 4 |
dinamic_button_data_1: |
.type dd 0 ;+0 |
.type dd 0 ;+0 |
.x: |
.size_x dw 20 ;+4 |
.start_x dw 150 ;+6 |
.size_x dw 20 ;+4 |
.start_x dw 150 ;+6 |
.y: |
.size_y dw 20 ;+8 |
.start_y dw 25 ;+10 |
.mouse_pos dd 0 ;+12 |
.mouse_keys dd 0 ;+16 |
.mouse_keys_old dd 0 ;+20 |
.active_raw dd 0 ;+24 |
.passive_raw dd 0 ;+28 |
.click_raw dd 0 ;+32 |
.resolution_raw dd 0 ;+36 |
.palette_raw dd 0 ;+40 |
.offset_raw dd 0 ;+44 |
.select dd 0 ;+48 |
.click dd 0 ;+52 |
.size_y dw 20 ;+8 |
.start_y dw 25 ;+10 |
.mouse_pos dd 0 ;+12 |
.mouse_keys dd 0 ;+16 |
.mouse_keys_old dd 0 ;+20 |
.active_raw dd 0 ;+24 |
.passive_raw dd 0 ;+28 |
.click_raw dd 0 ;+32 |
.resolution_raw dd 0 ;+36 |
.palette_raw dd 0 ;+40 |
.offset_raw dd 0 ;+44 |
.select dd 0 ;+48 |
.click dd 0 ;+52 |
;--------------------------------------------------------------------- |
align 4 |
dinamic_button_data_2: |
.type dd 0 ;+0 |
.type dd 0 ;+0 |
.x: |
.size_x dw 20 ;+4 |
.start_x dw 180 ;+6 |
.size_x dw 20 ;+4 |
.start_x dw 180 ;+6 |
.y: |
.size_y dw 20 ;+8 |
.start_y dw 25 ;+10 |
.mouse_pos dd 0 ;+12 |
.mouse_keys dd 0 ;+16 |
.mouse_keys_old dd 0 ;+20 |
.active_raw dd 0 ;+24 |
.passive_raw dd 0 ;+28 |
.click_raw dd 0 ;+32 |
.resolution_raw dd 0 ;+36 |
.palette_raw dd 0 ;+40 |
.offset_raw dd 0 ;+44 |
.select dd 0 ;+48 |
.click dd 0 ;+52 |
.size_y dw 20 ;+8 |
.start_y dw 25 ;+10 |
.mouse_pos dd 0 ;+12 |
.mouse_keys dd 0 ;+16 |
.mouse_keys_old dd 0 ;+20 |
.active_raw dd 0 ;+24 |
.passive_raw dd 0 ;+28 |
.click_raw dd 0 ;+32 |
.resolution_raw dd 0 ;+36 |
.palette_raw dd 0 ;+40 |
.offset_raw dd 0 ;+44 |
.select dd 0 ;+48 |
.click dd 0 ;+52 |
;--------------------------------------------------------------------- |
/programs/develop/libraries/box_lib/trunk/editbox_ex.asm |
---|
13,10 → 13,14 |
include 'macros.inc' |
include 'editbox_ex.mac' |
include 'load_lib.mac' |
@use_library ;use load lib macros |
start: |
;universal load library/librarys |
load_library library_name, cur_dir_path, library_path, system_path, \ |
sys_load_library library_name, cur_dir_path, library_path, system_path, \ |
err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i |
;if return code =-1 then exit, else nornary work |
cmp eax,-1 |
jz exit |
mcall 40,0x27 ;ãáâ ®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩ |
red_win: |
call draw_window ;¯¥à¢® ç «ì® ¥®¡å®¤¨¬® à¨á®¢ âì ®ª® |
94,9 → 98,16 |
ret |
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
;DATA ¤ ë¥ |
system_path db '/sys/lib/box_lib.obj',0 |
;ᥣ¤ ᮡ«î¤ âì ¯®á«¥¤®¢ ⥫ì®áâì ¢ ¨¬¥¨. |
system_path db '/sys/lib/' |
library_name db 'box_lib.obj',0 |
err_message_found_lib db 'Sorry I cannot found library box_lib.obj',0 |
; ᫨ ¥áâì ¦¥« ¨¥ à §ê¥¤¨¨âì, ⮠㦮 ¨á¯®«ì§®¢ âì á«¥¤ãîé¨î ª®áâàãªæ¨î |
;system_path db '/sys/lib/box_lib.obj',0 |
;... «î¡ ï ¯®á«¥¤®¢ ⥫ì®áâì ¤àã£¨å ª®¬ ¤ ¨ ®¯à¥¤¥«¥¨©. |
;library_name db 'box_lib.obj',0 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
err_message_found_lib db 'Sorry I cannot load library box_lib.obj',0 |
head_f_i: |
head_f_l db 'System error',0 |
err_message_import db 'Error on load import library box_lib.obj',0 |
152,7 → 163,7 |
option_group2 dd op12 ;¯à¨«®¦¥¨¥ |
Option_boxs dd op1,op2,op3,0 |
Option_boxs2 dd op11,op12,op13,0 |
hed db 'BOXs load from lib <Lrz> date 27.09.2007',0 |
hed db 'BOXs load from lib <Lrz> date 27.04.2009',0 |
hed_end: |
rb 256 |
check_text db 'First checkbox' |
166,6 → 177,8 |
.e3: |
ed_buffer rb 100 |
;----------------------- |
;sc system_colors |
p_info process_information |
cur_dir_path rb 4096 |
library_path rb 4096 |
i_end: |
/programs/develop/libraries/box_lib/trunk/editbox_ex.mac |
---|
75,3 → 75,4 |
.ch_text_length: dd op_text_length ;¤«¨ áâப¨ á ᨬ¢®« ¬¨ |
.flags: dd flags+0 ; ä« £¨ |
} |
/programs/develop/libraries/box_lib/trunk/load_lib.mac |
---|
1,3 → 1,4 |
;08.05.2009 - bugfix |
;14.04.2009 - a macros for code load library the box_lib.obj from '/sys/lib/' or current dirrectory. |
; The macros for load any library/libraries: |
; Copyright (c) 2009, <Lrz> |
38,21 → 39,235 |
; If we cannot load library, we must show the error message: |
; "I'm sorry,the programm cannot found system library box_lib.obj." |
; "The find was make on 2 ways: /sys/lib/ and current dirrectory." |
; |
; |
; ebx,library_name |
; esi,cur_dir_path |
; edi,library_path |
;--------------------------------------------------------------------- |
; Macro test_load_library |
; Macro sys_load_library |
; A first time we must to check own path in current dirrectory the program, where I belive find a system library. |
; If I cannot found my library, i must to check second way. Second way is system path a "/sys/lib/". |
; If we cannot load library, we must show the error message: |
; "I'm sorry,the programm cannot found system library box_lib.obj." |
; "The find was make on 2 ways: /sys/lib/ and current dirrectory." |
; |
;--------------------------------------------------------------------- |
; How can I use it? |
;--------------------------------------------------------------------- |
;-Example using single load library |
;-universal load library/librarys |
;load_library library_name, cur_dir_path, library_path, system_path, \ |
;err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i |
;-if return code =-1 then exit, else normally work |
; cmp eax,-1 |
; jz exit |
;- Well, if you get |
; |
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
;DATA äàííûå |
;Âñåãäà ñîáëþäàòü ïîñëåäîâàòåëüíîñòü â èìåíè. |
;system_path db '/sys/lib/' |
;library_name db 'box_lib.obj',0 |
; Åñëè åñòü æåëàíèå ðàçúåäèíèòü, òî íóæíî èñïîëüçîâàòü ñëåäóþùèþ êîíñòðóêöèþ |
;system_path db '/sys/lib/box_lib.obj',0 |
;... ëþáàÿ ïîñëåäîâàòåëüíîñòü äðóãèõ êîìàíä è îïðåäåëåíèé. |
;library_name db 'box_lib.obj',0 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
macro load_library library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i |
;err_message_found_lib db 'Sorry I cannot found library box_lib.obj',0 |
;head_f_i: |
;head_f_l db 'System error',0 |
;err_message_import db 'Error on load import library box_lib.obj',0 |
;myimport: |
; |
;edit_box_draw dd aEdit_box_draw |
;edit_box_key dd aEdit_box_key |
;edit_box_mouse dd aEdit_box_mouse |
;version_ed dd aVersion_ed |
; |
;check_box_draw dd aCheck_box_draw |
;check_box_mouse dd aCheck_box_mouse |
;version_ch dd aVersion_ch |
; |
;option_box_draw dd aOption_box_draw |
;option_box_mouse dd aOption_box_mouse |
;version_op dd aVersion_op |
; dd 0 |
; dd 0 |
; |
;aEdit_box_draw db 'edit_box',0 |
;aEdit_box_key db 'edit_box_key',0 |
;aEdit_box_mouse db 'edit_box_mouse',0 |
;aVersion_ed db 'version_ed',0 |
;aCheck_box_draw db 'check_box_draw',0 |
;aCheck_box_mouse db 'check_box_mouse',0 |
;aVersion_ch db 'version_ch',0 |
;aOption_box_draw db 'option_box_draw',0 |
;aOption_box_mouse db 'option_box_mouse',0 |
;aVersion_op db 'version_op',0 |
;--------------------------------------------------------------------- |
macro @use_library |
{ |
show_err_: |
local red_win |
local still |
local button |
local __sc |
local start |
local ex_lp |
local lp |
local correction |
;/equ |
err_message1 equ dword [esp+8] |
head1 equ dword [esp+4] |
__sc.frame equ dword [__sc+0] |
__sc.grab equ dword [__sc+4] |
__sc.grab_button equ dword [__sc+8] |
__sc.grab_button_text equ dword [__sc+12] |
__sc.grab_text equ dword [__sc+16] |
__sc.work equ dword [__sc+20] |
__sc.work_button equ dword [__sc+24] |
__sc.work_button_text equ dword [__sc+28] |
__sc.work_text equ dword [__sc+32] |
__sc.work_graph equ dword [__sc+36] |
;local on_x |
;local on_y |
;;;;;;;;;;;CALC WIDTH & HIGHT WINDOW & CENTER MONITOR POSITION;;;;;;;;;; |
mov eax,48 ;get system color |
mov ebx,3 |
mov ecx,__sc |
mov edx,sizeof.system_colors |
mcall |
;--------------------------------------------------------------------- |
;get with text imul on 6 pix |
xor eax,eax |
mov esi,err_message1 |
mov ecx,30 |
align 4 |
lp: lodsb |
test eax,eax |
jz ex_lp |
add ecx,7 |
jmp lp |
;--------------------------------------------------------------------- |
ex_lp: |
mcall 48,5 ;get system window |
sub eax,ecx |
sub bx,90 |
shl eax,15 |
shl ebx,15 |
mov ax,cx |
mov bx,90 |
mov dword [on_x],eax |
mov dword [on_y],ebx |
; mov eax,dword [esp+4] |
; mov dword [header_xx],eax |
; mov eax,dword [esp+8] |
; mov dword [message_xx],eax |
jmp start |
__sc system_colors |
on_x dd ? |
on_y dd ? |
message_xx dd ? |
header_xx dd ? |
;;;;;;;;;;;DRAW WINDOW;;;;;;;;;;;;;; |
start: |
mcall 40,0x5 ;set mask on events rewraw window and get id button. |
red_win: |
;draw_window: |
mcall 12,1 |
xor eax,eax |
mov ebx,dword [on_x] |
mov ecx,dword [on_y] |
mov edx,__sc.work |
or edx,0x33000000 |
mov esi,__sc.grab_text |
mov edi,head1 |
mcall |
mov eax,4 |
mov ebx,(10*65536+25) |
mov ecx,__sc.grab_text |
or ecx,0x90000000 |
mov edx,err_message1 |
mcall |
mcall 12,2 |
align 4 |
still: ;main loop |
mcall 10 ;wait event |
dec eax |
jz red_win |
sub eax,2 |
jnz still ;go to main loop |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
button: |
mcall 17 ;get id button |
test ah,ah ;if in ah 0, then go to still |
jz still |
or dword [esp+40],-1; modify eax in stack (pushad) |
ret |
;--------------------------------------------------------------------- |
@library_name equ dword [esp+12] |
@cur_dir_path equ dword [esp+8] |
@library_path equ dword [esp+4] |
align 4 |
@copy_path: |
mov ebx,@library_name |
mov esi,@cur_dir_path |
mov edi,@library_path |
xor eax,eax |
cld |
.lp1: |
lodsb |
stosb |
test eax,eax |
jnz .lp1 |
mov esi,edi |
std |
.lp2: |
lodsb |
cmp al,'/' |
jnz .lp2 |
mov edi,esi |
mov esi,ebx |
add edi,2 |
cld |
.lp3: |
lodsb |
stosb |
test eax,eax |
jnz .lp3 |
;--------------------------------------------------------------------- |
ret |
} |
macro sys_load_library library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i |
{ |
local end_steep |
local exit |
;--------------------------------------------------------------------- |
; loading Box_Lib library |
60,35 → 275,32 |
test eax,eax |
jnz end_steep |
mov ebx,library_name |
mov esi,cur_dir_path |
mov edi,library_path |
copy_path ;the macros making way /current pach a program/+ name system library |
copy_path library_name, cur_dir_path, library_path ;the macros making way /current pach a program/+ name system library |
mcall 68,19,library_path ; load of alternative |
test eax,eax |
jnz end_steep |
show_error_window err_message_found_lib, head_f_l ;show error message /create window |
jmp exit |
align 4 |
end_steep: |
import_boxlib myimport, err_message_import, head_f_i ;import |
exit: |
;--------------------------------------------------------------------- |
} |
macro test_load_library library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i |
macro load_library library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i |
{ |
local end_steep |
local exit |
;--------------------------------------------------------------------- |
; loading Box_Lib library |
mov ebx,library_name |
mov esi,cur_dir_path |
mov edi,library_path |
copy_path ;the macros making way /current pach a program/+ name system library |
copy_path library_name, cur_dir_path, library_path ;the macros making way /current pach a program/+ name system library |
mcall 68,19,library_path ; load of alternative |
test eax,eax |
99,110 → 311,156 |
jnz end_steep |
show_error_window err_message_found_lib, head_f_l ;show error message /create window |
jmp exit |
align 4 |
end_steep: |
import_boxlib myimport, err_message_import, head_f_i ;import |
exit: |
;--------------------------------------------------------------------- |
} |
macro load_libraries library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i |
macro sys_load_libraries _start,_end |
{ |
local lp |
local end_steep |
;--------------------------------------------------------------------- |
; loading Box_Lib library |
local next |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
library_name equ [ebp] |
cur_dir_path equ [ebp+4] |
library_path equ [ebp+8] |
system_path equ [ebp+12] |
err_message_found_lib equ [ebp+16] |
head_f_l equ [ebp+20] |
my_import equ [ebp+24] |
err_message_import equ [ebp+28] |
head_f_i equ [ebp+32] |
adr_load_lib equ dword [ebp+36] |
status_lib equ dword [ebp+40] |
; show_error_window err_message_found_lib, head_f_l ;show error message /create window |
; int 0x40 |
mov ebp,_start |
mov ecx,((_end-_start)/ll_struc_size) |
align 4 |
lp: push ecx |
mcall 68,19,system_path ; load of sys directory |
test eax,eax |
jnz end_steep |
mov ebx,library_name |
mov esi,cur_dir_path |
mov edi,library_path |
copy_path ;the macros making way /current pach a program/+ name system library |
copy_path library_name, cur_dir_path, library_path ;the macros making way /current pach a program/+ name system library |
mcall 68,19,library_path ; load of alternative |
test eax,eax |
jnz end_steep |
or status_lib,0x1 ; status of code - enable error - not found library |
show_error_window err_message_found_lib, head_f_l ;show error message /create window |
jmp next |
align 4 |
end_steep: |
mov adr_load_lib,eax ;save adr lib in memory |
import_boxlib my_import, err_message_import, head_f_i ;import |
import_boxlib myimport, err_message_import, head_f_i ;import |
;--------------------------------------------------------------------- |
test eax,eax |
jz next |
or status_lib,0x2 ; status of code - enable error - import error |
next: |
pop ecx |
add ebp,ll_struc_size |
dec ecx |
jnz lp |
} |
macro load_libraries _start,_end |
{ |
local lp |
local end_steep |
local next |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
library_name equ [ebp] |
cur_dir_path equ [ebp+4] |
library_path equ [ebp+8] |
system_path equ [ebp+12] |
err_message_found_lib equ [ebp+16] |
head_f_l equ [ebp+20] |
my_import equ [ebp+24] |
err_message_import equ [ebp+28] |
head_f_i equ [ebp+32] |
adr_load_lib equ dword [ebp+36] |
status_lib equ dword [ebp+40] |
mov ebp,_start |
mov ecx,((_end-_start)/ll_struc_size) |
align 4 |
lp: push ecx |
macro copy_path |
{ |
local copy_path |
;--------------------------------------------------------------------- |
; mov ebx,library_name |
; mov esi,cur_dir_path |
; mov edi,library_path |
copy_path library_name, cur_dir_path, library_path ;the macros making way /current pach a program/+ name system library |
copy_path: |
xor eax,eax |
cld |
.lp1: |
lodsb |
stosb |
mcall 68,19,library_path ; load of alternative |
test eax,eax |
jnz .lp1 |
mov esi,edi |
jnz end_steep |
mcall 68,19,system_path ; load of sys directory |
test eax,eax |
jnz end_steep |
std |
.lp2: |
lodsb |
cmp al,'/' |
jnz .lp2 |
mov edi,esi |
mov esi,ebx |
add edi,2 |
or status_lib,0x1 ; status of code - enable error - not found library |
show_error_window err_message_found_lib, head_f_l ;show error message /create window |
jmp next |
cld |
.lp3: |
lodsb |
stosb |
align 4 |
end_steep: |
mov adr_load_lib,eax ;save adr lib in memory |
import_boxlib my_import, err_message_import, head_f_i ;import |
test eax,eax |
jnz .lp3 |
;--------------------------------------------------------------------- |
jz next |
or status_lib,0x2 ; status of code - enable error - import error |
next: |
pop ecx |
add ebp,ll_struc_size |
dec ecx |
jnz lp |
} |
macro show_error_window err_message, head |
macro copy_path lib_name,dir_path,lib_path |
{ |
local red_win |
local still |
local button |
pushad ;save all registers |
push dword lib_name |
push dword dir_path |
push dword lib_path |
mcall 40,0x5 ;set mask on events rewraw window and get id button. |
red_win: |
;draw_window: |
mcall 12, 1 |
mcall 0, <0,300>, <0,100>, 0x33AABBCC, 0x805080D0, head |
mcall 4, <10,10>, 0x90000000, err_message; _found_lib |
mcall 12, 2 |
align 4 |
still: ;main loop |
mcall 10 ;wait event |
dec eax |
jz red_win |
sub eax,2 |
jnz still ;go to main loop |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
button: |
mcall 17 ;get id button |
test ah,ah ;if in ah 0, then go to still |
jz still |
mcall -1 |
call @copy_path |
add esp,12 |
popad ;restore all registers |
} |
macro show_error_window err_message, head |
{ pushad ;save all registers |
push dword err_message |
push dword head |
call show_err_ |
add esp,8 |
popad ;restore all registers |
} |
macro import_boxlib myimport, err_message_import, head_f_i |
{ |
local import_loop |
212,7 → 470,10 |
local import_found |
local import_done |
local exit |
local e.exit |
local import_not_found |
; initialize import |
mov edx, eax |
mov esi,myimport |
import_loop: |
223,7 → 484,7 |
import_find: |
mov ebx, [ds:edx] |
test ebx, ebx |
jz exit ;import_not_found |
jz import_not_found |
push eax |
lp: |
mov cl, [ds:eax] |
244,11 → 505,29 |
mov [esi-4], eax |
pop edx |
jmp import_loop |
exit: |
import_not_found: |
add esp,4 |
show_error_window err_message_import, head_f_i ;show error message /create window |
jmp e.exit |
import_done: |
xor eax,eax |
e.exit: |
;--------------------------------------------------------------------- |
} |
} |
ll_struc_size = 44;($-library_name) ; constant size of struct |
struc l_libs library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, my_import, err_message_import, head_f_i; struct for loading libraries |
{ |
.library_name dd library_name |
.cur_dir_path dd cur_dir_path |
.library_path dd library_path |
.system_path dd system_path |
.err_message_found_lib dd err_message_found_lib |
.head_f_l dd head_f_l |
.my_import dd my_import |
.err_message_import dd err_message_import |
.head_f_i dd head_f_i |
.adr_load_lib dd 0x0 |
.status_lib dd 0x0 ;status of load library |
; |
} |
/programs/develop/libraries/box_lib/trunk/readme.txt |
---|
10,6 → 10,7 |
Íà äàííûé ìîìåíò, íîñèò ýêñïåðåìåíòàëüíûé, òåñòîâûé õàðàêòåð. |
Áèáëèîòåêó box_lib.obj íóæíî ïîìåñòèòü â ïàïêó ñ âûïîëíÿþùåéñÿ ïðîãðàììîé editbox_ex, èëè ïî àäðåñó /sys/lib/? íî òîãäà íóæíî ïîäìåíèòü ïóòü â ôàéëå ini_file íà ïóòü ê áèáëèîòåêå |
. Ïðèìåð ñàì âû÷èñëÿåò ïóòü ê áèáëèîòåêå, íå çàâèñèìî îò ñâîåãî ìåñòîðàñïîëîæåíèÿ |
08.05.2009 - ïîôèêñåíû áàãè îáùåå óëó÷øåíèå êîäà |
15.04.2009 - äîáàâëåí ìàêðîñ load_lib.mac - óíèâåðñàëüíûé äëÿ çàãðóçêè ëþáîé áèáëèîòåêè/áèáëèîòåê. |
13.09.2009 - îáðàáîòêà êëàâèøü NUM, Caps,Scroll Lock. Ïðè íàæàòèè íà íèõ, íå ïðîèñõîäèò îòîáðàæåíèå ñèìâîëà. |
24.09.2007 - ñäåëàë ïîääðåæêó checkbox. Äîáàâèë îøèáêè, ïðîãðàììà ãëþ÷èò î÷åíü ñåðüåçíî :( |
/programs/develop/libraries/box_lib/trunk/run.bat |
---|
1,6 → 1,6 |
@fasm.exe -m 16384 box_lib.asm |
@fasm.exe -m 16384 editbox_ex.asm editbox_ex.kex |
@fasm.exe -m 16834 editbox_ex.asm editbox_ex.kex |
@fasm.exe -m 16384 ctrldemo.asm ctrldemo.kex |
REM ..\FASM\kpack.exe editbox_ex |
rem @klbrinwin.exe editbox_ex.kex |
REM @klbrinwin.exe editbox_ex.kex |
pause |