/programs/develop/libraries/box_lib/asm/trunk/build.bat |
---|
0,0 → 1,11 |
REM compiling examples |
if not exist bin mkdir bin |
@fasm.exe -m 16384 ctrldemo.asm bin\ctrldemo.kex |
@kpack bin\ctrldemo.kex |
@copy cnv_bmp.obj bin\cnv_bmp.obj |
@copy reload_16x16_8b.bmp bin\reload_16x16_8b.bmp |
@fasm.exe -m 16384 editbox_ex.asm bin\editbox_ex.kex |
@kpack bin\editbox_ex.kex |
pause |
/programs/develop/libraries/box_lib/asm/trunk/cnv_bmp.obj |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/develop/libraries/box_lib/asm/trunk/ctrldemo.asm |
---|
0,0 → 1,383 |
; |
; Example for Box_lib: scrollbar, menubar, dinamic_button |
; Copyright (c) 2009, Mario79 |
; All rights reserved. |
; |
; 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. |
; |
; THIS SOFTWARE IS PROVIDED BY Mario79 ''AS IS'' AND ANY |
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY |
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
;***************************************************************************** |
; import_boxlib procedure written by <Lrz> |
;--------------------------------------------------------------------- |
use32 |
org 0x0 |
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: |
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 |
;--------------------------------------------------------------------- |
; loading Box_Lib library |
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 |
;----------------------------------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 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 ebx,icons_file_name |
; mov esi,path |
; mov edi,file_name |
copy_path icons_file_name,path,file_name |
mcall 70, fileinfo |
mov [fileinfo+0],dword 0 |
mov ecx,[file_info+32] |
mov [fileinfo+12],ecx |
mov [img_size],ecx |
mcall 68, 12 |
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 |
;--------------------------------------------------------------------- |
red: |
call draw_window |
still: |
mcall 10 |
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 |
;--------------------------------------------------------------------- |
button: |
mcall 17 |
cmp ah, 1 |
jne still |
.exit: |
mcall -1 |
;--------------------------------------------------------------------- |
mouse: |
;----------------------------------------------- |
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 |
@@: |
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 |
.draw_cube: |
call draw_cube |
jmp still |
.other: |
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 |
@@: |
; mouse event for Menu 1 |
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 |
;-------------------------------------------- |
.menu_bar_2: |
; mouse event for Menu 2 |
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 |
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 |
cmp [eax],dword 1 |
jne @f |
mov [eax],dword 0 |
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 |
cmp [eax],dword 1 |
jne still ;@f |
mov [eax],dword 0 |
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 |
;--------------------------------------------------------------------- |
analyse_out_menu_1: |
; analyse result of Menu 1 |
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 |
;--------------------------------------------------------------------- |
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 |
;--------------------------------------------- |
; draw for Menu 1 |
push dword menu_data_1 |
call [menu_bar_draw] |
; draw for Menu 2 |
push dword menu_data_2 |
call [menu_bar_draw] |
;--------------------------------------------- |
; draw for Dinamic Button 1 |
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] |
;--------------------------------------------- |
; 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 |
; draw for Vertical ScrollBar |
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 |
;--------------------------------------------- |
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 |
include 'data.inc' |
include 'w_about.inc' |
IM_END: |
rb 1024 |
thread: |
rb 1024 |
stacktop: |
path: |
rb 4096 |
file_name: |
rb 4096 |
file_info: |
rb 40 |
I_END: |
/programs/develop/libraries/box_lib/asm/trunk/d_button.mac |
---|
0,0 → 1,170 |
;************************************************************** |
; Dinamic Button Macro for Kolibri OS |
; Copyright (c) 2009, Mario79 |
; All rights reserved. |
; |
; 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. |
; |
; THIS SOFTWARE IS PROVIDED BY Mario79 ''AS IS'' AND ANY |
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY |
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
;***************************************************************************** |
macro dinamic_button_exit |
{ |
popa |
ret 4 |
} |
;***************************************************************************** |
macro use_dinamic_button |
{ |
dinamic_button: |
db_type equ [edi] |
db_size_x equ [edi+4] |
db_start_x equ [edi+6] |
db_size_y equ [edi+8] |
db_start_y equ [edi+10] |
db_mouse_pos equ [edi+12] |
db_mouse_keys equ [edi+16] |
db_mouse_keys_old equ [edi+20] |
db_active_raw equ [edi+24] |
db_passive_raw equ [edi+28] |
db_click_raw equ [edi+32] |
db_resolution_raw equ [edi+36] |
db_palette_raw equ [edi+40] |
db_offset_raw equ [edi+44] |
db_select equ [edi+48] |
db_click equ [edi+52] |
;***************************************************************************** |
;***************************************************************************** |
; draw event |
;***************************************************************************** |
;***************************************************************************** |
.draw: |
pusha |
mov edi,dword [esp+36] |
call .draw_1 |
dinamic_button_exit |
.draw_1: |
cmp db_select,dword 1 |
je .active_1 |
cmp db_select,dword 2 |
je .click_2 |
mov ebx,db_passive_raw |
jmp .draw_2 ;@f |
.active_1: |
mov ebx,db_active_raw |
jmp .draw_2 ;@f |
.click_2: |
mov ebx,db_click_raw |
@@: |
.draw_2: |
mov cx,db_size_x |
shl ecx,16 |
mov cx,db_size_y |
mov dx,db_start_x |
shl edx,16 |
mov dx,db_start_y |
mov esi,db_resolution_raw |
mov ebp,db_offset_raw |
push edi |
mov edi,db_palette_raw |
mcall 65 |
pop edi |
ret |
;***************************************************************************** |
;***************************************************************************** |
; mouse event |
;***************************************************************************** |
;***************************************************************************** |
.mouse: |
pusha |
mov edi,dword [esp+36] |
mcall 37,2 |
mov ebx,db_mouse_keys |
mov db_mouse_keys_old,ebx |
mov db_mouse_keys,eax |
mcall 37,1 |
mov db_mouse_pos,eax |
test eax,0x80000000 |
jnz .exit_menu |
test eax,0x8000 |
jnz .exit_menu |
mov ebx,eax |
shr ebx,16 ; x position |
shl eax,16 |
shr eax,16 ; y position |
mov cx,db_start_x |
cmp bx,cx |
jb .exit_menu |
add cx,db_size_x |
cmp bx,cx |
ja .exit_menu |
mov cx,db_start_y |
cmp ax,cx |
jb .exit_menu |
add cx,db_size_y |
cmp ax,cx |
ja .exit_menu |
test db_mouse_keys,dword 1b |
jnz @f |
cmp db_select,dword 1 |
je .exit_menu_1 |
mov db_select,dword 1 |
call .draw_1 |
jmp .exit_menu_1 |
@@: |
mov eax,db_mouse_keys |
cmp eax,db_mouse_keys_old |
je .exit_menu_1 |
mov db_select,dword 2 |
call .draw_1 |
mcall 5, 25 |
mov db_select,dword 1 |
call .draw_1 |
mov db_click,dword 1 |
jmp .exit_menu_2 |
.exit_menu: |
cmp db_select,dword 0 |
je .exit_menu_1 |
mov db_select,dword 0 |
call .draw_1 |
.exit_menu_1: |
; mov db_click,dword 0 |
.exit_menu_2: |
dinamic_button_exit |
} |
/programs/develop/libraries/box_lib/asm/trunk/data.inc |
---|
0,0 → 1,342 |
;--------------------------------------------------------------------- |
;--- ÄÀÍÍÛÅ ÏÐÎÃÐÀÌÌÛ ---------------------------------------------- |
;--------------------------------------------------------------------- |
@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 |
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 |
dd 0 |
dd 0 |
dd 0 |
dd file_info |
string: |
db 0 |
dd file_name |
plugin dd 0 |
;--------------------------------------------------------------------- |
; not change this section!!! |
; start section |
;--------------------------------------------------------------------- |
image_file dd 0 |
raw_pointer dd 0 |
return_code dd 0 |
img_size dd 0 |
deflate_unpack dd 0 |
;--------------------------------------------------------------------- |
; end section |
;--------------------------------------------------------------------- |
;--------------------------------------------------------------------- |
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 |
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 |
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 |
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 |
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 |
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 |
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: |
.size_x dw 15 ;+0 |
.start_x dw 370 ;+2 |
.y: |
.size_y dw 300 ;+4 |
.start_y dw 50 ;+6 |
.btn_high dd 15 ;+8 |
.type dd 1 ;+12 |
.max_area dd 300 ;+16 |
.cur_area dd 30 ;+20 |
.position dd 140 ;+24 |
.bckg_col dd 0xeeeeee ;+28 |
.frnt_col dd 0xbbddff ;+32 |
.line_col dd 0 ;+36 |
.redraw dd 0 ;+40 |
.delta dw 0 ;+44 |
.delta2 dw 0 ;+46 |
.run_x: |
.r_size_x dw 0 ;+48 |
.r_start_x dw 0 ;+50 |
.run_y: |
.r_size_y dw 0 ;+52 |
.r_start_y dw 0 ;+54 |
.m_pos dd 0 ;+56 |
.m_pos_2 dd 0 ;+60 |
.m_keys dd 0 ;+64 |
.run_size dd 0 ;+68 |
.position2 dd 0 ;+72 |
.work_size dd 0 ;+76 |
.all_redraw dd 0 ;+80 |
.ar_offset dd 10 ;+84 |
;--------------------------------------------------------------------- |
align 4 |
scroll_bar_data_horizontal: |
.x: |
.size_x dw 300 ;0 ;+0 |
.start_x dw 30 ;0 ;+2 |
.y: |
.size_y dw 15 ;0 ;+4 |
.start_y dw 370 ;0 ;+6 |
.btn_high dd 15 ;+8 |
.type dd 1 ;+12 |
.max_area dd 300 ;+16 |
.cur_area dd 30 ;+20 |
.position dd 140 ;+24 |
.bckg_col dd 0xeeeeee ;+28 |
.frnt_col dd 0xbbddff ;+32 |
.line_col dd 0 ;+36 |
.redraw dd 0 ;+40 |
.delta dw 0 ;+44 |
.delta2 dw 0 ;+46 |
.run_x: |
.r_size_x dw 0 ;+48 |
.r_start_x dw 0 ;+50 |
.run_y: |
.r_size_y dw 0 ;+52 |
.r_start_y dw 0 ;+54 |
.m_pos dd 0 ;+56 |
.m_pos_2 dd 0 ;+60 |
.m_keys dd 0 ;+64 |
.run_size dd 0 ;+68 |
.position2 dd 0 ;+72 |
.work_size dd 0 ;+76 |
.all_redraw dd 0 ;+80 |
.ar_offset dd 10 ;+84 |
;--------------------------------------------------------------------- |
align 4 |
menu_data_1: |
.type: dd 0 ;+0 |
.x: |
.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 |
.x1: |
.size_x1 dw 40 ;+32 |
.start_x1 dw 20 ;+34 |
.y1: |
.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 |
.extended_key dd 0 ;+88 |
.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 |
;------------------------- |
menu_text_area: |
db 'File',0 |
.1: |
db 'Test1',0 |
db 'Test2',0 |
db 'Exit',0 |
.end: |
db 0 |
;--------------------------------------------------------------------- |
align 4 |
menu_data_2: |
.type: dd 0 ;+0 |
.x: |
.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 |
.x1: |
.size_x1 dw 50 ;+32 |
.start_x1 dw 60 ;+34 |
.y1: |
.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 |
.extended_key dd 0 ;+88 |
.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 |
;------------------------ |
menu_text_area_2: |
db 'Help',0 |
.1: |
db 'Test1',0 |
db 'About',0 |
.end: |
db 0 |
;--------------------------------------------------------------------- |
align 4 |
dinamic_button_data_1: |
.type dd 0 ;+0 |
.x: |
.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 |
;--------------------------------------------------------------------- |
align 4 |
dinamic_button_data_2: |
.type dd 0 ;+0 |
.x: |
.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 |
;--------------------------------------------------------------------- |
/programs/develop/libraries/box_lib/asm/trunk/editbox_ex.asm |
---|
0,0 → 1,188 |
;§ £®«®¢®ª ¯à¨«®¦¥¨ï |
use32 ; âà á«ïâ®à, ¨á¯®«ì§ãî騩 32 à §àï¤ëå ª®¬ ¤ë |
org 0x0 ; ¡ §®¢ë© ¤à¥á ª®¤ , ¢á¥£¤ 0x0 |
db 'MENUET01' ; ¨¤¥â¨ä¨ª â®à ¨á¯®«ï¥¬®£® ä ©« (8 ¡ ©â) |
dd 0x1 ; ¢¥àá¨ï ä®à¬ â § £®«®¢ª ¨á¯®«ï¥¬®£® ä ©« |
dd start ; ¤à¥á, ª®â®àë© á¨á⥬ ¯¥à¥¤ ñâ ã¯à ¢«¥¨¥ |
; ¯®á«¥ § £à㧪¨ ¯à¨«®¦¥¨ï ¢ ¯ ¬ïâì |
dd i_end ; à §¬¥à ¯à¨«®¦¥¨ï |
dd mem ; ¡ê¥¬ ¨á¯®«ì§ã¥¬®© ¯ ¬ïâ¨, ¤«ï á⥪ ®â¢¥¤¥¬ 0å100 ¡ ©â ¨ ¢ë஢¨¬ £à¨æã 4 ¡ ©â |
dd mem ; à ᯮ«®¦¨¬ ¯®§¨æ¨î á⥪ ¢ ®¡« á⨠¯ ¬ïâ¨, áà §ã § ⥫®¬ ¯à®£à ¬¬ë. ¥àè¨ á⥪ ¢ ¤¨ ¯ §®¥ ¯ ¬ïâ¨, 㪠§ ®¬ ¢ëè¥ |
dd 0x0 ; 㪠§ ⥫ì áâபã á ¯ à ¬¥âà ¬¨. |
dd cur_dir_path |
include '../../../../../macros.inc' |
include 'editbox_ex.mac' |
include 'load_lib.mac' |
@use_library ;use load lib macros |
start: |
;universal load library/librarys |
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 ;¯¥à¢® ç «ì® ¥®¡å®¤¨¬® à¨á®¢ âì ®ª® |
align 4 |
still: ;®á®¢®© ®¡à ¡®â稪 |
mcall 10 ;¦¨¤ âì ᮡëâ¨ï |
dec eax |
jz red_win |
dec eax |
jz key |
dec eax |
jz button |
push dword edit1 |
call [edit_box_mouse] |
push dword edit2 |
call [edit_box_mouse] |
push dword check1 |
call [check_box_mouse] |
push dword check2 |
call [check_box_mouse] |
push dword Option_boxs |
call [option_box_mouse] |
push dword Option_boxs2 |
call [option_box_mouse] |
jmp still ;¥á«¨ ¨ç¥£® ¨§ ¯¥à¥ç¨á«¥®£® ⮠ᮢ ¢ 横« |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
button: |
mcall 17 ;¯®«ãç¨âì ¨¤¥â¨ä¨ª â®à ¦ ⮩ ª« ¢¨è¨ |
test ah,ah ;¥á«¨ ¢ ah 0, â® ¯¥à¥©â¨ ®¡à ¡®â稪 ᮡë⨩ still |
jz still |
exit: mcall -1 |
key: |
mcall 2 ;§ £à㧨¬ § 票¥ 2 ¢ ॣ¨áâ®à eax ¨ ¯®«ã稬 ª®¤ ¦ ⮩ ª« ¢¨è¨ |
push dword edit1 |
call [edit_box_key] |
push dword edit2 |
call [edit_box_key] |
jmp still |
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
align 4 |
draw_window: ;à¨á®¢ ¨¥ ®ª ¯à¨«®¦¥¨ï |
mcall 12,1 |
mcall 0,(50*65536+390),(30*65536+200),0x33AABBCC,0x805080DD,hed |
push dword edit1 |
call [edit_box_draw] |
push dword edit2 |
call [edit_box_draw] |
push dword check1 |
call [check_box_draw] |
push dword check2 |
call [check_box_draw] |
push dword Option_boxs |
call [option_box_draw] |
push dword Option_boxs2 |
call [option_box_draw] |
mcall 12,2 |
ret |
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
;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 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
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 |
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 |
check1 check_box 10,45,6,12,0x80AABBCC,0,0,check_text,14,ch_flag_en |
check2 check_box 10,60,6,12,0x80AABBCC,0,0,check_text2,15 |
edit1 edit_box 350,3,5,0xffffff,0x6f9480,0,0xAABBCC,0,308,hed,ed_focus,hed_end-hed-1,hed_end-hed-1 |
edit2 edit_box 350,3,25,0xffffff,0x6a9480,0,0,0,99,ed_buffer,ed_figure_only |
op1 option_box option_group1,10,90,6,12,0xffffff,0,0,op_text.1,op_text.e1-op_text.1 |
op2 option_box option_group1,10,105,6,12,0xFFFFFF,0,0,op_text.2,op_text.e2-op_text.2 |
op3 option_box option_group1,10,120,6,12,0xffffff,0,0,op_text.3,op_text.e3-op_text.3 |
op11 option_box option_group2,120,90,6,12,0xffffff,0,0,op_text.1,op_text.e1-op_text.1 |
op12 option_box option_group2,120,105,6,12,0xffffff,0,0,op_text.2,op_text.e2-op_text.2 |
op13 option_box option_group2,120,120,6,12,0xffffff,0,0,op_text.3,op_text.e3-op_text.3 |
option_group1 dd op1 ;㪠§ ⥫¨, ®¨ ®â®¡à ¦ îâáï ¯® 㬮«ç ¨î, ª®£¤ ¢ë¢®¤¨âáï |
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.04.2009',0 |
hed_end: |
rb 256 |
check_text db 'First checkbox' |
check_text2 db 'Second checkbox' |
op_text: ; ®¯à®¢®¦¤ î騩 ⥪áâ ¤«ï 祪 ¡®ªá®¢ |
.1 db 'Option_Box #1' |
.e1: |
.2 db 'Option_Box #2' |
.e2: |
.3 db 'Option_Box #3' |
.e3: |
ed_buffer rb 100 |
;----------------------- |
;sc system_colors |
p_info process_information |
cur_dir_path rb 4096 |
library_path rb 4096 |
i_end: |
rb 1024 |
mem: |
/programs/develop/libraries/box_lib/asm/trunk/editbox_ex.mac |
---|
0,0 → 1,78 |
ed_struc_size=72 |
struc edit_box width,left,top,color,shift_color,focus_border_color,\ |
blur_border_color,text_color,max,text,flags,size,pos |
{ |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;Bit mask from editbox |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
ed_figure_only= 1000000000000000b ;®¤¨ ᨬ¢®«ë |
ed_always_focus= 100000000000000b |
ed_focus= 10b ;䮪ãá ¯à¨«®¦¥¨ï |
ed_shift_on= 1000b ;¥á«¨ ¥ ãáâ ®¢«¥ -§ ç¨â ¢¯¥à¢ë¥ ¦ â shift,¥á«¨ ¡ë« ãáâ ®¢«¥, § ç¨â ¬ë 㦥 çâ® - â® ¤¥« «¨ 㤥ন¢ ï shift |
ed_shift_on_off=1111111111110111b |
ed_shift= 100b ;¢ª«îç ¥âáï ¯à¨ ¦ ⨨ shift â.¥. ¥á«¨ ¦¨¬ î |
ed_shift_off= 1111111111111011b |
ed_shift_bac= 10000b ;¡¨â ¤«ï ®ç¨á⪨ ¢ë¤¥«¥®£® shift â.¥. ¯à¨ ãáâ ®¢ª¥ £®¢®à¨â çâ® ¥áâì ¢ë¤¥«¥¨¥ |
ed_shift_bac_cl=1111111111101111b ;®ç¨á⪠¯à¨ 㤠«¥¨¨ ¢ë¤¥«¥¨ï |
ed_shift_cl= 1111111111100011b |
ed_shift_mcl= 1111111111111011b |
ed_left_fl= 100000b |
ed_right_fl= 1111111111011111b |
ed_offset_fl= 1000000b |
ed_offset_cl= 1111111110111111b |
ed_insert= 10000000b |
ed_insert_cl= 1111111101111111b |
ed_mouse_on = 100000000b |
ed_mous_adn_b= 100011000b |
ed_mouse_on_off=1111111011111111b |
ed_height=14 ; ¢ëá®â |
.width dd width |
.left dd left |
.top dd top |
.color dd color |
.shift_color dd shift_color |
.focus_border_color dd focus_border_color |
.blur_border_color dd blur_border_color |
.text_color dd text_color |
.max dd max |
.text dd text |
.flags dd flags+0 |
.size dd size+0 |
.pos dd pos+0 |
.offset dd 0 |
.cl_curs_x dd 0 |
.cl_curs_y dd 0 |
.shift dd 0 |
.shift_old dd 0 |
} |
struc check_box left,top,ch_text_margin,ch_size,color,border_color,text_color,text,ch_text_length,flags |
{ ;áâàãªâãà ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá |
ch_flag_en=10b |
.left: dw left ;+0 ;¯®«®¦¥¨¥ ¯® å |
.top: dw top ;¯®«®¦¥¨¥ ¯® ã |
.ch_text_margin: dd ch_text_margin ;à ááâ®ï¨¥ ®â ¯àאַ㣮«ì¨ª 祪 ¡®ªá ¤® ¤¯¨á¨ |
.ch_size: dd ch_size ;à §¬¥à ª¢ ¤à â 祪 ¡®ªá , ¤«ï ¯à¨¬¥à 12 |
.color: dd color ;梥⠢ãâਠ祪¡®ªá |
.border_color: dd border_color ;梥â à ¬ª¨ |
.text_color: dd text_color ;梥⠤¯¨á¨ |
.text: dd text ; ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à ᯮ«®¦¥ ⥪áâ |
.ch_text_length: dd ch_text_length ;¤«¨ áâப¨ á ᨬ¢®« ¬¨ |
.flags: dd flags+0 ; ä« £¨ |
} |
struc option_box point_gr,left,top,op_text_margin,op_size,color,border_color,text_color,text,op_text_length,flags |
{ ;áâàãªâãà ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá |
op_flag_en=10b |
.option_group: dd point_gr |
.left: dw left ;+0 ;¯®«®¦¥¨¥ ¯® å |
.top: dw top ;¯®«®¦¥¨¥ ¯® ã |
.ch_text_margin: dd op_text_margin ;à ááâ®ï¨¥ ®â ¯àאַ㣮«ì¨ª 祪 ¡®ªá ¤® ¤¯¨á¨ |
.ch_size: dd op_size ;à §¬¥à ª¢ ¤à â 祪 ¡®ªá , ¤«ï ¯à¨¬¥à 12 |
.color: dd color ;梥⠢ãâਠ祪¡®ªá |
.border_color: dd border_color ;梥â à ¬ª¨ |
.text_color: dd text_color ;梥⠤¯¨á¨ |
.text: dd text ; ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à ᯮ«®¦¥ ⥪áâ |
.ch_text_length: dd op_text_length ;¤«¨ áâப¨ á ᨬ¢®« ¬¨ |
.flags: dd flags+0 ; ä« £¨ |
} |
/programs/develop/libraries/box_lib/asm/trunk/load_lib.mac |
---|
0,0 → 1,533 |
;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> |
; All rights reserved. |
; |
; 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. |
; |
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov aka <Lrz> ''AS IS'' AND ANY |
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY |
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
;***************************************************************************** |
; This macros based on source code: |
; <Lrz> - Alexey Teplov / Àëåêñåé Òåïëîâ |
; Mario79, Mario - Marat Zakiyanov / Ìàðàò Çàêèÿíîâ |
; Diamondz - Evgeny Grechnikov / Åâãåíèé Ãðå÷íèêîâ |
;------------------------ |
; DESCRIPTION |
; Macro load_library |
; Logick of work. |
; A first time we must to check system path, where I belive find a system library. System path is "/sys/lib/". |
; If I cannot found my library, i must to check second way. Second way is current dirrectory. |
; 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." |
; |
; |
;--------------------------------------------------------------------- |
; 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 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;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 |
mcall 68,19,system_path ; load of sys directory |
test eax,eax |
jnz end_steep |
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 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 |
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 |
mcall 68,19,system_path ; load of sys directory |
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 sys_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] |
; 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 |
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 |
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 |
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 |
mcall 68,19,system_path ; load of sys directory |
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 |
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 copy_path lib_name,dir_path,lib_path |
{ |
pushad ;save all registers |
push dword lib_name |
push dword dir_path |
push dword lib_path |
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 |
local import_find |
local lp |
local import_find_next |
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: |
lodsd |
test eax, eax |
jz import_done |
push edx |
import_find: |
mov ebx, [ds:edx] |
test ebx, ebx |
jz import_not_found |
push eax |
lp: |
mov cl, [ds:eax] |
cmp cl, [ds:ebx] |
jnz import_find_next |
test cl, cl |
jz import_found |
inc eax |
inc ebx |
jmp lp |
import_find_next: |
pop eax |
add edx, 8 |
jmp import_find |
import_found: |
pop eax |
mov eax, [ds:edx+4] |
mov [esi-4], eax |
pop edx |
jmp import_loop |
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/asm/trunk/reload_16x16_8b.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/develop/libraries/box_lib/asm/trunk/w_about.inc |
---|
0,0 → 1,89 |
;--------------------------------------------------------------------- |
thread3: |
call draw_window3 |
still3: |
mov eax,10 ; wait here for event |
mcall |
cmp eax,1 ; redraw request ? |
je thread3 |
cmp eax,2 ; key in buffer ? |
je key3 |
cmp eax,3 ; button in buffer ? |
je button3 |
jmp still3 |
key3: |
mcall |
cmp ah,27 |
je close3 |
jmp still3 |
button3: ; button |
mov eax,17 ; get id |
mcall |
cmp ah,1 ; button id=1 ? |
je close3 |
cmp ah,2 |
jne noclose3 |
close3: |
mov eax,-1 ; close this program |
mcall |
noclose3: |
jmp still3 |
; ********************************************* |
; ******* WINDOW DEFINITIONS AND DRAW ******** |
; ********************************************* |
draw_window3: |
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,1 ; 1, start of draw |
mcall |
; DRAW WINDOW |
xor eax,eax ; function 0 : define and draw window |
mov ebx,100*65536+200 ; [x start] *65536 + [x size] |
mov ecx,100*65536+100 ; [y start] *65536 + [y size] |
mov edx,0x03eeeeee ; color of work area RRGGBB,8->color gl |
mcall |
mcall 4,<10,40>,0x80000000,header_1 |
mov ebx,70*65536+40 |
mov ecx,70*65536+20 |
mov edx,2 |
mov esi,0xdddddd |
mcall 8 |
add ebx,15 shl 16 |
shr ecx,16 |
mov bx,cx |
add ebx,6 |
mov ecx,0 |
mov edx, ok_btn |
mov esi,2 |
mcall 4 |
; WINDOW LABEL |
mcall 71,1, labelt3 |
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,2 ; 2, end of draw |
mcall |
ret |
;--------------------------------------------------------------------- |
/programs/develop/libraries/box_lib/asm/trunk |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/develop/libraries/box_lib/asm |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/develop/libraries/box_lib/trunk/proc32.inc |
---|
File deleted |
/programs/develop/libraries/box_lib/trunk/data.inc |
---|
File deleted |
\ No newline at end of file |
/programs/develop/libraries/box_lib/trunk/w_about.inc |
---|
File deleted |
\ No newline at end of file |
/programs/develop/libraries/box_lib/trunk/config.inc |
---|
File deleted |
/programs/develop/libraries/box_lib/trunk/load_lib.mac |
---|
File deleted |
/programs/develop/libraries/box_lib/trunk/editbox_ex.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/libraries/box_lib/trunk/cnv_bmp.obj |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/develop/libraries/box_lib/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
/programs/develop/libraries/box_lib/trunk/reload_16x16_8b.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/develop/libraries/box_lib/trunk/editbox_ex.mac |
---|
File deleted |
/programs/develop/libraries/box_lib/trunk/struct.inc |
---|
File deleted |
/programs/develop/libraries/box_lib/trunk/ctrldemo.asm |
---|
File deleted |
/programs/develop/libraries/box_lib/trunk/box_lib.asm |
---|
8,7 → 8,7 |
public EXPORTS |
section '.flat' code readable align 16 |
include 'macros.inc' |
include '../../../../macros.inc' |
include 'editbox.mac' ;¬ ªà®á ª®â®àë© ¤®«¦¥ ®¡«¥£ç¨âì ¦¨§ì :) á¯¥æ¨ «ì® ¤«ï editbox |
include 'checkbox.mac' ;¬ ªà®á ᮤ¥à¦¨â ॠ«¨§ æ¨î checkbox |
include 'optionbox.mac' ;¬ ªà®á ᮤ¥à¦¨â ॠ«¨§ æ¨î optionbox |
/programs/develop/libraries/box_lib/trunk/optionbox.mac |
---|
126,24 → 126,26 |
@@: |
movzx ebx,word op_left ;çàãðóçèòü êîîðäèíàòó ïî õ |
mov eax,dword op_size |
mov bp,ax |
shr eax,2 |
push ax |
shr eax,2 |
add ebx,eax ;äîáàâèòü (ñòîðîíà ïðÿìîóãîëüíèêà/3) |
push ax |
add ebx,eax |
shl ebx,16 ;ñäâèíåì íà 16 ðàçðÿäîâ â ëåâî (óìíîæèì íà 65536) |
pop bx |
shr bx,1 ;çàãðóçèòü (ñòîðîíà ïðÿìîóãîëüíèêà/2) |
mov bp,bx ;ñîõðàíèì ðåãèñòð bx â ðåãèñòðå óêàçàòåëÿ áàçû |
pop ax |
lea eax,[eax*2] |
sub bp,ax ;ñîõðàíèì ðåãèñòð bx â ðåãèñòðå óêàçàòåëÿ áàçû |
mov bx,bp |
movzx ecx,word op_top ;çàãðóçèòü êîîðäèíàòó ïî ó |
mov eax,dword op_size |
shr eax,2 |
add ecx,eax ;äîáàâèòü (ñòîðîíà ïðÿìîóãîëüíèêà/4) |
pop ax |
add cx,ax |
shl ecx,16 ;ñäâèíåì íà 16 ðàçðÿäîâ â ëåâî (óìíîæèì íà 65536) |
mov cx,bp ;çàãðóçèì çíà÷åíèÿ ðåãèñòðà óêàçàòåëÿ áàçû â cx |
mov eax,13 ;â eax - çíà÷åíèÿ ôóíêöèè äëÿ âûâîäà ïîëîñû ò.å. ïî ñóòè ïðÿìîóãîëüíèêà, êîòîðûé îòîáðàæàåò âêëþ÷åííûé êîìïîíåíò ÷åê áîêñ |
mcall ;âûâîä |
ret ;âûéòè èç ïðîöåäóðû |
} |
/programs/develop/libraries/box_lib/trunk/run.bat |
---|
1,6 → 1,4 |
@fasm.exe -m 16384 box_lib.asm |
@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 |
if not exist bin mkdir bin |
@fasm.exe -m 16384 box_lib.asm bin\box_lib.obj |
@kpack bin\box_lib.obj |
pause |