diff --git a/programs/system/MyKey/trunk/ASPAPI.INC b/programs/system/MyKey/trunk/ASPAPI.INC index 811503580b..625dee015b 100644 --- a/programs/system/MyKey/trunk/ASPAPI.INC +++ b/programs/system/MyKey/trunk/ASPAPI.INC @@ -1,4 +1,4 @@ -include 'proc32.inc' +include '../../../proc32.inc' macro start_draw_window x,y,xsize,ysize,areacolor,caption,capsize { diff --git a/programs/system/MyKey/trunk/MyKey.asm b/programs/system/MyKey/trunk/MyKey.asm index b3eb8010d4..439565f35f 100644 --- a/programs/system/MyKey/trunk/MyKey.asm +++ b/programs/system/MyKey/trunk/MyKey.asm @@ -21,11 +21,14 @@ use32 include 'lang.inc' ;language support -include 'ASPAPI.INC' include 'string.inc' -include 'macros.inc' -include 'editbox_ex.mac' -include 'load_lib.mac' +;include 'macros.inc' +include '../../../macros.inc' +include 'ASPAPI.INC' +;include 'editbox_ex.mac' +include '../../../develop/libraries/box_lib/trunk/box_lib.mac' +;include 'load_lib.mac' +include '../../../develop/libraries/box_lib/load_lib.mac' include '../../../dll.inc' include 'debug.inc' diff --git a/programs/system/MyKey/trunk/config.inc b/programs/system/MyKey/trunk/config.inc deleted file mode 100644 index dc70bf9760..0000000000 --- a/programs/system/MyKey/trunk/config.inc +++ /dev/null @@ -1 +0,0 @@ -__CPU_type fix p5 diff --git a/programs/system/MyKey/trunk/editbox_ex.mac b/programs/system/MyKey/trunk/editbox_ex.mac deleted file mode 100644 index 5e85004670..0000000000 --- a/programs/system/MyKey/trunk/editbox_ex.mac +++ /dev/null @@ -1,79 +0,0 @@ -ed_struc_size=72 -struc edit_box width,left,top,color,shift_color,focus_border_color,\ - blur_border_color,text_color,max,text,mouse_variable,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 -.mouse_variable dd mouse_variable -.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 ; флаги -} - diff --git a/programs/system/MyKey/trunk/load_lib.mac b/programs/system/MyKey/trunk/load_lib.mac deleted file mode 100644 index bda5c92e2e..0000000000 --- a/programs/system/MyKey/trunk/load_lib.mac +++ /dev/null @@ -1,634 +0,0 @@ -;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, -; 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 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 ''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 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: -; - 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 -{ - -local __sc -local lp -local lp1 -local correction -;local end_tr -local exit_ -;/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] - -;;;;;;;;;;;CALC WIDTH & HIGHT WINDOW & CENTER MONITOR POSITION;;;;;;;;;; -show_err_: -;check memory - push dword [arrea_xx] - pop eax - test eax,eax - jnz @f - - mcall 68,11 - mcall 68,12,4096 - push eax - pop dword [arrea_xx] - - push head1 - pop dword[eax] - - push 0x0 - pop dword[eax+4] - -@@: - mov eax,48 ;get system color - mov ebx,3 - mov ecx,__sc - mov edx,sizeof.system_colors - mcall -;----------------------------------- - xor eax,eax - mov esi,err_message1 - mov ecx,30 -align 4 -lp: add ecx,7 - lodsb - test eax,eax - jnz lp - - push dword [arrea_xx] - pop ebp - -align 4 -@@: add ebp,4 - mov eax,dword [ebp] - - test eax,eax - jnz @b - - push err_message1 - pop dword[ebp] - - mov dword [ebp+4],eax - - mcall 48,5 ;get system window - cmp word[on_x],cx - jae @f; эх эєцэю юсэюты Є№ - - sub eax,ecx - shl eax,15 - mov ax,cx - mov dword [on_x],eax - -@@: - add word [on_y],12 - sub bx,word [on_y] - shl ebx,15 - mov bx,word [on_y] - mov dword [on_y],ebx - - ret - - -;;;;;;;;;;;DRAW WINDOW;;;;;;;;;;;;;; -align 4 -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 ebp,dword [arrea_xx] ; set point - mov ebx,dword [on_x] - mov ecx,dword [on_y] - mov edx,__sc.work - or edx,0x33000000 - mov esi,__sc.grab_text - xor edi,edi - mov edi,dword [ebp] ;head1 - mcall - - mov ebx,(10*65536+25-12) - add ebp,4 ;inc index - -@@: - mov eax,4 - add bx,12 - mov ecx,__sc.grab_text - or ecx,0x90000000 - mov edx,dword [ebp] ;err_message1 - mcall - - add ebp,4 ;inc index - - mov eax,dword [ebp] - test eax,eax - jnz @b - - 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 - ret - -align 4 -__sc system_colors -on_x dd 0x0 -on_y dd 0x0000004E -arrea_xx dd 0x0 -rb 0x50 -end_tr: - -;--------------------------------------------------------------------- -@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: - test eax,eax - jz @f - - mcall 51,1,start__,end_tr ; ёючфрхь эют√щ яюЄюъ яю °рсыюэє - or eax,-1 -@@: - -;--------------------------------------------------------------------- -} - - -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: - test eax,eax - jz @f - - mcall 51,1,start__,end_tr ; ёючфрхь эют√щ яюЄюъ яю °рсыюэє - or eax,-1 -@@: - -;--------------------------------------------------------------------- -} -macro sys_load_libraries _start,_end -{ -local exit_lp2 -local lp2 -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 - 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 - -;---------------------------------- - mov ebp,_start - mov ecx,((_end-_start)/ll_struc_size) - -align 4 -lp2: - mov eax,status_lib - test eax,eax - jz @f - - mcall 51,1,start__,end_tr ; ёючфрхь эют√щ яюЄюъ яю °рсыюэє - or eax,-1 - jmp exit_lp2 - -@@: - add ebp,ll_struc_size - dec ecx - jnz lp2 -exit_lp2: -} - -macro load_libraries _start,_end -{ -local lp2 -local exit_lp2 -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 - -;----------------------------------------------- - mov ebp,_start - mov ecx,((_end-_start)/ll_struc_size) - -align 4 -lp2: - mov eax,status_lib - test eax,eax - jz @f - - mcall 51,1,start__,end_tr ; ёючфрхь эют√щ яюЄюъ яю °рсыюэє - or eax,-1 - jmp exit_lp2 - -@@: - add ebp,ll_struc_size - dec ecx - jnz lp2 -exit_lp2: - -} - - -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 - or eax,-1 ;єт√ -} - - -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__ ; єърчрЄхы№ эр сєЇхЁ т ъюЄюЁюь сєфхЄ ёюЇюЁшьшЁютрэ яєЄ№ ъ сшсышюЄхъш, хёыш эєцэю т√ўшёышЄ№ яєЄ№ фю ышс√ ё ьхёЄр чряєёър яЁюуЁрьь√, юс√ўэю эєцэю, т ёыєўр ї, хёыш ышср Ёрёяюыюцхэр т Єющ цх яряъх -.complete_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 -; -} diff --git a/programs/system/MyKey/trunk/macros.inc b/programs/system/MyKey/trunk/macros.inc deleted file mode 100644 index ec3163d8b6..0000000000 --- a/programs/system/MyKey/trunk/macros.inc +++ /dev/null @@ -1,518 +0,0 @@ -@^ fix macro comment { -^@ fix } - -; ------------------------- -macro library [lname,fname] -{ - forward - dd __#lname#_library_table__,__#lname#_library_name__ - common - dd 0 - forward - align 4 - __#lname#_library_name__ db fname,0 -} - -macro import lname,[name,sname] -{ - common - align 4 - __#lname#_library_table__: - forward - if used name - name dd __#name#_import_name__ - end if - common - dd 0 - forward - if used name - align 4 - __#name#_import_name__ db sname,0 - end if -} - -macro export [name,sname] -{ - forward - dd __#name#_export_name__,name - common - dd 0 - forward - align 4 - __#name#_export_name__ db sname,0 -} -; ------------------------- - -macro m2m dest,src { - push src - pop dest -} - - -macro iglobal { - IGlobals equ IGlobals, - macro __IGlobalBlock { } - -macro uglobal { - UGlobals equ UGlobals, - macro __UGlobalBlock { } - -endg fix } ; Use endg for ending iglobal and uglobal blocks. - - -macro IncludeIGlobals{ - macro IGlobals dummy,[n] \{ __IGlobalBlock - purge __IGlobalBlock \} - match I, IGlobals \{ I \} } - -macro IncludeUGlobals{ - macro UGlobals dummy,[n] \{ - \common - \local begin, size - begin = $ - virtual at $ - \forward - __UGlobalBlock - purge __UGlobalBlock - \common - size = $ - begin - end virtual - rb size - \} - match U, UGlobals \{ U \} } - -uglobal -endg - -iglobal -endg - - -; new application structure -macro meos_app_start - { - use32 - org 0x0 - - db 'MENUET01' - dd 0x01 - dd __start - dd __end - dd __memory - dd __stack - - if used __params & ~defined __params - dd __params - else - dd 0x0 - end if - - dd 0x0 - } -MEOS_APP_START fix meos_app_start - -macro code - { - __start: - } -CODE fix code - -macro data - { - __data: - IncludeIGlobals - } -DATA fix data - -macro udata - { - if used __params & ~defined __params - __params: - db 0 - __end: - rb 255 - else - __end: - end if - __udata: - IncludeUGlobals - } -UDATA fix udata - -macro meos_app_end - { - align 32 - rb 2048 - __stack: - __memory: - } -MEOS_APP_END fix meos_app_end - - -; macro for defining multiline text data -struc mstr [sstring] - { - forward - local ssize - virtual at 0 - db sstring - ssize = $ - end virtual - dd ssize - db sstring - common - dd -1 - } - -; macro for defining multiline text data -struc mls [sstring] - { - forward - local ssize - virtual at 0 - db sstring ; mod - ssize = $ - end virtual - db ssize - db sstring - common - db -1 ; mod - } - - - -; strings -macro sz name,[data] { ; from MFAR [mike.dld] - common - if used name - name db data - .size = $-name - end if -} - -macro lsz name,[lng,data] { ; from MFAR [mike.dld] - common - if used name - label name - forward - if lang eq lng - db data - end if - common - .size = $-name - end if -} - -macro szc name,elsz,[data] { ; from MFAR [mike.dld] - common - local s,m - m = 0 - if used name - label name - forward - virtual at 0 - db data - s = $ - end virtual - d#elsz s - if m < s - m = s - end if - db data - common - .size = $-name - .maxl = m - end if -} - -macro lszc name,elsz,[lng,data] { ; from MFAR [mike.dld] - common - local s,m,c - m = 0 - c = 0 - if used name - label name - forward - if lang eq lng - virtual at 0 - db data - s = $ - end virtual - d#elsz s - if m < s - m = s - end if - db data - c = c+1 - end if - common - .size = $-name - .maxl = m - .count = c - end if -} - - -; easy system call macro -macro mpack dest, hsrc, lsrc -{ - if (hsrc eqtype 0) & (lsrc eqtype 0) - mov dest, (hsrc) shl 16 + lsrc - else - if (hsrc eqtype 0) & (~lsrc eqtype 0) - mov dest, (hsrc) shl 16 - add dest, lsrc - else - mov dest, hsrc - shl dest, 16 - add dest, lsrc - end if - end if -} - -macro __mov reg,a,b { ; mike.dld - if (~a eq)&(~b eq) - mpack reg,a,b - else if (~a eq)&(b eq) - mov reg,a - end if -} - - -include 'config.inc' -;__CPU_type equ p5 -SYSENTER_VAR equ 0 - -macro mcall a,b,c,d,e,f { ; mike.dld, updated by Ghost for Fast System Calls - __mov eax,a - __mov ebx,b - __mov ecx,c - __mov edx,d - __mov esi,e - __mov edi,f - int 0x40 -} - - -; ------------------------- -macro header a,[b] { - common - use32 - org 0 - db 'MENUET',a - forward - if b eq - dd 0 - else - dd b - end if } -macro section name { align 16 - label name } -macro func name { - if ~used name - display 'FUNC NOT USED: ',`name,13,10 - else - align 4 - name: - ;diff16 `name,0,name -;pushad -;pushfd -;dps `name -;newline -;mcall 5,1 -;popfd -;popad -} -macro endf { end if } - -macro diff16 title,l1,l2 - { - local s,d - s = l2-l1 - display title,': 0x' - repeat 8 - d = '0' + s shr ((8-%) shl 2) and $0F - if d > '9' - d = d + 'A'-'9'-1 - end if - display d - end repeat - display 13,10 - } - -macro diff10 title,l1,l2 - { - local s,d,z,m - s = l2-l1 - z = 0 - m = 1000000000 - display title,': ' - repeat 10 - d = '0' + s / m - s = s - (s/m)*m - m = m / 10 - if d <> '0' - z = 1 - end if - if z <> 0 - display d - end if - end repeat - display 13,10 - } - -; optimize the code for size -__regs fix - -macro add arg1,arg2 - { - if (arg2 eqtype 0) - if (arg2) = 1 - inc arg1 - else - add arg1,arg2 - end if - else - add arg1,arg2 - end if - } - -macro sub arg1,arg2 - { - if (arg2 eqtype 0) - if (arg2) = 1 - dec arg1 - else - sub arg1,arg2 - end if - else - sub arg1,arg2 - end if - } - -macro mov arg1,arg2 - { - if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) - if (arg2) = 0 - xor arg1,arg1 - else if (arg2) = 1 - xor arg1,arg1 - inc arg1 - else if (arg2) = -1 - or arg1,-1 - else if (arg2) > -128 & (arg2) < 128 - push arg2 - pop arg1 - else - mov arg1,arg2 - end if - else - mov arg1,arg2 - end if - } - - -macro RGB [a] { - common - match (r=,g=,b),a \{ - \dd ((r) shl 16) or ((g) shl 8) or (b) - \} -} - - -struc POINT _t,_dx,_dy { - .x _t _dx - .y _t _dy -} - -; structure definition helper -include 'struct.inc' - -struct RECT - left dd ? - top dd ? - right dd ? - bottom dd ? -ends - -struct BOX - left dd ? - top dd ? - width dd ? - height dd ? -ends - -; structures used in MeOS -struct process_information - cpu_usage dd ? ; +0 - window_stack_position dw ? ; +4 - window_stack_value dw ? ; +6 - dw ? ; +8 - process_name rb 12 ; +10 - memory_start dd ? ; +22 - used_memory dd ? ; +26 - PID dd ? ; +30 - box BOX ; +34 - slot_state dw ? ; +50 - dw ? ; +52 - client_box BOX ; +54 - wnd_state db ? ; +70 - rb (1024-71) -ends - -struct system_colors - frame dd ? - grab dd ? - grab_button dd ? - grab_button_text dd ? - grab_text dd ? - work dd ? - work_button dd ? - work_button_text dd ? - work_text dd ? - work_graph dd ? -ends - -struct FILEDATE - Second db ? - Minute db ? - Hour db ? - db ? - Day db ? - Month db ? - Year dw ? -ends - -struct FILEINFO - Attributes dd ? - IsUnicode db ? - db 3 dup(?) - DateCreate FILEDATE - DateAccess FILEDATE - DateModify FILEDATE - Size dq ? -ends - -; constants - -; events -EV_IDLE = 0 -EV_TIMER = 0 -EV_REDRAW = 1 -EV_KEY = 2 -EV_BUTTON = 3 -EV_EXIT = 4 -EV_BACKGROUND = 5 -EV_MOUSE = 6 -EV_IPC = 7 -EV_STACK = 8 - -; event mask bits for function 40 -EVM_REDRAW = 1b -EVM_KEY = 10b -EVM_BUTTON = 100b -EVM_EXIT = 1000b -EVM_BACKGROUND = 10000b -EVM_MOUSE = 100000b -EVM_IPC = 1000000b -EVM_STACK = 10000000b diff --git a/programs/system/MyKey/trunk/proc32.inc b/programs/system/MyKey/trunk/proc32.inc deleted file mode 100644 index 23c56b03c1..0000000000 --- a/programs/system/MyKey/trunk/proc32.inc +++ /dev/null @@ -1,268 +0,0 @@ - -; Macroinstructions for defining and calling procedures - -macro stdcall proc,[arg] ; directly call STDCALL procedure - { common - if ~ arg eq - reverse - pushd arg - common - end if - call proc } - -macro invoke proc,[arg] ; indirectly call STDCALL procedure - { common - if ~ arg eq - reverse - pushd arg - common - end if - call [proc] } - -macro ccall proc,[arg] ; directly call CDECL procedure - { common - size@ccall = 0 - if ~ arg eq - reverse - pushd arg - size@ccall = size@ccall+4 - common - end if - call proc - if size@ccall - add esp,size@ccall - end if } - -macro cinvoke proc,[arg] ; indirectly call CDECL procedure - { common - size@ccall = 0 - if ~ arg eq - reverse - pushd arg - size@ccall = size@ccall+4 - common - end if - call [proc] - if size@ccall - add esp,size@ccall - end if } - -macro proc [args] ; define procedure - { common - match name params, args> - \{ define@proc name, \{ prologue name,flag,parmbytes,localbytes,reglist \} - macro locals - \{ virtual at ebp-localbytes+current - macro label . \\{ deflocal@proc .,:, \\} - struc db [val] \\{ \common deflocal@proc .,db,val \\} - struc dw [val] \\{ \common deflocal@proc .,dw,val \\} - struc dp [val] \\{ \common deflocal@proc .,dp,val \\} - struc dd [val] \\{ \common deflocal@proc .,dd,val \\} - struc dt [val] \\{ \common deflocal@proc .,dt,val \\} - struc dq [val] \\{ \common deflocal@proc .,dq,val \\} - struc rb cnt \\{ deflocal@proc .,rb cnt, \\} - struc rw cnt \\{ deflocal@proc .,rw cnt, \\} - struc rp cnt \\{ deflocal@proc .,rp cnt, \\} - struc rd cnt \\{ deflocal@proc .,rd cnt, \\} - struc rt cnt \\{ deflocal@proc .,rt cnt, \\} - struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \} - macro endl - \{ purge label - restruc db,dw,dp,dd,dt,dq - restruc rb,rw,rp,rd,rt,rq - restruc byte,word,dword,pword,tword,qword - current = $-(ebp-localbytes) - end virtual \} - macro ret operand - \{ match any, operand \\{ retn operand \\} - match , operand \\{ match epilogue:reglist, epilogue@proc: - \\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \} - macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2 - end if \} } - -macro defargs@proc [arg] - { common - if ~ arg eq - forward - local ..arg,current@arg - match argname:type, arg - \{ current@arg equ argname - label ..arg type - argname equ ..arg - if dqword eq type - dd ?,?,?,? - else if tbyte eq type - dd ?,?,? - else if qword eq type | pword eq type - dd ?,? - else - dd ? - end if \} - match =current@arg,current@arg - \{ current@arg equ arg - arg equ ..arg - ..arg dd ? \} - common - args@proc equ current@arg - forward - restore current@arg - common - end if } - -macro deflocal@proc name,def,[val] - { common - match vars, all@vars \{ all@vars equ all@vars, \} - all@vars equ all@vars name - forward - local ..var,..tmp - ..var def val - match =?, val \{ ..tmp equ \} - match any =dup (=?), val \{ ..tmp equ \} - match tmp : value, ..tmp : val - \{ tmp: end virtual - initlocal@proc ..var,def value - virtual at tmp\} - common - match first rest, ..var, \{ name equ first \} } - -macro initlocal@proc name,def - { virtual at name - def - size@initlocal = $ - name - end virtual - position@initlocal = 0 - while size@initlocal > position@initlocal - virtual at name - def - if size@initlocal - position@initlocal < 2 - current@initlocal = 1 - load byte@initlocal byte from name+position@initlocal - else if size@initlocal - position@initlocal < 4 - current@initlocal = 2 - load word@initlocal word from name+position@initlocal - else - current@initlocal = 4 - load dword@initlocal dword from name+position@initlocal - end if - end virtual - if current@initlocal = 1 - mov byte [name+position@initlocal],byte@initlocal - else if current@initlocal = 2 - mov word [name+position@initlocal],word@initlocal - else - mov dword [name+position@initlocal],dword@initlocal - end if - position@initlocal = position@initlocal + current@initlocal - end while } - -macro endp - { purge ret,locals,endl - finish@proc - purge finish@proc - restore regs@proc - match all,args@proc \{ restore all \} - restore args@proc - match all,all@vars \{ restore all \} } - -macro local [var] - { common - locals - forward done@local equ - match varname[count]:vartype, var - \{ match =BYTE, vartype \\{ varname rb count - restore done@local \\} - match =WORD, vartype \\{ varname rw count - restore done@local \\} - match =DWORD, vartype \\{ varname rd count - restore done@local \\} - match =PWORD, vartype \\{ varname rp count - restore done@local \\} - match =QWORD, vartype \\{ varname rq count - restore done@local \\} - match =TBYTE, vartype \\{ varname rt count - restore done@local \\} - match =DQWORD, vartype \\{ label varname dqword - rq count+count - restore done@local \\} - match , done@local \\{ virtual - varname vartype - end virtual - rb count*sizeof.\#vartype - restore done@local \\} \} - match :varname:vartype, done@local:var - \{ match =BYTE, vartype \\{ varname db ? - restore done@local \\} - match =WORD, vartype \\{ varname dw ? - restore done@local \\} - match =DWORD, vartype \\{ varname dd ? - restore done@local \\} - match =PWORD, vartype \\{ varname dp ? - restore done@local \\} - match =QWORD, vartype \\{ varname dq ? - restore done@local \\} - match =TBYTE, vartype \\{ varname dt ? - restore done@local \\} - match =DQWORD, vartype \\{ label varname dqword - dq ?,? - restore done@local \\} - match , done@local \\{ varname vartype - restore done@local \\} \} - match ,done@local - \{ var - restore done@local \} - common - endl } diff --git a/programs/system/MyKey/trunk/struct.inc b/programs/system/MyKey/trunk/struct.inc deleted file mode 100644 index 947a84e89a..0000000000 --- a/programs/system/MyKey/trunk/struct.inc +++ /dev/null @@ -1,180 +0,0 @@ - -; Macroinstructions for defining data structures - -macro struct name - { fields@struct equ name - match child parent, name \{ fields@struct equ child,fields@\#parent \} - sub@struct equ - struc db [val] \{ \common fields@struct equ fields@struct,.,db, \} - struc dw [val] \{ \common fields@struct equ fields@struct,.,dw, \} - struc du [val] \{ \common fields@struct equ fields@struct,.,du, \} - struc dd [val] \{ \common fields@struct equ fields@struct,.,dd, \} - struc dp [val] \{ \common fields@struct equ fields@struct,.,dp, \} - struc dq [val] \{ \common fields@struct equ fields@struct,.,dq, \} - struc dt [val] \{ \common fields@struct equ fields@struct,.,dt, \} - struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \} - struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \} - struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \} - struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \} - struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \} - struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \} - macro db [val] \{ \common \local anonymous - fields@struct equ fields@struct,anonymous,db, \} - macro dw [val] \{ \common \local anonymous - fields@struct equ fields@struct,anonymous,dw, \} - macro du [val] \{ \common \local anonymous - fields@struct equ fields@struct,anonymous,du, \} - macro dd [val] \{ \common \local anonymous - fields@struct equ fields@struct,anonymous,dd, \} - macro dp [val] \{ \common \local anonymous - fields@struct equ fields@struct,anonymous,dp, \} - macro dq [val] \{ \common \local anonymous - fields@struct equ fields@struct,anonymous,dq, \} - macro dt [val] \{ \common \local anonymous - fields@struct equ fields@struct,anonymous,dt, \} - macro rb count \{ \local anonymous - fields@struct equ fields@struct,anonymous,db,count dup (?) \} - macro rw count \{ \local anonymous - fields@struct equ fields@struct,anonymous,dw,count dup (?) \} - macro rd count \{ \local anonymous - fields@struct equ fields@struct,anonymous,dd,count dup (?) \} - macro rp count \{ \local anonymous - fields@struct equ fields@struct,anonymous,dp,count dup (?) \} - macro rq count \{ \local anonymous - fields@struct equ fields@struct,anonymous,dq,count dup (?) \} - macro rt count \{ \local anonymous - fields@struct equ fields@struct,anonymous,dt,count dup (?) \} - macro union \{ fields@struct equ fields@struct,,union,< - sub@struct equ union \} - macro struct \{ fields@struct equ fields@struct,,substruct,< - sub@struct equ substruct \} - virtual at 0 } - -macro ends - { match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt - restruc rb,rw,rd,rp,rq,rt - purge db,dw,du,dd,dp,dq,dt - purge rb,rw,rd,rp,rq,rt - purge union,struct - match name=,fields,fields@struct \\{ fields@struct equ - make@struct name,fields - fields@\\#name equ fields \\} - end virtual \} - match any, sub@struct \{ fields@struct equ fields@struct> \} - restore sub@struct } - -macro make@struct name,[field,type,def] - { common - if $ - display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah - err - end if - local define - define equ name - forward - local sub - match , field \{ make@substruct type,name,sub def - define equ define,.,sub, \} - match any, field \{ define equ define,.#field,type, \} - common - match fields, define \{ define@struct fields \} } - -macro define@struct name,[field,type,def] - { common - local list - list equ - forward - if ~ field eq . - name#field type def - sizeof.#name#field = $ - name#field - else - rb sizeof.#type - end if - local value - match any, list \{ list equ list, \} - list equ list - common - sizeof.#name = $ - restruc name - match values, list \{ - struc name value \\{ - match any, fields@struct \\\{ fields@struct equ fields@struct,.,name, \\\} - match , fields@struct \\\{ label . - forward - match , value \\\\{ field type def \\\\} - match any, value \\\\{ field type value - if ~ field eq . - rb sizeof.#name#field - ($-field) - end if \\\\} - common \\\} \\} \} } - -macro enable@substruct - { macro make@substruct substruct,parent,name,[field,type,def] - \{ \common - \local define - define equ parent,name - \forward - \local sub - match , field \\{ match any, type \\\{ enable@substruct - make@substruct type,name,sub def - purge make@substruct - define equ define,.,sub, \\\} \\} - match any, field \\{ define equ define,.\#field,type, \\} - \common - match fields, define \\{ define@\#substruct fields \\} \} } - -enable@substruct - -macro define@union parent,name,[field,type,def] - { common - virtual at 0 - forward - if ~ field eq . - virtual at 0 - parent#field type def - sizeof.#parent#field = $ - parent#field - end virtual - if sizeof.#parent#field > $ - rb sizeof.#parent#field - $ - end if - else if sizeof.#type > $ - rb sizeof.#type - $ - end if - common - sizeof.#name = $ - end virtual - struc name [value] \{ \common - label .\#name - last@union equ - forward - match any, last@union \\{ virtual at .\#name - field type def - end virtual \\} - match , last@union \\{ match , value \\\{ field type def \\\} - match any, value \\\{ field type value \\\} \\} - last@union equ field - common rb sizeof.#name - ($ - .\#name) \} } - -macro define@substruct parent,name,[field,type,def] - { common - virtual at 0 - forward - if ~ field eq . - parent#field type def - sizeof.#parent#field = $ - parent#field - else - rb sizeof.#type - end if - local value - common - sizeof.#name = $ - end virtual - struc name value \{ - label .\#name - forward - match , value \\{ field type def \\} - match any, value \\{ field type value - if ~ field eq . - rb sizeof.#parent#field - ($-field) - end if \\} - common \} }