kolibrios/programs/other/planet_v/planet_v.asm
Marat Zakiyanov (Mario79) 79c0315dca BoxLib: Small reorganization for user-macros.
1) Now all the macros used by other applications to work with BoxLib located in box_lib.mac 
2) Macros for components that are used only in the library BoxLib - located in  bl_sys.mac, a list of include files. 
3) Big requests to other developers  -support this rule, it will do easier to use macros for other applications.

git-svn-id: svn://kolibrios.org@1432 a494cfbc-eb01-0410-851d-a64ba20cac60
2010-03-12 19:52:43 +00:00

978 lines
22 KiB
NASM
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;Ž£à®¬­ ï ¡« £®¤ à­®áâì Maxxxx32, Diamond, Heavyiron
;¨ ¤à㣨¬ ¯à®£à ¬¬¨áâ ¬,   â ª¦¥
;’¥¯«®¢ã €«¥ªá¥î (<Lrz> www.lrz.land.ru)
use32
org 0x0
db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
dd 0x1
dd start
dd i_end ; à §¬¥à ¯à¨«®¦¥­¨ï
dd mem
dd stacktop
dd 0x0
dd sys_path
include '../../proc32.inc'
include '../../macros.inc'
include 'mem.inc'
include 'dll.inc'
include '../../develop/libraries/box_lib/load_lib.mac'
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
min_window_w equ 485 ;¬¨­¨¬ «ì­ ï è¨à¨­  ®ª­ 
min_window_h equ 325 ;¬¨­¨¬ «ì­ ï ¢ëá®â  ®ª­ 
otst_panel_left equ 265
include 'tile_fun.inc'
include 'pl_import.inc'
@use_library
struct f70
func_n dd ?
param1 dd ?
param2 dd ?
param3 dd ?
param4 dd ?
rezerv db ?
name dd ?
ends
fn_metki db 'pl_metki.lst',0
fn_icon1 db 'tl_sys_16.png',0
fn_icon2 db 'tl_nod_16.bmp',0
ini_name db 'planet_v.ini',0
ini_sec db 'Map',0
ini_k_cache db 'Cache',0
ini_def_cache db '/cache/sat',0
ini_ext db 'ext'
.number db '?'
.def db 0 ;à áè¨à¥­¨¥ ¯® 㬮«ç ­¨î
align 4
start:
load_libraries l_libs_start,load_lib_end
;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ­ è  «¨¡ 
mov ebp,lib0
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
@@:
mov ebp,lib1
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
@@:
mov ebp,lib2
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
@@:
mov ebp,lib3
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
@@:
stdcall dll.Init,dword[lib_init]
stdcall dll.Init,dword[lib_init_ini]
copy_path ini_name,sys_path,file_name,0x0
stdcall dword[ini_get_str],file_name,ini_sec,ini_k_cache,dword[edit1.text],dword[edit1.max],ini_def_cache
stdcall [str_len],dword[edit1.text],dword[edit1.max]
mov dword[edit1.size],eax
mov dword[edit1.pos],eax
stdcall dword[tl_data_init], tree1
stdcall dword[tl_data_init], tree2
;áç¨â뢠¥¬ à áè¨à¥­¨ï ª àâ ¨§ *.ini ä ©« 
mov byte[ini_ext.number],'0'
@@: ;áç¨â뢠¥¬ ¯ à ¬¥âàë ®â ext1 ¤® ext9
inc byte[ini_ext.number]
stdcall dword[ini_get_str],file_name,ini_sec,ini_ext,txt_tile_type_0,dword[tree1.info_capt_len],ini_ext.def
cmp byte[txt_tile_type_0],0
je @f
stdcall dword[tl_node_add], txt_tile_type_0, 0, tree1
jmp @b
@@:
mov byte[ini_ext.number],'0' ;áç¨â뢠¥¬ ¯ à ¬¥âà ®â ext0 ª®â®àë© ¡ã¤¥â ¢ë¡à ­ ¢ ᯨ᪥
stdcall dword[ini_get_str],file_name,ini_sec,ini_ext,txt_tile_type_0,dword[tree1.info_capt_len],ini_ext.def
cmp byte[txt_tile_type_0],0
jne @f
mov dword[txt_tile_type_0],'.bmp' ;¥á«¨ ¢ *.ini ä ©«¥ ­¨ç¥£® ­¥â ¤®¡ ¢«ï¥¬ à áè¨à¥­¨¥ .bmp
@@:
stdcall dword[tl_node_add], txt_tile_type_0, 0, tree1
; init bmp file
push dword RGB_TILE_SIZE+300 ;300 - § ¯ á­ë¥ ¡ ©âë á ãç¥â®¬ § £®«®¢ª  bmp ä ©« 
call mem.Alloc
mov [bmp_icon],eax
stdcall array_tile_function, tile_00,max_tiles_count,tile_init
stdcall tiles_init_grid, tile_00,max_tiles_count,max_tiles_cols
push dword TREE_ICON_SYS16_BMP_SIZE
call mem.Alloc
mov [tree_sys_icon],eax
push dword TREE_ICON_NOD16_BMP_SIZE
call mem.Alloc
mov [tree_nod_icon],eax
copy_path fn_icon1,sys_path,file_name,0x0
mov eax,70 ;load icon file
mov [run_file_70.func_n], 0
mov [run_file_70.param1], 0
mov [run_file_70.param2], 0
mov [run_file_70.param3], TREE_ICON_SYS16_BMP_SIZE
m2m [run_file_70.param4], [tree_sys_icon]
mov [run_file_70.rezerv], 0
mov [run_file_70.name], file_name
mov ebx,run_file_70
int 0x40
cmp ebx,0xffffffff
je @f
stdcall dword[img_decode], dword[tree_sys_icon],ebx,0
mov dword[data_icon],eax
stdcall dword[img_to_rgb2], dword[data_icon],dword[tree_sys_icon]
stdcall dword[img_destroy], dword[data_icon]
m2m dword[tree1.data_img_sys],dword[tree_sys_icon]
m2m dword[tree2.data_img_sys],dword[tree_sys_icon]
@@:
copy_path fn_icon2,sys_path,file_name,0x0
mov eax,70 ;load icon file
mov [run_file_70.param3], TREE_ICON_NOD16_BMP_SIZE
m2m [run_file_70.param4], [tree_nod_icon]
mov ebx,run_file_70
int 0x40
cmp ebx,0xffffffff
je @f
stdcall dword[img_decode], dword[tree_nod_icon],ebx,0
mov dword[data_icon],eax
stdcall dword[img_to_rgb2], dword[data_icon],dword[tree_nod_icon]
stdcall dword[img_destroy], dword[data_icon]
m2m dword[tree1.data_img],dword[tree_nod_icon]
m2m dword[tree2.data_img],dword[tree_nod_icon]
@@:
mcall 40,0x27
mcall 48,3,sc,sizeof.system_colors
;ãáâ ­®¢ª  á¨á⥬­ëå 梥⮢
edit_boxes_set_sys_color edit1,editboxes_end,sc
check_boxes_set_sys_color ch1,checkboxes_end,sc
mov byte[file_name],0
red_win:
call draw_win
call but_MetLoad
still:
mov eax,10
mcall
cmp al,0x1 ;¨§¬. ¯®«®¦¥­¨¥ ®ª­ 
jz red_win
cmp al,0x2
jz key
cmp al,0x3
jz button
push dword ch2
call [check_box_mouse]
push dword ch1
call [check_box_mouse]
stdcall [edit_box_mouse], edit1
stdcall [edit_box_mouse], edit2
stdcall [tl_mouse], tree1
stdcall [tl_mouse], tree2
jmp still
key:
push eax ebx
mcall 2
stdcall [edit_box_key], edit1
stdcall [edit_box_key], edit2
push dword tree1
call [tl_key]
push dword tree2
call [tl_key]
mov ebx,dword[el_focus] ;÷òî-áû êàðòà íå äâèãàëàñü åñëè îêíà treelist â ôîêóñå
cmp ebx, dword tree1
je .end_f
cmp ebx, dword tree2
je .end_f
;÷òî-áû êàðòà íå äâèãàëàñü åñëè òåêñòîâûå ïîëÿ â ôîêóñå
test word[edit1.flags],10b ;ed_focus
jne .end_f
test word[edit2.flags],10b ;ed_focus
jne .end_f
cmp ah,179 ;Right
jne @f
call CursorMoveRight
@@:
cmp ah,176 ;Left
jne @f
cmp dword[map.coord_x],0
je @f
dec dword[map.coord_x]
;ᤢ¨£ ¥¬ á¥âªã â ©«®¢ ¢¯à ¢®, çâ®-¡ë ç áâì â ©«®¢ ᮢ¯ «¨ ¨ ¯à¨è«®áì ¬¥­ìè¥ § £à㦠âì ­®¢ëå
stdcall tiles_grid_move_right, tile_00,max_tiles_count,max_tiles_cols
call but_Refresh
@@:
cmp ah,177 ;Down
jne @f
call CursorMoveDown
@@:
cmp ah,178 ;Up
jne @f
cmp dword[map.coord_y],0
je @f
dec dword[map.coord_y]
;ᤢ¨£ ¥¬ á¥âªã â ©«®¢ ¢­¨§
stdcall tiles_grid_move_down, tile_00,max_tiles_count,max_tiles_rows
call but_Refresh
@@:
cmp ah,45 ;-
jne @f
call but_ZoomM
@@:
cmp ah,61 ;+
jne @f
call but_ZoomP
@@:
.end_f:
pop ebx eax
jmp still
align 4
draw_win:
pushad
mcall 12,1
xor eax,eax
mov ebx,20*65536+min_window_w
mov ecx,20*65536+min_window_h
mov edx,[sc.work]
or edx,0x33000000
mov edi,hed
mcall
mcall 9,procinfo,-1
cmp dword[procinfo.box.width],min_window_w ; ¯à®¢¥à塞 è¨à¨­ã ®ª­ 
jge @f
mov dword[procinfo.box.width],min_window_w ; ¥á«¨ ®ª­® ®ç¥­ì 㧪®¥, 㢥«¨ç¨¢ ¥¬ è¨à¨­ã ¤«ï ¨§¡¥¦ ­¨ï £«îª®¢
@@:
mov edi,dword[procinfo.box.width]
sub edi,min_window_w-otst_panel_left
mov dword[tree1.box_left],edi
mov dword[tree2.box_left],edi
mov eax,dword[tree2.box_left] ;¤¢¨£ ¥¬ áªà®««¨­£
add eax,dword[tree2.box_width]
mov ebx,dword[tree2.p_scrol]
mov word[ebx+2],ax
mov dword[edit2.left],edi
add dword[edit2.left],370-otst_panel_left
stdcall dword[tl_draw],dword tree1
stdcall dword[tl_draw],dword tree2
mov dword[wScrMetki.all_redraw],1
push dword wScrMetki
call [scrollbar_ver_draw]
mov eax,8 ;ª­®¯ª 
mov ebx,145*65536+20
mov ecx,5*65536+25
mov edx,6
mov esi,[sc.work_button]
int 0x40
mov ebx,100*65536+20
mov ecx,5*65536+25
mov edx,5
int 0x40
mov bx,di
shl ebx,16
mov bx,100
mov ecx,265*65536+25
mov edx,9
int 0x40
;ebx ...
mov ecx,235*65536+25
mov edx,8
int 0x40
mov bx,di
add bx,410-otst_panel_left
shl ebx,16
mov bx,55
;mov ebx,410*65536+55
mov ecx,5*65536+25
mov edx,7
int 0x40
mov bx,di
add bx,440-otst_panel_left
shl ebx,16
mov bx,30
;mov ebx,440*65536+30
mov ecx,265*65536+25
mov edx,12
int 0x40
mov bx,di
add bx,405-otst_panel_left
shl ebx,16
mov bx,30
;mov ebx,405*65536+30
mov ecx,265*65536+25
mov edx,11
int 0x40
mov bx,di
add bx,370-otst_panel_left
shl ebx,16
mov bx,30
;mov ebx,370*65536+30
mov ecx,265*65536+25
mov edx,10
int 0x40
mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
mov ebx,152*65536+13
mov ecx,[sc.work_button_text]
or ecx,0x80000000
mov edx,txt_zoom_p
mcall
mov ebx,107*65536+13
mov edx,txt_zoom_m
int 0x40
mov bx,di
add bx,270-otst_panel_left
shl ebx,16
mov bx,243
;mov ebx,270*65536+243
mov edx,txt151
int 0x40
mov bx,di
add bx,270-otst_panel_left
shl ebx,16
mov bx,273
;mov ebx,270*65536+273
mov edx,txt152
int 0x40
mov bx,di
add bx,415-otst_panel_left
shl ebx,16
mov bx,13
;mov ebx,415*65536+13
mov edx,txt_but_refresh
int 0x40
mov bx,di
add bx,380-otst_panel_left
shl ebx,16
mov bx,275
;mov ebx,380*65536+275
mov edx,txt_met_up
int 0x40
mov bx,di
add bx,415-otst_panel_left
shl ebx,16
mov bx,275
;mov ebx,415*65536+275
mov edx,txt_met_dn
int 0x40
mov bx,di
add bx,450-otst_panel_left
shl ebx,16
mov bx,275
;mov ebx,450*65536+275
mov edx,txt_met_sh
int 0x40
mov ecx,[sc.work_text]
or ecx,0x80000000
mov ebx,175*65536+13
mov edx,txt_cache
int 0x40
mov bx,di
;add bx,450-otst_panel_left
shl ebx,16
mov bx,35
;mov ebx,265*65536+35
mov edx,txt141
int 0x40
mov bx,135
;mov ebx,265*65536+135
mov edx,txt142
int 0x40
call draw_tiles
push dword ch2
call [check_box_draw]
push dword ch1
call [check_box_draw]
stdcall [edit_box_draw], edit1
stdcall [edit_box_draw], edit2
mcall 12,2
popad
ret
head_f_i:
head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0
err_message_found_lib0 db '<27>¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã box_lib.obj',0
err_message_import0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ box_lib.obj',0
err_message_found_lib1 db '<27>¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã libimg.obj',0
err_message_import1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ libimg.obj',0
err_message_found_lib2 db '<27>¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã str.obj',0
err_message_import2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ str.obj',0
err_message_found_lib3 db '<27>¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã libini.obj',0
err_message_import3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ libini.obj',0
system_dir0 db '/sys/lib/'
boxlib_name db 'box_lib.obj',0
system_dir1 db '/sys/lib/'
libimg_name db 'libimg.obj',0
system_dir2 db '/sys/lib/'
strlib_name db 'str.obj',0
system_dir3 db '/sys/lib/'
libini_name db 'libini.obj',0
;library structures
l_libs_start:
lib0 l_libs boxlib_name, sys_path, file_name, system_dir0, err_message_found_lib0, head_f_l, boxlib_import,err_message_import0, head_f_i
lib1 l_libs libimg_name, sys_path, file_name, system_dir1, err_message_found_lib1, head_f_l, libimg_import, err_message_import1, head_f_i
lib2 l_libs strlib_name, sys_path, file_name, system_dir2, err_message_found_lib2, head_f_l, strlib_import, err_message_import2, head_f_i
lib3 l_libs libini_name, sys_path, file_name, system_dir3, err_message_found_lib3, head_f_l, libini_import, err_message_import3, head_f_i
load_lib_end:
align 4
button:
mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨
cmp ah,5
jne @f
call but_ZoomM
@@:
cmp ah,6
jne @f
call but_ZoomP
@@:
cmp ah,7
jne @f
call but_Refresh
@@:
cmp ah,9
jz but_MetSave
cmp ah,8
jz but_MetAdd
cmp ah,10
jne @f
call but_met_up
@@:
cmp ah,11
jne @f
call but_met_dn
@@:
cmp ah,12
jne @f
call fun_goto_met
@@:
cmp ah,1
jne still
.exit:
push dword[bmp_icon]
call mem.Free
stdcall array_tile_function, tile_00,max_tiles_count,tile_destroy
stdcall dword[tl_data_clear], tree1
mov dword[tree2.data_img_sys],0 ;÷èñòèì óêàçàòåëü íà ñèñòåìíûå èêîíêè,
;ò. ê. îíè áûëè óäàëåíû âåðõíåé ôóíêöèåé tl_data_clear
;ïîâòîðíûé âûçîâ tl_data_clear áåç ÷èñòêè óêàçàòåëÿ âûçâåò îøèáêó
mov dword[tree2.data_img],0 ;÷èñòèì óêàçàòåëü íà èêîíêè óçëîâ
stdcall dword[tl_data_clear], tree2
; stdcall dword[img_destroy], dword[data_icon]
mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
;input:
;data_rgb - pointer to rgb data
;size - count img pixels (size img data / 3(rgb) )
align 4
proc img_rgb_wdiv2 data_rgb:dword, size:dword
push eax ebx ecx edx
mov eax,dword[data_rgb]
mov ecx,dword[size] ;ecx = size
imul ecx,3
@@: ;çàòåìíåíèå öâåòà ïèêñåëåé
shr byte[eax],1
and byte[eax],0x7f
inc eax
loop @b
mov eax,dword[data_rgb]
mov ecx,dword[size] ;ecx = size
shr ecx,1
@@: ;ñëîæåíèå öâåòîâ ïèêñåëåé
mov ebx,dword[eax+3] ;êîïèðóåì öâåò ñîñåäíåãî ïèêñåëÿ
add word[eax],bx
shr ebx,16
add byte[eax+2],bl
add eax,6 ;=2*3
loop @b
mov eax,dword[data_rgb]
add eax,3
mov ebx,eax
add ebx,3
mov ecx,dword[size] ;ecx = size
shr ecx,1
dec ecx ;ëèøíèé ïèêñåëü
@@: ;ïîäæàòèå ïèêñåëåé
mov edx,dword[ebx]
mov word[eax],dx
shr edx,16
mov byte[eax+2],dl
add eax,3
add ebx,6
loop @b
pop edx ecx ebx eax
ret
endp
;input:
;data_rgb - pointer to rgb data
;size - count img pixels (size img data / 3(rgb) )
;size_w - width img in pixels
align 4
proc img_rgb_hdiv2, data_rgb:dword, size:dword, size_w:dword
pushad
mov eax,dword[data_rgb] ;eax =
mov ecx,dword[size] ;ecx = size
imul ecx,3
@@: ;çàòåìíåíèå öâåòà ïèêñåëåé
shr byte[eax],1
and byte[eax],0x7f
inc eax
loop @b
mov eax,dword[data_rgb] ;eax =
mov edi,dword[size_w]
lea esi,[edi+edi*2] ;esi = width*3(rgb)
mov ebx,esi
add ebx,eax
mov ecx,dword[size] ;ecx = size
shr ecx,1
xor edi,edi
@@: ;ñëîæåíèå öâåòîâ ïèêñåëåé
mov edx,dword[ebx] ;êîïèðóåì öâåò íèæíåãî ïèêñåëÿ
add word[eax],dx
shr edx,16
add byte[eax+2],dl
add eax,3
add ebx,3
inc edi
cmp edi,dword[size_w]
jl .old_line
add eax,esi
add ebx,esi
xor edi,edi
.old_line:
loop @b
mov eax,dword[data_rgb] ;eax =
add eax,esi ;esi = width*3(rgb)
mov ebx,esi
add ebx,eax
mov ecx,dword[size] ;ecx = size
shr ecx,1
sub ecx,dword[size_w] ;ëèøíÿÿ ñòðîêà ïèêñåëåé
xor edi,edi
@@: ;ïîäæàòèå ïèêñåëåé
mov edx,dword[ebx] ;êîïèðóåì öâåò íèæíåãî ïèêñåëÿ
mov word[eax],dx
shr edx,16
mov byte[eax+2],dl
add eax,3
add ebx,3
inc edi
cmp edi,dword[size_w]
jl .old_line_2
add ebx,esi
xor edi,edi
.old_line_2:
loop @b
popad
ret
endp
;input:
;data_rgb - pointer to rgb data
;size - count img pixels (size img data / 3(rgb) )
align 4
proc img_rgb_wmul2, data_rgb:dword, size:dword
push eax ebx ecx edx
;eax - source
;ebx - destination
mov ecx,dword[size] ;ecx = size
mov eax,ecx
dec eax
lea eax,[eax+eax*2] ;eax = (size-1)*3
mov ebx,eax ;ebx = size*3
add eax,dword[data_rgb] ;eax = pointer + size*3
add ebx,eax ;ebx = pointer + 2*size*3
@@:
mov edx,dword[eax] ;edx = pixel color
mov word[ebx],dx
mov word[ebx+3],dx
shr edx,16
mov byte[ebx+2],dl
mov byte[ebx+3+2],dl
sub eax,3
sub ebx,6
loop @b
pop edx ecx ebx eax
ret
endp
;äã­ªæ¨ï ¤«ï à áâ¢ ­¨ï ¨§®¡à ¦¥­¨ï ¯® ¢ëá®â¥ ¢ 2 à § 
;¢ 㪠§ â¥«¥ data_rgb ¯ ¬ï⨠¤®«¦­® ¡ëâì ¢ 2 à §  ¡®«ìè¥ ç¥¬ size*3
;¨­ ç¥ ¯à¨ à áâ¢ ­¨¨ ¡ã¤¥â ®è¨¡ª , ¢ë室  ­  çã¦ãî ¯ ¬ïâì
;input:
;data_rgb - pointer to rgb data
;size - count img pixels (size img data / 3(rgb) )
;size_w - width img in pixels
align 4
proc img_rgb_hmul2, data_rgb:dword, size:dword, size_w:dword
pushad
mov esi,dword[size_w]
lea esi,[esi+esi*2] ;esi = width * 3(rgb)
mov eax,dword[size]
lea eax,[eax+eax*2]
mov edi,eax
shl edi,1
add eax,dword[data_rgb] ;eax = pointer to end pixel (old image) + 1
add edi,dword[data_rgb] ;edi = pointer to end pixel (new image) + 1
mov ebx,edi
sub ebx,esi
.beg_line:
mov ecx,dword[size_w]
@@:
sub eax,3
sub ebx,3
sub edi,3
mov edx,dword[eax] ;edx = pixel color
mov word[ebx],dx
mov word[edi],dx
shr edx,16
mov byte[ebx+2],dl
mov byte[edi+2],dl
loop @b
sub ebx,esi
sub edi,esi
cmp eax,dword[data_rgb]
jg .beg_line
popad
ret
endp
;input:
;data_rgb - pointer to rgb data
;size - count img pixels (size img data / 3(rgb) )
;size_w - width img in pixels
align 4
proc img_rgb_hoffs, data_rgb:dword, size:dword, size_w:dword, hoffs:dword
push eax ebx ecx edx esi
mov esi,dword[size_w]
lea esi,[esi+esi*2] ;esi = width * 3(rgb)
imul esi,dword[hoffs]
mov eax,dword[size]
lea eax,[eax+eax*2]
add eax,dword[data_rgb] ;eax = pointer to end pixel + 1
sub eax,3
mov ebx,eax
add ebx,esi
mov ecx,dword[size]
dec ecx
@@:
mov edx,dword[eax] ;edx = pixel color
mov word[ebx],dx
shr edx,16
mov byte[ebx+2],dl
sub eax,3
sub ebx,3
loop @b
pop esi edx ecx ebx eax
ret
endp
;input:
;data_rgb - pointer to rgb data
;size_w_old - width img in pixels
;size_w_new - new width img in pixels
;size_h - height img in pixels
align 4
proc img_rgb_wcrop, data_rgb:dword, size_w_old:dword, size_w_new:dword, size_h:dword
pushad
mov eax, dword[size_w_old]
lea eax, dword[eax+eax*2] ;eax = width(old) * 3(rgb)
mov ebx, dword[size_w_new]
lea ebx, dword[ebx+ebx*2] ;ebx = width(new) * 3(rgb)
mov edx, dword[size_h]
;dec edx
mov edi, dword[data_rgb] ;edi - ¯®«ã砥⠤ ­­ë¥
mov esi, edi
add edi, ebx
add esi, eax
cld
@@:
dec edx ;㬥­ìè ¥¬ áç¥â稪 ®áâ ¢è¨åáï áâப ­  1
cmp edx,0
jle @f
mov ecx, ebx
rep movsb ;¯¥à¥­®á (ª®¯¨à®¢ ­¨¥) áâப¨ ¯¨ªá¥«¥©
;stdcall mem_copy,esi,edi,ebx
add esi,eax ;¯¥à¥å®¤ ­  ­®¢ãî áâà®çªã ¨§®¡à ¦¥­¨ï
sub esi,ebx
;add esi,eax
;add edi,ebx
jmp @b
@@:
popad
ret
endp
align 4
proc mem_copy, source:dword, destination:dword, len:dword
push ecx esi edi
cld
mov esi, dword[source]
mov edi, dword[destination]
mov ecx, dword[len]
rep movsb
pop edi esi ecx
ret
endp
align 4
proc mem_clear, mem:dword, len:dword
push eax ecx edi
cld
xor al,al
mov edi, dword[mem]
mov ecx, dword[len]
repne stosb
pop edi ecx eax
ret
endp
txt_met_up db 24,0
txt_met_dn db 25,0
txt_met_sh db '*',0
txt_zoom_m db '-',0
txt_zoom_p db '+',0
txt151 db '„®¡ ¢¨âì ¬¥âªã',0
txt152 db '‘®åà ­¨âì ¬¥âª¨',0
txt_but_refresh db 'Ž¡­®¢¨âì',0
txt_cache db 'Cache:',0
txt141 db '‚¨¤ ª àâë',0
txt142 db '‚ë¡®à ¬¥âª¨',0
; check_boxes
ch1 check_box 5, 5, 6, 12, 0xffffd0, 0x800000, 0, ch_text1, 12,ch_flag_en
ch2 check_box 5, 20, 6, 12, 0xffffd0, 0x800000, 0, ch_text2, 11,ch_flag_en
checkboxes_end:
ch_text1 db '¡à âì ᢥàåã'
ch_text2 db '¡à âì á­¨§ã'
edit1 edit_box 190, 215, 10, 0xd0ffff, 0xff, 0x80ff, 0, 0xa000, 500, ed_buffer.1, mouse_dd, 0
edit2 edit_box 100, 370, 240, 0xd0ffff, 0xff, 0x80ff, 0, 0xa000, 30, ed_buffer.2, mouse_dd, 0
editboxes_end:
tree1 tree_list 10,10, tl_list_box_mode+tl_key_no_edit, 16,16,\
0x8080ff,0x0000ff,0xffffff, 265,45,90,85, 0,0,0,\
el_focus, 0,fun_new_map_type
tree2 tree_list 32,300, tl_draw_par_line, 16,16,\
0x8080ff,0x0000ff,0xffffff, 265,145,190,85, 0,12,0,\
el_focus, wScrMetki,fun_goto_met
align 4
wScrMetki:
.x:
.size_x dw 16 ;+0
.start_x dw 0 ;+2
.y:
.size_y dw 100 ;+4
.start_y dw 0 ;+6
.btn_high dd 15 ;+8
.type dd 1 ;+12
.max_area dd 100 ;+16
.cur_area dd 30 ;+20
.position dd 0 ;+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 1 ;+84
ed_buffer: ;òåêñò äëÿ edit
.1: rb 502
.2: rb 32
el_focus dd tree1
tree_sys_icon dd 0
tree_nod_icon dd 0
bmp_icon dd 0 ;¯ ¬ïâì ¤«ï § £à㧪¨ ¨§®¡à ¦¥­¨ï
data_icon dd 0 ;¯ ¬ïâì ¤«ï ¯à¥®¡à §®¢ ­¨ï ª à⨭ª¨ äã­ªæ¨ï¬¨ libimg
run_file_70 f70
txt_tile_path db 'tile path',0
rb 300
txt_tile_type dd txt_tile_type_0 ;óêàçàòåëü íà âûáðàííûé òèï ôàéëîâ
txt_tile_type_0 db 0
rb 10
align 4
map: ;êîîðäèíàòû êàðòû
.coord_x dd 0 ;êîîðäèíàòà x
.coord_y dd 0 ;êîîðäèíàòà y
.zoom db 1 ;ìàñøòàá
align 4
tile_00 rb size_tile_struc * max_tiles_count
;ýòîò êîä íå ìîé, îí ïðåîáðàçóåò ÷èñëî â ñòðîêó
;input:
; eax = value
; edi = string buffer
;output:
; edi =
align 4
tl_convert_to_str:
pushad
mov dword[edi+1],0;0x20202020
call .str
popad
ret
align 4
.str:
mov ecx,0x0a ;çàäàåòñÿ ñèñòåìà ñ÷èñëåíèÿ èçìåíÿþòñÿ ðåãèñòðû ebx,eax,ecx,edx âõîäíûå ïàðàìåòðû eax - ÷èñëî
;ïðåðåâîä ÷èñëà â ASCII ñòðîêó âçîäíûå äàííûå ecx=ñèñòåìà ñ÷èñëåíÿ edi àäðåñ êóäà çàïèñûâàòü, áóäåì ñòðîêó, ïðè÷åì êîíåö ïåðåìåííîé
cmp eax,ecx ;ñðàâíèòü åñëè â eax ìåíüøå ÷åì â ecx òî ïåðåéòè íà @@-1 ò.å. íà pop eax
jb @f
xor edx,edx ;î÷èñòèòü edx
div ecx ;ðàçäåëèòü - îñòàòîê â edx
push edx ;ïîëîæèòü â ñòåê
;dec edi ;ñìåùåíèå íåîáõîäèìîå äëÿ çàïèñè ñ êîíöà ñòðîêè
call .str;ïåðåéòè íà ñàìó ñåáÿ ò.å. âûçâàòü ñàìó ñåáÿ è òàê äî òîãî ìîìåíòà ïîêà â eax íå ñòàíåò ìåíüøå ÷åì â ecx
pop eax
@@: ;cmp al,10 ;ïðîâåðèòü íå ìåíüøå ëè çíà÷åíèå â al ÷åì 10 (äëÿ ñèñòåìû ñ÷èñëåíÿ 10 äàííàÿ êîìàíäà - ëèøíàÿ))
or al,0x30 ;äàííàÿ êîìàíäà êîðî÷å ÷åì äâå âûøå
stosb ;çàïèñàòü ýëåìåíò èç ðåãèñòðà al â ÿ÷åêó ïàìÿòè es:edi
ret ;âåðíóòüñÿ ÷åíü èíòåðåñíûé õîä ò.ê. ïîêà â ñòåêå õðàíèòüñÿ êîë-âî âûçîâîâ òî ñòîëüêî ðàç ìû è áóäåì âûçûâàòüñÿ
hed db 'Planet viewer 09.02.10',0 ;¯®¤¯¨áì ®ª­ 
sc system_colors ;á¨á⥬­ë¥ 梥â 
mouse_dd dd 0 ;­ã¦­® ¤«ï Shift-  ¢ editbox
sys_path rb 4096
file_name:
rb 4096
i_end:
procinfo process_information
rb 1024
stacktop:
mem: