mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-22 14:52:39 +03:00
0cc349060f
place dll.inc in /programs delete all the other dll.inc and mem.inc files correct some programs to use common dll.inc git-svn-id: svn://kolibrios.org@3014 a494cfbc-eb01-0410-851d-a64ba20cac60
2726 lines
61 KiB
NASM
2726 lines
61 KiB
NASM
use32
|
||
org 0x0
|
||
db 'MENUET01' ;¨¤¥â¨ä. ¨á¯®«ï¥¬®£® ä ©« ¢á¥£¤ 8 ¡ ©â
|
||
dd 0x1
|
||
dd start
|
||
dd i_end ;à §¬¥à ¯à¨«®¦¥¨ï
|
||
dd mem
|
||
dd stacktop
|
||
dd 0
|
||
dd sys_path
|
||
|
||
ini_def_c_bkgnd equ 0
|
||
ini_def_c_border equ 0xff0000
|
||
color_s0 equ 0xff ;ᨣ « 0
|
||
color_s1 equ 0xffffff ;ᨣ « 1
|
||
color_s2 equ 0xff00 ;â®çª ¡¥§ ¯¥à¥á¥ç¥¨ï
|
||
color_s3 equ 0xff0000 ;¢à¥¬¥®¥ § 票¥ ¤«ï á®åà ¥¨ï
|
||
|
||
color_border dd ini_def_c_border
|
||
opt_sign_moves dd 4
|
||
opt_fast_mode dd 0 ;¡ëáâàë© à¥¦¨¬
|
||
|
||
debug equ 0
|
||
|
||
;®¬ à ¨ª®®ª:
|
||
el_icon_group equ 0 ;£à㯯®¢ ï
|
||
el_icon_points equ 1 ;â®çª¨
|
||
el_icon_sub_points equ 2 ;¨§®«ï樨
|
||
el_icon_elems equ 3 ;í«¥¬¥â
|
||
el_icon_captions equ 4 ;¯®¤¯¨á¨
|
||
|
||
size_el_opt equ 34 ;à §¬¥à áâàãªâãàë á ®¯æ¨ï¬¨ í«¥¬¥â
|
||
el_offs_nam equ 0 ;ᬥ饨¥ ¤«ï ç « ¨¬¥¨ í«¥¬¥â
|
||
el_offs_col equ 16 ;梥â í«¥¬¥â
|
||
el_offs_box_x equ 20 ;è¨à¨ ª®à®¡ª¨ í«¥¬¥â
|
||
el_offs_box_y equ 21 ;¢ëá®â ª®à®¡ª¨ í«¥¬¥â
|
||
el_offs_table equ 22 ;㪠§ ⥫ì â ¡«¨æã à ¡®âë í«¥¬¥â
|
||
el_offs_legs_inp equ 26 ;㪠§ ⥫ì â ¡«¨æã ®¯¨á ¨ï ¢å®¤ëå ®£
|
||
el_offs_legs_out equ 30 ;ᬥ饨¥ ®¯¨á ¨¥ ¢ë室ëå ®£
|
||
|
||
sp_offs_el_angle equ 8 ;ᬥ饨¥ ¤«ï 㣫 ¯®¢®à®â í«¥¬¥â ¢ ᯨ᪥
|
||
sp_offs_el_type equ 9 ;ᬥ饨¥ ¤«ï ⨯ í«¥¬¥â ¢ ᯨ᪥
|
||
|
||
points_max equ 1000
|
||
capt_offs equ 10 ;ᬥ饨¥ ¤«ï ç « ¯®¤¯¨á¨ ¢ «¨á⥠tree1
|
||
|
||
include '../../../macros.inc'
|
||
include '../../../proc32.inc'
|
||
include '../../../develop/libraries/box_lib/load_lib.mac'
|
||
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
|
||
include '../../../dll.inc'
|
||
include 'le_pole.inc'
|
||
include 'le_signal.inc'
|
||
|
||
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
|
||
caption db '‹®£¨ç¥áª¨¥ í«¥¬¥âë 19.04.12',0 ;¯®¤¯¨áì ®ª
|
||
|
||
panel_0_coord_top equ 5 ;¢¥àåïï ª®®à¤¨ â 0-£® àï¤ ¯ ¥«¨ ¨áâà㬥⮢
|
||
panel_1_coord_top equ 35
|
||
panel_2_coord_top equ 60
|
||
panel_3_coord_top equ 85
|
||
|
||
align 4
|
||
proc move_rotate_x_n90 uses ecx edi, d_x:dword, angle:dword
|
||
mov edi,[angle] ;㣮« ¯®¢®à®â / 90 (®â 0-3)
|
||
and edi,3
|
||
shl edi,4 ;edi*=16
|
||
add edi,mcs
|
||
|
||
mov ecx,[d_x]
|
||
imul ecx,dword[edi]
|
||
add eax,ecx
|
||
|
||
mov ecx,[d_x]
|
||
imul ecx,dword[edi+8]
|
||
add ebx,ecx
|
||
|
||
ret
|
||
endp
|
||
|
||
struct FileInfoBlock
|
||
Function dd ?
|
||
Position dd ?
|
||
Flags dd ?
|
||
Count dd ?
|
||
Buffer dd ?
|
||
db ?
|
||
FileName dd ?
|
||
ends
|
||
|
||
macro elOpt nam,col,box_x,box_y,table, tbl_i_legs, ol0, ol1, ol2
|
||
{
|
||
@@: db nam,0
|
||
rb @b+el_offs_col-$
|
||
dd col
|
||
db box_x
|
||
db box_y
|
||
dd table+0 ;+el_offs_table
|
||
dd tbl_i_legs+0 ;+26 ¢å®¤ë¥ ®£¨
|
||
;+30 ¢ëå®¤ë¥ ®£¨
|
||
db ol0+0, ol1+0, ol2+0, 0
|
||
}
|
||
|
||
align 4
|
||
el_opt_beg:
|
||
elOpt 'or[2]', 0xff00ff,5,5,tbl_or, tbl_il_2, 2
|
||
elOpt 'or[3]', 0xff00ff,5,7,tbl_or, tbl_il_3, 3
|
||
elOpt 'or[4]', 0xff00ff,5,9,tbl_or, tbl_il_4, 4
|
||
elOpt 'and[2]',0xffff00,5,5,tbl_and.2, tbl_il_2, 2
|
||
elOpt 'and[3]',0xffff00,5,7,tbl_and.3, tbl_il_3, 3
|
||
elOpt 'and[4]',0xffff00,5,9,tbl_and.4, tbl_il_4, 4
|
||
elOpt 'and[5]',0xffff00,5,11,tbl_and.5, tbl_il_5, 5
|
||
elOpt 'not', 0xffff, 3,3,tbl_not, tbl_il_1, 1
|
||
elOpt 'xor', 0x8000ff,5,5,tbl_xor, tbl_il_2, 2
|
||
elOpt 'sm[1]', 0x8080ff,7,7,tbl_sm, tbl_il_3, 1,4
|
||
elOpt 'ms[2]', 0x8080ff,7,14,tbl_ms_2, tbl_il_m2,6
|
||
elOpt 'ms[2]e',0x8080ff,7,17,tbl_ms_2_e,tbl_il_m2e,8
|
||
;elOpt 'cd[8]', 0x8000, 7,17,tbl_cd_8,tbl_il_8, 6,2,2 ;è¨äà â®à 8 ¢å®¤®¢
|
||
.end:
|
||
elOpt '???', 0x808080,3,3,tbl_and.3, tbl_il_1, 1 ;¥ ®¯®§ ë© í«¥¬¥â
|
||
|
||
;â ¡«¨æë ¯® ª®â®àë¬ § ¤ îâáï ¯à ¢¨« à ¡®âë í«¥¬¥â®¢
|
||
align 4
|
||
tbl_or db 0,1,1,1, 1,1,1,1 ;or2, or3
|
||
db 1,1,1,1,1,1,1,1 ;or4
|
||
tbl_and:
|
||
.5: dq 0,0
|
||
.4: dq 0
|
||
.3: dd 0
|
||
.2: db 0,0,0,1
|
||
tbl_xor db 0,1,1,0
|
||
tbl_sm db 0,2,2,1, 2,1,1,3
|
||
tbl_not db 1,0 ;not
|
||
|
||
;¬ã«ì⨯«¥ªá®à ¤«ï 2-å à §à冷£® ᨣ «
|
||
align 4
|
||
tbl_ms_2_e: ;á® ¢å®¤®¬ 'e'
|
||
dq 0,0,0,0,0,0,0,0
|
||
tbl_ms_2:
|
||
db 0,1,0,1,0,1,0,1
|
||
db 0,1,0,1,0,1,0,1
|
||
db 0,0,1,1,0,0,1,1
|
||
db 0,0,1,1,0,0,1,1
|
||
db 0,0,0,0,1,1,1,1
|
||
db 0,0,0,0,1,1,1,1
|
||
dq 0
|
||
db 1,1,1,1,1,1,1,1
|
||
;tbl_cd_8 db ;256=2^8
|
||
|
||
;â ¡«¨æë ¤«ï ¢å®¤ëå ®£
|
||
tbl_il_1 db 1,0 ;ª®à¯ãá 1 ®£ã
|
||
tbl_il_2 db 1,2,0 ;ª®à¯ãá 2 ®£¨
|
||
tbl_il_3 db 1,2,2,0
|
||
tbl_il_4 db 1,2,2,2,0
|
||
tbl_il_5 db 1,2,2,2,2,0
|
||
tbl_il_m2 db 1,2,2,2,3,2,0
|
||
tbl_il_m2e db 1,2,2,2,3,2,3,0
|
||
;tbl_il_8 db 1,2,2,2,2,2,2,2,0
|
||
|
||
time dd 0
|
||
tim_ch db 0
|
||
pen_mode dd 0 ;०¨¬ à¨á®¢ ¨ï ¯à®¢®¤
|
||
pen_coord_x dd 0 ;ª®®à¤¨ â x ç «ì®© â®çª¨ à¨á®¢ ¨ï
|
||
pen_coord_y dd 0
|
||
|
||
txt_set_0 db '0',0
|
||
txt_set_1 db '1',0
|
||
;txt_mov_l db 27,0 ;<-
|
||
;txt_mov_r db 26,0 ;->
|
||
|
||
txt_size db 'size',0
|
||
txt_elements db 'elements',0
|
||
txt_points db 'points',0
|
||
txt_sub_points db 'subpoints',0
|
||
txt_captions db 'captions',0
|
||
|
||
;¬ âà¨æ ª®á¨ãᮢ ¨ á¨ãᮢ, ¨á¯®«ì§ã¥¬ ï ¤«ï ¯®¢®à®â®¢ ᨣ «®¢ ¨ í«¥¬¥â®¢
|
||
align 4
|
||
mcs dd 1, 0, 0, 1,\
|
||
0, 1,-1, 0,\
|
||
-1, 0, 0,-1,\
|
||
0,-1, 1, 0
|
||
|
||
run_file_70 FileInfoBlock
|
||
image_data dd 0 ;㪠§ â¥«ì ¢à¥¬¥ãî ¯ ¬ïâì. ¤«ï 㦥 ¯à¥®¡à §®¢ ¨ï ¨§®¡à ¦¥¨ï
|
||
|
||
IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
|
||
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*25
|
||
image_data_toolbar dd 0
|
||
|
||
TREE_ICON_SYS16_BMP_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*11+54 ;à §¬¥à bmp ä ©« á á¨á⥬묨 ¨ª®ª ¬¨
|
||
icon_tl_sys dd 0 ;㪠§ â¥«ì ¯ ¬ïâì ¤«ï åà ¥¨ï á¨á⥬ëå ¨ª®®ª
|
||
TOOLBAR_ICON_BMP_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*5+54 ;à §¬¥à bmp ä ©« á ¨ª®ª ¬¨ ®¡ê¥ªâ®¢
|
||
icon_toolbar dd 0 ;㪠§ â¥«ì ¯ ¬ïâì ¤«ï åà ¥¨ï ¨ª®®ª ®¡ê¥ªâ®¢
|
||
|
||
IMAGE_FONT_SIZE equ 128*144*3
|
||
image_data_gray dd 0 ;¯ ¬ïâì á ¢à¥¬¥ë¬¨ á¥à묨 ¨§®¡à ¦¥¨ï¬¨ ¢ ä®à¬ ⥠24-bit, ¨§ ª®â®àëå ¡ã¤ãâ ᮧ¤ ¢ âìáï âà ä à¥âë
|
||
|
||
cursors_count equ 4
|
||
IMAGE_CURSORS_SIZE equ 4096*cursors_count ;à §¬¥à ª à⨪¨ á ªãàá®à ¬¨
|
||
|
||
macro load_image_file path,buf,size { ;¬ ªà®á ¤«ï § £à㧪¨ ¨§®¡à ¦¥¨©
|
||
;path - ¬®¦¥â ¡ëâì ¯¥à¥¬¥®© ¨«¨ áâப®¢ë¬ ¯ à ¬¥â஬
|
||
if path eqtype '' ;¯à®¢¥à塞 § ¤ «¨ áâப®© ¯ à ¬¥âà path
|
||
jmp @f
|
||
local .path_str
|
||
.path_str db path ;ä®à¬¨à㥬 «®ª «ìãî ¯¥à¥¬¥ãî
|
||
db 0
|
||
@@:
|
||
;32 - áâ ¤ àâë© ¤à¥á ¯® ª®â®à®¬ã ¤®«¦¥ ¡ëâì ¡ãä¥à á á¨áâ¥¬ë¬ ¯ã⥬
|
||
copy_path .path_str,[32],file_name,0x0
|
||
else
|
||
copy_path path,[32],file_name,0x0 ;ä®à¬¨à㥬 ¯®«ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ® ¢ ®¤®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
|
||
end if
|
||
|
||
stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥¨ï
|
||
mov [buf],eax
|
||
|
||
mov eax,70 ;70-ï äãªæ¨ï à ¡®â á ä ©« ¬¨
|
||
mov [run_file_70.Function], 0
|
||
mov [run_file_70.Position], 0
|
||
mov [run_file_70.Flags], 0
|
||
mov [run_file_70.Count], dword size
|
||
m2m [run_file_70.Buffer], [buf]
|
||
mov byte[run_file_70+20], 0
|
||
mov [run_file_70.FileName], file_name
|
||
mov ebx,run_file_70
|
||
int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥¨ï
|
||
cmp ebx,0xffffffff
|
||
je @f
|
||
;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥ë© ¡ãä¥à image_data
|
||
stdcall dword[img_decode], dword[buf],ebx,0
|
||
mov dword[image_data],eax
|
||
;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥¨¥ ª ä®à¬ âã rgb
|
||
stdcall dword[img_to_rgb2], dword[image_data],dword[buf]
|
||
;㤠«ï¥¬ ¢à¥¬¥ë© ¡ãä¥à image_data
|
||
stdcall dword[img_destroy], dword[image_data]
|
||
@@:
|
||
}
|
||
|
||
ini_name db 'log_el.ini',0 ;¨¬ï ä ©«
|
||
ini_sec_color db 'Colors',0
|
||
key_color_bkgnd db 'background',0
|
||
key_color_border db 'border',0
|
||
key_color_s0 db 's0',0
|
||
key_color_s1 db 's1',0
|
||
key_color_s2 db 's2',0
|
||
key_color_captions db 'captions',0
|
||
ini_sec_options db 'Options',0
|
||
key_opt_sign_moves db 'signal_moves',0
|
||
key_opt_fast_mode db 'fast_mode',0
|
||
|
||
align 4
|
||
start:
|
||
load_libraries l_libs_start,l_libs_end
|
||
;¯à®¢¥àª ᪮«ìª® ã¤ ç® § £ã§¨« áì ¡¨¡«¨®â¥ª
|
||
mov ebp,lib_7
|
||
cmp dword [ebp+ll_struc_size-4],0
|
||
jz @f
|
||
mcall -1 ;exit not correct
|
||
@@:
|
||
mcall 48,3,sc,sizeof.system_colors
|
||
mcall 40,0x27
|
||
|
||
;*** áç¨âë¢ ¨¥ áâ஥ª ¨§ *.ini ä ©«
|
||
copy_path ini_name,sys_path,file_name,0x0
|
||
|
||
stdcall dword[ini_get_color],file_name,ini_sec_color,key_color_bkgnd,ini_def_c_bkgnd
|
||
mov dword[buf_0.color],eax
|
||
stdcall dword[ini_get_color],file_name,ini_sec_color,key_color_border,ini_def_c_border
|
||
mov dword[color_border],eax
|
||
stdcall dword[ini_get_color],file_name,ini_sec_color,key_color_s0,color_s0
|
||
mov dword[shem_colors],eax
|
||
stdcall dword[ini_get_color],file_name,ini_sec_color,key_color_s1,color_s1
|
||
mov dword[shem_colors+4],eax
|
||
stdcall dword[ini_get_color],file_name,ini_sec_color,key_color_s2,color_s2
|
||
mov dword[shem_colors+8],eax
|
||
stdcall dword[ini_get_color],file_name,ini_sec_color,key_color_captions,[color_captions]
|
||
mov dword[color_captions],eax
|
||
|
||
mov ebx,el_opt_beg+el_offs_nam
|
||
mov ecx,(el_opt_beg.end-el_opt_beg)/size_el_opt ;ª®««¨ç¥á⢮ ⨯®¢ í«¥¬¥â®¢
|
||
cld
|
||
@@:
|
||
push ecx
|
||
stdcall dword[ini_get_color],file_name,ini_sec_color,ebx,[ebx+el_offs_col-el_offs_nam]
|
||
pop ecx
|
||
mov dword[ebx+el_offs_col-el_offs_nam],eax
|
||
add ebx,size_el_opt
|
||
loop @b
|
||
|
||
stdcall dword[ini_get_int],file_name,ini_sec_options,key_opt_sign_moves,[opt_sign_moves]
|
||
mov dword[opt_sign_moves],eax
|
||
stdcall dword[ini_get_int],file_name,ini_sec_options,key_opt_fast_mode,[opt_fast_mode]
|
||
mov dword[opt_fast_mode],eax
|
||
|
||
;*** ¯®¤£®â®¢ª ¤¨ «®£
|
||
stdcall [OpenDialog_Init],OpenDialog_data
|
||
stdcall [buf2d_create], buf_0 ;ᮧ¤ ¨¥ ¡ãä¥à
|
||
load_image_file 'toolbar.png', image_data_toolbar,IMAGE_TOOLBAR_SIZE
|
||
|
||
stdcall pole_init, pole
|
||
stdcall dword[tl_data_init], tree1
|
||
stdcall dword[tl_data_init], tree2
|
||
|
||
;á¨áâ¥¬ë¥ ¨ª®ª¨ 16*16 ¤«ï tree_list
|
||
load_image_file 'tl_sys_16.png', icon_tl_sys,TREE_ICON_SYS16_BMP_SIZE
|
||
;¥á«¨ ¨§®¡à ¦¥¨¥ ¥ ®âªàë«®áì, â® ¢ icon_tl_sys ¡ã¤ãâ
|
||
;¥ ¨¨æ¨ «¨§¨à®¢ ë¥ ¤ ë¥, ® ®è¨¡ª¨ ¥ ¡ã¤¥â, â. ª. ¡ãä¥à 㦮£® à §¬¥à
|
||
mov eax,dword[icon_tl_sys]
|
||
mov dword[tree1.data_img_sys],eax
|
||
mov dword[tree2.data_img_sys],eax
|
||
|
||
load_image_file 'objects.png', icon_toolbar,TOOLBAR_ICON_BMP_SIZE
|
||
mov eax,dword[icon_toolbar]
|
||
mov dword[tree1.data_img],eax
|
||
mov dword[tree2.data_img],eax
|
||
|
||
;*** § £à㧪 èà¨äâ
|
||
load_image_file 'font6x9.bmp', image_data_gray,IMAGE_FONT_SIZE
|
||
stdcall [buf2d_create_f_img], buf_font,[image_data_gray] ;ᮧ¤ ¥¬ ¡ãä¥à
|
||
stdcall mem.Free,[image_data_gray] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
|
||
|
||
stdcall [buf2d_conv_24_to_8], buf_font,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç®á⨠8 ¡¨â
|
||
stdcall [buf2d_convert_text_matrix], buf_font
|
||
|
||
;*** § £à㧪 ªãàá®à®¢
|
||
load_image_file 'cursors_gr.png',image_data_gray,IMAGE_CURSORS_SIZE
|
||
stdcall [buf2d_create_f_img], buf_curs_8,[image_data_gray] ;ᮧ¤ ¥¬ ¡ãä¥à
|
||
stdcall mem.Free,[image_data_gray] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
|
||
|
||
load_image_file 'cursors.png',image_data_gray, IMAGE_CURSORS_SIZE
|
||
stdcall [buf2d_create_f_img], buf_curs,[image_data_gray] ;ᮧ¤ ¥¬ ¡ãä¥à
|
||
stdcall mem.Free,[image_data_gray] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
|
||
|
||
stdcall [buf2d_conv_24_to_8], buf_curs_8,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç®á⨠8¡¨â
|
||
stdcall [buf2d_conv_24_to_32],buf_curs,buf_curs_8 ;¤¥« ¥¬ ¡ãä¥à rgba 32¡¨â
|
||
|
||
stdcall sign_init, 3000
|
||
mov eax,el_opt_beg+el_offs_nam
|
||
mov ecx,(el_opt_beg.end-el_opt_beg)/size_el_opt ;ª®««¨ç¥á⢮ ⨯®¢ í«¥¬¥â®¢
|
||
cld
|
||
@@:
|
||
stdcall [tl_node_add], eax, el_icon_elems shl 16, tree2
|
||
stdcall [tl_cur_next], tree2
|
||
add eax,size_el_opt
|
||
loop @b
|
||
stdcall [tl_cur_beg], tree2
|
||
|
||
;*** ãáâ ®¢ª ¢à¥¬¥¨ ¤«ï â ©¬¥à
|
||
mcall 26,9
|
||
mov [last_time],eax
|
||
|
||
align 4
|
||
red_win:
|
||
call draw_window
|
||
|
||
align 4
|
||
still:
|
||
mcall 26,9
|
||
mov ebx,[last_time]
|
||
add ebx,10 ;§ ¤¥à¦ª
|
||
cmp ebx,eax
|
||
jge @f
|
||
mov ebx,eax
|
||
@@:
|
||
sub ebx,eax
|
||
;cmp ebx,10 ;§ ¤¥à¦ª
|
||
;ja timer_funct
|
||
;test ebx,ebx
|
||
;jz timer_funct
|
||
mcall 23
|
||
cmp eax,0
|
||
je timer_funct
|
||
|
||
cmp al,1
|
||
jz red_win
|
||
cmp al,EV_KEY
|
||
jz key
|
||
cmp al,3
|
||
jz button
|
||
cmp al,EV_MOUSE
|
||
jne @f
|
||
call mouse
|
||
@@:
|
||
jmp still
|
||
|
||
align 4
|
||
timer_funct:
|
||
pushad
|
||
mcall 26,9
|
||
mov [last_time],eax
|
||
|
||
cmp byte[tim_ch],0
|
||
je @f
|
||
inc dword[time]
|
||
cmp dword[opt_fast_mode],0
|
||
jne .fast_m
|
||
call sign_move
|
||
stdcall [buf2d_draw], buf_0
|
||
mov eax,[time]
|
||
xor edx,edx
|
||
div dword[opt_sign_moves]
|
||
cmp edx,0 ;¯à®¢¥à塞 ªà â®áâì opt_sign_moves
|
||
jnz @f
|
||
call sign_from_elems
|
||
call sign_from_captions
|
||
jmp @f
|
||
.fast_m:
|
||
mov ecx,[opt_sign_moves]
|
||
cld
|
||
.cycle:
|
||
call sign_move
|
||
loop .cycle
|
||
call sign_from_elems
|
||
call sign_from_captions
|
||
stdcall [buf2d_draw], buf_0
|
||
@@:
|
||
|
||
popad
|
||
jmp still
|
||
|
||
align 4
|
||
mouse:
|
||
stdcall [tl_mouse], tree1
|
||
stdcall [tl_mouse], tree2
|
||
|
||
pushad
|
||
mcall 37,2 ; ¦ âë¥ ª®¯ª¨ ¬ëè¨
|
||
bt eax,0 ;«¥¢ ï ª®¯ª ¦ â ?
|
||
jc @f
|
||
bt eax,1 ;¯à ¢ ï ª®¯ª ¦ â ?
|
||
jc @f
|
||
xor eax,eax
|
||
mov [pen_coord_x],eax
|
||
mov [pen_coord_y],eax
|
||
jmp .end_buf_wnd
|
||
@@:
|
||
mov esi,eax
|
||
|
||
mcall 37,1 ;eax = (x shl 16) + y
|
||
cmp ax,word[buf_0.t]
|
||
jl .end_buf_wnd ;¥ ¯®¯ «¨ ¢ ®ª® ¡ãä¥à ¯® ®á¨ y
|
||
|
||
mov ebx,eax
|
||
shr ebx,16
|
||
cmp bx,word[buf_0.l]
|
||
jl .end_buf_wnd ;¥ ¯®¯ «¨ ¢ ®ª® ¡ãä¥à ¯® ®á¨ x
|
||
|
||
and eax,0xffff ;®áâ ¢«ï¥¬ ª®®à¤¨ âã y
|
||
sub ax,word[buf_0.t]
|
||
sub bx,word[buf_0.l]
|
||
;*** ¤¥«¥¨¥ zoom
|
||
movzx ecx,byte[zoom]
|
||
xor edx,edx
|
||
div ecx
|
||
xchg eax,ebx ;ebx ¤¥«¨¬ ecx
|
||
xor edx,edx
|
||
div ecx
|
||
|
||
sub eax,[Cor_x]
|
||
sub ebx,[Cor_y]
|
||
|
||
;*** ¯à®¢¥àª ¯®¯ ¤¥¨¥ ¢ á奬ã
|
||
bt eax,31
|
||
jc .end_buf_wnd
|
||
bt ebx,31
|
||
jc .end_buf_wnd
|
||
cmp eax,[shem_w]
|
||
jge .end_buf_wnd
|
||
cmp ebx,[shem_h]
|
||
jge .end_buf_wnd
|
||
|
||
cmp byte[pen_mode],0
|
||
jne .end_mode_0
|
||
bt esi,1
|
||
jc .end_mode_0
|
||
;०¨¬ ªãàá®à (¢ë¡®à í«¥¬¥â ¯à¨ ¦ ⨨)
|
||
stdcall element_is_click,eax,ebx
|
||
test eax,eax
|
||
jz .end_buf_wnd ;¯à¨ ¦ ⨨ ¥ ¯®¯ «¨ ¨ ®¤¨ ¨§ í«¥¬¥â®¢
|
||
stdcall [tl_node_get_data], tree1
|
||
pop ebx
|
||
cmp eax,ebx
|
||
je .end_buf_wnd ;¥á«¨ 㦥 ªãàá®à á⮨â â ¬ £¤¥ 㦮
|
||
|
||
stdcall [tl_cur_beg], tree1
|
||
.cycle0:
|
||
stdcall [tl_node_get_data], tree1
|
||
pop ebx
|
||
test ebx,ebx
|
||
jz .end_buf_wnd
|
||
cmp eax,ebx
|
||
je @f
|
||
stdcall [tl_cur_next], tree1
|
||
jmp .cycle0
|
||
@@:
|
||
stdcall [tl_draw], tree1
|
||
jmp .end_buf_wnd
|
||
.end_mode_0:
|
||
cmp byte[pen_mode],1
|
||
jne .end_mode_1
|
||
;०¨¬ à¨á®¢ ¨ï ¯à®¢®¤
|
||
cmp dword[pen_coord_x],0
|
||
jne @f
|
||
cmp dword[pen_coord_y],0
|
||
jne @f
|
||
mov [pen_coord_x],eax
|
||
mov [pen_coord_y],ebx
|
||
@@:
|
||
|
||
cmp dword[pen_coord_x],eax
|
||
je .beg_draw
|
||
cmp dword[pen_coord_y],ebx
|
||
je .beg_draw
|
||
|
||
mov ecx,eax
|
||
sub ecx,[pen_coord_x]
|
||
bt ecx,31
|
||
jnc @f
|
||
neg ecx
|
||
inc ecx
|
||
@@:
|
||
mov edx,ebx
|
||
sub edx,[pen_coord_y]
|
||
bt edx,31
|
||
jnc @f
|
||
neg edx
|
||
inc edx
|
||
@@:
|
||
cmp ecx,edx
|
||
jl @f
|
||
mov ebx,[pen_coord_y] ;¯à¨¢ï§ª ª ª®®à¤¨ ⥠y
|
||
jmp .beg_draw
|
||
@@:
|
||
mov eax,[pen_coord_x] ;¯à¨¢ï§ª ª ª®®à¤¨ ⥠x
|
||
|
||
.beg_draw:
|
||
bt esi,1
|
||
jc @f
|
||
stdcall pole_cell_creat, pole,eax,ebx,0
|
||
;¨ç¥£® ¥ ã¡à «®áì redraw_pole ¥ ¯®¤å®¤¨â, â. ª. ç¨áâ¨âì ¯®«¥ ¥ 㦮
|
||
stdcall pole_paint, pole
|
||
stdcall [buf2d_draw], buf_0
|
||
jmp .end_buf_wnd
|
||
@@:
|
||
stdcall pole_cell_delete, pole,eax,ebx
|
||
call redraw_pole
|
||
jmp .end_buf_wnd
|
||
.end_mode_1:
|
||
cmp byte[pen_mode],2
|
||
jne @f
|
||
;०¨¬ à¨á®¢ ¨ï ¨§®«ï樨 ¤«ï ¯à®¢®¤
|
||
bt esi,1
|
||
jc .mode_2_del
|
||
stdcall pole_cell_creat, pole,eax,ebx,2
|
||
jmp .mode_2_draw
|
||
.mode_2_del:
|
||
;áâ¨à ¨¥ ¨§®«ï樨
|
||
mov ecx,eax
|
||
stdcall pole_cell_find, pole,ecx,ebx
|
||
test eax,eax
|
||
jz .end_buf_wnd
|
||
stdcall pole_cell_creat, pole,ecx,ebx,0
|
||
.mode_2_draw:
|
||
stdcall pole_paint, pole
|
||
stdcall [buf2d_draw], buf_0
|
||
jmp .end_buf_wnd
|
||
@@:
|
||
cmp byte[pen_mode],3
|
||
jne @f
|
||
bt esi,1
|
||
jc @f
|
||
;०¨¬ áâ¨à ¨ï ¯à®¢®¤
|
||
stdcall pole_cell_delete, pole,eax,ebx
|
||
call redraw_pole
|
||
jmp .end_buf_wnd
|
||
@@:
|
||
cmp byte[pen_mode],4
|
||
jne @f
|
||
bt esi,1
|
||
jc .rotate
|
||
;०¨¬ ᮧ¤ ¨ï í«¥¬¥â®¢
|
||
stdcall shem_element_creat, eax,ebx
|
||
stdcall pole_paint, pole
|
||
stdcall [buf2d_draw], buf_0
|
||
jmp .end_buf_wnd
|
||
.rotate:
|
||
;¯®¢®à®â í«¥¬¥â®¢ 90 £à ¤ãᮢ
|
||
stdcall element_is_click,eax,ebx
|
||
test eax,eax
|
||
jz .end_buf_wnd
|
||
inc byte[eax+sp_offs_el_angle]
|
||
and byte[eax+sp_offs_el_angle],3 ;¤«ï ª®âà®«ï ¯¥à¥¯®«¥¨¥
|
||
call redraw_pole
|
||
jmp .end_buf_wnd
|
||
@@:
|
||
|
||
.end_buf_wnd:
|
||
if debug
|
||
stdcall but_test_pole, pole
|
||
end if
|
||
popad
|
||
ret
|
||
|
||
;output:
|
||
; eax - pointer to element data
|
||
align 4
|
||
proc element_is_click uses ebx ecx edx esi edi, coord_x:dword, coord_y:dword
|
||
stdcall dword[tl_node_poi_get_info],0,tree1
|
||
pop esi
|
||
@@:
|
||
cmp esi,0
|
||
je @f
|
||
cmp word[esi],el_icon_elems ;¯®«ã票¥ ç¥à¥§ esi ⨯ ¨ª®ª¨
|
||
jne .end_add_p1
|
||
stdcall [tl_node_poi_get_data], esi, tree1
|
||
pop ecx
|
||
|
||
movzx edx,byte[ecx+sp_offs_el_type]
|
||
imul edx,size_el_opt
|
||
add edx,el_opt_beg ; 室¨¬ ®¯æ¨î ᮠ᢮©á⢠¬¨ ¤ ®£® í«¥¬¥â
|
||
|
||
mov eax,[ecx] ;element coord x
|
||
mov ebx,[ecx+4] ;element coord y
|
||
movzx edi,byte[ecx+sp_offs_el_angle]
|
||
push edi
|
||
movzx edi,byte[edx+el_offs_box_y]
|
||
dec edi
|
||
push edi
|
||
movzx edi,byte[edx+el_offs_box_x]
|
||
dec edi
|
||
push edi
|
||
stdcall move_rotate_n90 ;,[edx+el_offs_box_x],[edx+el_offs_box_y],[ecx+sp_offs_el_angle]
|
||
;Rect(eax,ebx,[ecx],[ecx+4])
|
||
stdcall point_in_rect, [coord_x],[coord_y], eax,ebx,[ecx],[ecx+4]
|
||
test eax,eax
|
||
jz .end_add_p1
|
||
mov eax,ecx
|
||
jmp .end_f
|
||
.end_add_p1:
|
||
stdcall dword[tl_node_poi_get_next_info],esi,tree1
|
||
pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
|
||
jmp @b
|
||
@@:
|
||
xor eax,eax ;¥á«¨ ¥ 諨
|
||
.end_f:
|
||
ret
|
||
endp
|
||
|
||
;¯à®¢¥àª ¯®¯ ¤¥¨ï â®çª¨ ¢ ¯àאַ㣮«ì¨ª
|
||
;१ã«ìâ â:
|
||
; ¥á«¨ ¥ ¯®¯ ¤ ¥â â® eax=0
|
||
; ¥á«¨ ¯®¯ ¤ ¥â â® eax=1
|
||
align 4
|
||
proc point_in_rect uses ebx ecx, px:dword, py:dword, rx0:dword, ry0:dword, rx1:dword, ry1:dword
|
||
xor eax,eax
|
||
|
||
;¯à®¢¥àª ¯® ®á¨ x
|
||
mov ebx,[rx0]
|
||
mov ecx,[rx1]
|
||
cmp ebx,ecx
|
||
jle @f
|
||
xchg ebx,ecx
|
||
@@:
|
||
cmp ebx,[px]
|
||
jg .no_contains
|
||
cmp ecx,[px]
|
||
jl .no_contains
|
||
|
||
;¯à®¢¥àª ¯® ®á¨ y
|
||
mov ebx,[ry0]
|
||
mov ecx,[ry1]
|
||
cmp ebx,ecx
|
||
jle @f
|
||
xchg ebx,ecx
|
||
@@:
|
||
cmp ebx,[py]
|
||
jg .no_contains
|
||
cmp ecx,[py]
|
||
jl .no_contains
|
||
|
||
;¥á«¨ ¯®¯ «¨ â® eax=1
|
||
inc eax
|
||
;stdcall draw_scaled_rect, [rx0],[ry0],[rx1],[ry1], 0xffffff
|
||
;stdcall [buf2d_draw], buf_0
|
||
.no_contains:
|
||
ret
|
||
endp
|
||
|
||
align 4
|
||
draw_window:
|
||
pushad
|
||
mcall 12,1
|
||
|
||
; *** à¨á®¢ ¨¥ £« ¢®£® ®ª (¢ë¯®«ï¥âáï 1 à § ¯à¨ § ¯ã᪥) ***
|
||
xor eax,eax
|
||
mov ebx,(20 shl 16)+580
|
||
mov ecx,(20 shl 16)+415
|
||
mov edx,[sc.work]
|
||
or edx,(3 shl 24)+0x10000000+0x20000000
|
||
mov edi,caption
|
||
int 0x40
|
||
|
||
; *** ᮧ¤ ¨¥ ª®¯®ª ¯ ¥«ì ***
|
||
mov eax,8
|
||
mov ebx,(5 shl 16)+20
|
||
mov ecx,(panel_0_coord_top shl 16)+20
|
||
mov edx,3
|
||
mov esi,[sc.work_button]
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,4
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,5
|
||
int 0x40
|
||
|
||
add ebx,30 shl 16
|
||
mov edx,6 ;¯ã᪠| ®áâ ®¢ª
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,7
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,8
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,9
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,10
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,11
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,12
|
||
int 0x40
|
||
|
||
add ebx,30 shl 16
|
||
mov edx,13 ;æ¥â஢ª á奬ë
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,14
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,15
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,16 ;ᤢ¨£ áå¥¬ë ¢¢¥àå
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,17 ;ᤢ¨£ áå¥¬ë ¢¨§
|
||
int 0x40
|
||
|
||
; *** à¨á®¢ ¨¥ ¨ª®®ª ª®¯ª å ***
|
||
mov eax,7
|
||
mov ebx,[image_data_toolbar]
|
||
mov ecx,(16 shl 16)+16
|
||
mov edx,(7 shl 16)+panel_0_coord_top+2 ;icon new
|
||
int 0x40
|
||
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16) ;icon open
|
||
int 0x40
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16) ;icon save
|
||
int 0x40
|
||
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(30 shl 16) ;+
|
||
int 0x40
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16) ;-
|
||
int 0x40
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16) ;
|
||
int 0x40
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16) ;m
|
||
int 0x40
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16) ;m
|
||
int 0x40
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16) ;m
|
||
int 0x40
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16) ;m
|
||
int 0x40
|
||
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(30 shl 16) ;center
|
||
int 0x40
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16) ;m
|
||
int 0x40
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16) ;m
|
||
int 0x40
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16) ;m
|
||
int 0x40
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16) ;m
|
||
int 0x40
|
||
|
||
; *** à¨á®¢ ¨¥ ¡ãä¥à ***
|
||
stdcall [buf2d_draw], buf_0
|
||
mov dword[wScr1.all_redraw],1
|
||
stdcall [tl_draw], tree1
|
||
mov dword[wScr2.all_redraw],1
|
||
stdcall [tl_draw], tree2
|
||
stdcall pole_draw_pok, pole
|
||
|
||
; *** ᮧ¤ ¨¥ ª®¯®ª ãáâ ®¢ª¨ ᨣ «®¢ set_0 ¨ set_1 ***
|
||
mov eax,8
|
||
mov ebx,(5 shl 16)+20
|
||
mov ecx,(panel_1_coord_top shl 16)+20
|
||
mov edx,20
|
||
mov esi,[sc.work_button]
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,21
|
||
int 0x40
|
||
|
||
add ebx,30 shl 16
|
||
mov edx,22
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,23
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,24
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,25
|
||
int 0x40
|
||
|
||
mov eax,4 ;à¨á®¢ ¨¥ ⥪áâ
|
||
mov ebx,(10 shl 16)+panel_1_coord_top+5
|
||
mov ecx,[sc.work_text]
|
||
or ecx,0x80000000 ;or (1 shl 30)
|
||
mov edx,txt_set_0
|
||
;mov edi,[sc.work]
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,txt_set_1
|
||
int 0x40
|
||
|
||
; *** à¨á®¢ ¨¥ ¨ª®®ª ª®¯ª å ***
|
||
mov eax,7
|
||
mov ebx,[image_data_toolbar]
|
||
mov ecx,(16 shl 16)+16
|
||
mov edx,(62 shl 16)+panel_1_coord_top+2
|
||
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE*15
|
||
int 0x40
|
||
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16)
|
||
int 0x40
|
||
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16)
|
||
int 0x40
|
||
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16)
|
||
int 0x40
|
||
|
||
; *** ᮧ¤ ¨¥ ª®¯®ª à¨á®¢ ¨ï ¯à®¢®¤ ***
|
||
mov eax,8
|
||
mov ebx,(5 shl 16)+20
|
||
mov ecx,(panel_2_coord_top shl 16)+20
|
||
mov edx,30
|
||
mov esi,[sc.work_button]
|
||
int 0x40
|
||
|
||
add ebx,30 shl 16
|
||
mov edx,31
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,32
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,33
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,34
|
||
int 0x40
|
||
|
||
add ebx,25 shl 16
|
||
mov edx,35
|
||
int 0x40
|
||
|
||
; *** à¨á®¢ ¨¥ ¨ª®®ª ª®¯ª å ***
|
||
mov eax,7
|
||
mov ebx,[image_data_toolbar]
|
||
mov ecx,(16 shl 16)+16
|
||
mov edx,(7 shl 16)+panel_2_coord_top+2 ;¨ª®ª áâ५
|
||
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE*19
|
||
int 0x40
|
||
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(30 shl 16) ;icon - à¨á®¢ ¨¥ ¯à®¢®¤
|
||
int 0x40
|
||
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16) ;icon - à¨á®¢ ¨¥ ¯¥à¥á¥ç¥¨© ¯à®¢®¤®¢
|
||
int 0x40
|
||
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16) ;icon - à¨á®¢ ¨¥ «®£¨ç¥áª¨å í«¥¬¥â®¢
|
||
int 0x40
|
||
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16) ;icon - à¨á®¢ ¨¥ ¯®¤¯¨á¥©
|
||
int 0x40
|
||
|
||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||
add edx,(25 shl 16) ;icon - § â¨à çª
|
||
int 0x40
|
||
|
||
mcall 12,2
|
||
popad
|
||
ret
|
||
|
||
align 4
|
||
key:
|
||
mcall 2
|
||
stdcall [tl_key], dword tree1
|
||
stdcall [tl_key], dword tree2
|
||
jmp still
|
||
|
||
|
||
align 4
|
||
button:
|
||
mcall 17
|
||
cmp ah,3
|
||
jne @f
|
||
call but_new_file
|
||
@@:
|
||
cmp ah,4
|
||
jne @f
|
||
call but_open_file
|
||
@@:
|
||
cmp ah,5
|
||
jne @f
|
||
call but_save_file
|
||
@@:
|
||
cmp ah,6
|
||
jne @f
|
||
call but_run_stop
|
||
@@:
|
||
cmp ah,7
|
||
jne @f
|
||
call but_zoom_p
|
||
@@:
|
||
cmp ah,8
|
||
jne @f
|
||
call but_zoom_m
|
||
@@:
|
||
cmp ah,9
|
||
jne @f
|
||
call but_pole_left
|
||
@@:
|
||
cmp ah,10
|
||
jne @f
|
||
call but_pole_right
|
||
@@:
|
||
cmp ah,11
|
||
jne @f
|
||
call but_pole_up
|
||
@@:
|
||
cmp ah,12
|
||
jne @f
|
||
call but_pole_dn
|
||
@@:
|
||
cmp ah,13
|
||
jne @f
|
||
call but_center
|
||
@@:
|
||
|
||
;¯¥à¥¤¢¨¦¥¨¥ ¢á¥å ®¡ê¥ªâ®¢ á奬ë
|
||
cmp byte[tim_ch],0
|
||
jne .no_move
|
||
cmp ah,14
|
||
jne @f
|
||
stdcall pole_move_all, pole, -1, 0
|
||
call redraw_pole
|
||
@@:
|
||
cmp ah,15
|
||
jne @f
|
||
stdcall pole_move_all, pole, 1, 0
|
||
call redraw_pole
|
||
@@:
|
||
cmp ah,16 ;ᤢ¨£ áå¥¬ë ¢¢¥àå
|
||
jne @f
|
||
stdcall pole_move_all, pole, 0, -1
|
||
call redraw_pole
|
||
@@:
|
||
cmp ah,17 ;ᤢ¨£ áå¥¬ë ¢¨§
|
||
jne @f
|
||
stdcall pole_move_all, pole, 0, 1
|
||
call redraw_pole
|
||
@@:
|
||
.no_move:
|
||
|
||
cmp ah,20
|
||
jne @f
|
||
call but_set_0
|
||
@@:
|
||
cmp ah,21
|
||
jne @f
|
||
call but_set_1
|
||
@@:
|
||
cmp ah,22
|
||
jne @f
|
||
call but_mov_l
|
||
@@:
|
||
cmp ah,23
|
||
jne @f
|
||
call but_mov_r
|
||
@@:
|
||
cmp ah,24
|
||
jne @f
|
||
call but_mov_u
|
||
@@:
|
||
cmp ah,25
|
||
jne @f
|
||
call but_mov_d
|
||
@@:
|
||
cmp ah,30
|
||
jne @f
|
||
call but_set_none
|
||
@@:
|
||
cmp ah,31
|
||
jne @f
|
||
stdcall set_pen_mode,1,0,((9 shl 8)+9) shl 16 ;ãáâ ®¢ª ०¨¬ à¨á®¢ ¨ï ¯à®¢®¤
|
||
@@:
|
||
cmp ah,32
|
||
jne @f
|
||
stdcall set_pen_mode,2,1,((9 shl 8)+9) shl 16
|
||
@@:
|
||
cmp ah,33
|
||
jne @f
|
||
stdcall set_pen_mode,4,3,((9 shl 8)+9) shl 16 ;ãáâ ®¢ª ०¨¬ ᮧ¤ ¨ï í«¥¬¥â®¢
|
||
@@:
|
||
cmp ah,35
|
||
jne @f
|
||
stdcall set_pen_mode,3,2,((15 shl 8)+9) shl 16 ;ãáâ ®¢ª ०¨¬ áâ¨à ¨ï ¯à®¢®¤
|
||
@@:
|
||
cmp ah,1
|
||
jne still
|
||
.exit:
|
||
stdcall [buf2d_delete],buf_0
|
||
stdcall [buf2d_delete],buf_font
|
||
stdcall [buf2d_delete],buf_curs
|
||
stdcall mem.Free,[image_data_toolbar]
|
||
stdcall pole_delete, pole
|
||
call sign_delete
|
||
stdcall [tl_data_clear], tree1
|
||
;ç¨á⨬ 㪠§ ⥫¨ ¨§®¡à ¦¥¨ï, ª®â®àë¥ ¡ë«¨ ®¡é¨¬¨ ¤«ï «¨á⮢ ¨ 㤠«¥ë «¨á⮬ tree1
|
||
mov dword[tree2.data_img_sys],0
|
||
mov dword[tree2.data_img],0
|
||
stdcall [tl_data_clear], tree2
|
||
cmp [cursor_pointer],0
|
||
je @f
|
||
mcall 37,6,[cursor_pointer]
|
||
@@:
|
||
mcall -1
|
||
|
||
;ᮧ¤ ¨¥ ®¢®© á奬ë
|
||
align 4
|
||
proc but_new_file uses eax
|
||
call but_set_none
|
||
stdcall [tl_info_clear],tree1
|
||
stdcall [tl_draw],tree1
|
||
xor eax,eax
|
||
mov [shem_elems],eax
|
||
mov [shem_captions],eax
|
||
stdcall pole_clear, pole
|
||
call redraw_pole
|
||
ret
|
||
endp
|
||
|
||
align 4
|
||
f_size dd 0 ;à §¬¥à ®âªàë¢ ¥¬®£® ä ©«
|
||
shem_w dd 192 ;è¨à¨ á奬ë
|
||
shem_h dd 128 ;¢ëá®â á奬ë
|
||
shem_points dd 0 ;ª®««¨ç¥á⢮ 㧫®¢ á奬¥
|
||
shem_sub_points dd 0 ;ª®««¨ç¥á⢮ ¨§®«¨à®¢ ëå 㧫®¢ á奬¥
|
||
shem_elems dd 0 ;ª®««¨ç¥á⢮ í«¥¬¥â®¢ á奬¥
|
||
shem_captions dd 0
|
||
shem_colors:
|
||
dd color_s0, color_s1, color_s2, color_s3
|
||
color_captions dd 0x808080
|
||
|
||
align 4
|
||
open_file_lif:
|
||
rb 2*4096 ;®¡« áâì ¤«ï ®âªàëâ¨ï ä ©«®¢
|
||
.end:
|
||
|
||
align 4
|
||
but_open_file:
|
||
pushad
|
||
copy_path open_dialog_name,communication_area_default_path,file_name,0
|
||
mov [OpenDialog_data.type],0
|
||
stdcall [OpenDialog_Start],OpenDialog_data
|
||
cmp [OpenDialog_data.status],1 ;0 - Cancel 1 - Open 2 - Error open dialog
|
||
jne .end_open_file
|
||
;ª®¤ ¯à¨ 㤠箬 ®âªàë⨨ ¤¨ «®£
|
||
|
||
mov eax,70 ;70-ï äãªæ¨ï à ¡®â á ä ©« ¬¨
|
||
mov [run_file_70.Function], 0
|
||
mov [run_file_70.Position], 0
|
||
mov [run_file_70.Flags], 0
|
||
mov dword[run_file_70.Count], open_file_lif.end-open_file_lif
|
||
m2m [run_file_70.Buffer], open_file_lif
|
||
mov byte[run_file_70+20], 0
|
||
mov dword[run_file_70.FileName], openfile_path
|
||
mov ebx,run_file_70
|
||
int 0x40 ;§ £à㦠¥¬ ä ©«
|
||
cmp ebx,0xffffffff
|
||
je .end_open_file
|
||
|
||
mov dword[f_size],ebx
|
||
add ebx,open_file_lif
|
||
mov byte[ebx],0 ; á«ãç © ¥á«¨ à ¥¥ ¡ë« ®âªàëâ ä ©« ¡®«ì襣® à §¬¥à ç¨á⨬ ª®¥æ ¡ãä¥à á ä ©«®¬
|
||
mcall 71,1,openfile_path
|
||
;---
|
||
|
||
;§ ¤ ¥¬ ¬¨¨¬ «ìë¥ § 票ï, á«ãç © ¥á«¨ ¢ ä ©«¥ ¡ã¤ãâ ¥ª®à¥ªâë¥ à §¬¥àë
|
||
mov dword[shem_w],5
|
||
mov dword[shem_h],5
|
||
|
||
mov esi,txt_size
|
||
call str_analiz_r
|
||
cmp edi,0
|
||
je @f
|
||
stdcall str_len,esi
|
||
add edi,eax
|
||
stdcall conv_str_to_int,edi
|
||
cmp eax,5
|
||
jl @f ;®è¨¡ª ¢ ä ©«¥ ( .end_open_file ¥ ¯¥à¥å®¤¨¬, ¯ëâ ¥¬áï ¯à®ç¨â âì ¤àã£ãî ¨ä®à¬ æ¨î)
|
||
mov dword[shem_w],eax
|
||
|
||
call str_next_val
|
||
stdcall conv_str_to_int,edi
|
||
cmp eax,5
|
||
jl @f ;®è¨¡ª ¢ ä ©«¥
|
||
mov dword[shem_h],eax
|
||
@@:
|
||
|
||
stdcall [tl_info_clear],tree1
|
||
|
||
;*** ¤®¡ ¢«¥¨¥ ¢ ᯨ᮪ «®£¨ç¥áª¨å í«¥¬¥â®¢ ***
|
||
stdcall [tl_node_add], txt_elements-capt_offs,(el_icon_group shl 16), tree1
|
||
stdcall [tl_cur_next], tree1
|
||
|
||
mov esi,txt_elements
|
||
call str_analiz_r
|
||
cmp edi,0
|
||
je .end_elems
|
||
stdcall str_len,esi
|
||
add edi,eax
|
||
stdcall conv_str_to_int,edi
|
||
cmp eax,0
|
||
jle .end_elems ;¥á«¨ ç¨á«® í«¥¬¥â®¢ = 0
|
||
mov [shem_elems],eax
|
||
mov ecx,eax
|
||
.cycle_elem:
|
||
call str_next_val
|
||
stdcall conv_str_to_int,edi
|
||
mov dword[txt_buf],eax ;ª®®à¤¨ â x
|
||
call str_next_val
|
||
stdcall conv_str_to_int,edi
|
||
mov dword[txt_buf+4],eax ;ª®®à¤¨ â y
|
||
call str_next_val
|
||
stdcall conv_str_to_int,edi
|
||
mov byte[txt_buf+sp_offs_el_angle],al ; ¯à ¢«¥¨¥
|
||
call str_next_val
|
||
;¯® ¤à¥áã edi §¢ ¨¥ í«¥¬¥â
|
||
stdcall el_get_name, edi,13 ;13 - ascii code
|
||
mov byte[txt_buf+sp_offs_el_type],al ;⨯ í«¥¬¥â
|
||
|
||
stdcall make_list_capts,txt_buf,edi
|
||
|
||
stdcall [tl_node_add], txt_buf,(el_icon_elems shl 16)+1, tree1
|
||
stdcall [tl_cur_next], tree1
|
||
dec ecx
|
||
jnz .cycle_elem
|
||
.end_elems:
|
||
|
||
;*** ¤®¡ ¢«¥¨¥ ¢ ᯨ᮪ ⥪á⮢ëå ¯®¤¯¨á¥© ***
|
||
stdcall [tl_node_add], txt_captions-capt_offs,(el_icon_group shl 16), tree1
|
||
stdcall [tl_cur_next], tree1
|
||
|
||
mov esi,txt_captions
|
||
call str_analiz_r
|
||
cmp edi,0
|
||
je .end_captions
|
||
stdcall str_len,esi
|
||
add edi,eax
|
||
stdcall conv_str_to_int,edi
|
||
cmp eax,0
|
||
jle .end_captions ;¥á«¨ ç¨á«® ¯®¤¯¨á¥© = 0
|
||
mov [shem_captions],eax
|
||
mov ecx,eax
|
||
.cycle_captions:
|
||
call str_next_val
|
||
stdcall conv_str_to_int,edi
|
||
mov dword[txt_buf],eax ;ª®®à¤¨ â x
|
||
call str_next_val
|
||
stdcall conv_str_to_int,edi
|
||
mov dword[txt_buf+4],eax ;ª®®à¤¨ â y
|
||
call str_next_val
|
||
mov al,byte[edi]
|
||
mov byte[txt_buf+8],al ;¢¨¤ ¯®¤¯¨á¨ ('z' - ᨣ « á 0, 'o' - ᨣ « á 1, 'n' - ¥â ᨣ « )
|
||
call str_next_val
|
||
|
||
stdcall make_list_capts,txt_buf,edi
|
||
|
||
stdcall [tl_node_add], txt_buf,(el_icon_captions shl 16)+1, tree1
|
||
stdcall [tl_cur_next], tree1
|
||
dec ecx
|
||
jnz .cycle_captions
|
||
.end_captions:
|
||
|
||
mov byte[txt_buf+capt_offs],0 ;®¡ã«¥¨¥ ¯®¤¯¨á¥©
|
||
|
||
;*** ¤®¡ ¢«¥¨¥ ¢ ᯨ᮪ ª«î祢ëå â®ç¥ª ***
|
||
stdcall [tl_node_add], txt_points-capt_offs,(el_icon_group shl 16), tree1
|
||
stdcall [tl_cur_next], tree1
|
||
|
||
mov dword[shem_points],0
|
||
mov esi,txt_points
|
||
call str_analiz_r
|
||
cmp edi,0
|
||
je .end_points ;¥á«¨ ®¯¨á ¨ï â®ç¥ª ¥â ¢ ä ©«¥
|
||
stdcall str_len,esi
|
||
add edi,eax
|
||
stdcall conv_str_to_int,edi
|
||
cmp eax,0
|
||
jle .end_points ;¥á«¨ ç¨á«® â®ç¥ª = 0
|
||
mov [shem_points],eax
|
||
mov ecx,eax
|
||
.cycle_poi:
|
||
call str_next_val
|
||
stdcall conv_str_to_int,edi
|
||
mov dword[txt_buf],eax ;ª®®à¤¨ â x
|
||
call str_next_val
|
||
stdcall conv_str_to_int,edi
|
||
mov dword[txt_buf+4],eax ;ª®®à¤¨ â y
|
||
call str_next_val
|
||
stdcall conv_str_to_int,edi
|
||
mov byte[txt_buf+8],al ; ¯à ¢«¥¨ï
|
||
|
||
; stdcall make_list_capts,txt_buf,0
|
||
|
||
stdcall [tl_node_add], txt_buf,(el_icon_points shl 16)+1, tree1
|
||
stdcall [tl_cur_next], tree1
|
||
dec ecx
|
||
jnz .cycle_poi
|
||
.end_points:
|
||
|
||
stdcall [tl_cur_beg], tree1
|
||
|
||
;*** ¤®¡ ¢«¥¨¥ â®ç¥çëå ®¡ê¥ªâ®¢ ***
|
||
stdcall pole_clear, pole
|
||
stdcall dword[tl_node_poi_get_info],0,tree1
|
||
pop esi
|
||
@@:
|
||
cmp esi,0
|
||
je @f
|
||
cmp word[esi],el_icon_points ;¯®«ã票¥ ç¥à¥§ esi ⨯ ¨ª®ª¨, ¨ ¯à®¯ã᪠¥ â®ç¥çëå ®¡ê¥ªâ®¢
|
||
jne .end_add_p0
|
||
stdcall [tl_node_poi_get_data], esi, tree1
|
||
pop eax
|
||
stdcall pole_cell_creat, pole,dword[eax],dword[eax+4],0
|
||
.end_add_p0:
|
||
stdcall dword[tl_node_poi_get_next_info],esi,tree1
|
||
pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
|
||
jmp @b
|
||
@@:
|
||
stdcall pole_sort, pole
|
||
|
||
;*** ¤®¡ ¢«¥¨¥ â®ç¥çëå ®¡ê¥ªâ®¢ ( ®á®¢¥ «®£¨ç¥áª¨å í«¥¬¥â®¢) ***
|
||
stdcall dword[tl_node_poi_get_info],0,tree1
|
||
pop esi
|
||
@@:
|
||
cmp esi,0
|
||
je @f
|
||
cmp word[esi],el_icon_elems ;¯®«ã票¥ ç¥à¥§ esi ⨯ ¨ª®ª¨
|
||
jne .end_add_p3
|
||
stdcall [tl_node_poi_get_data], esi, tree1
|
||
pop ecx
|
||
|
||
xor edx,edx ;edx - ®¬¥à ¢å®¤®© ®£¨
|
||
.add_p1:
|
||
stdcall el_get_leg_coords, ecx,edx
|
||
test eax,eax
|
||
jnz .add_beg1
|
||
test ebx,ebx
|
||
jnz .add_beg1
|
||
jmp .end_add_p1 ;¥á«¨ ª®®à¤¨ âë ¥ ¢§ï«¨áì (eax=0 && ebx=0), ¢ë室 ¨§ 横«
|
||
.add_beg1:
|
||
stdcall pole_cell_creat, pole,eax,ebx,0
|
||
inc edx
|
||
jmp .add_p1
|
||
.end_add_p1:
|
||
|
||
mov edx,(1 shl 16) ;edx - ®¬¥à ¢ë室®© ®£¨
|
||
.add_p2:
|
||
stdcall el_get_leg_coords, ecx,edx
|
||
test eax,eax
|
||
jnz .add_beg2
|
||
test ebx,ebx
|
||
jnz .add_beg2
|
||
jmp .end_add_p2 ;¥á«¨ ª®®à¤¨ âë ¥ ¢§ï«¨áì (eax=0 && ebx=0), ¢ë室 ¨§ 横«
|
||
.add_beg2:
|
||
stdcall pole_cell_creat, pole,eax,ebx,0
|
||
inc edx
|
||
jmp .add_p2
|
||
.end_add_p2:
|
||
|
||
.end_add_p3:
|
||
stdcall dword[tl_node_poi_get_next_info],esi,tree1
|
||
pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
|
||
jmp @b
|
||
@@:
|
||
stdcall pole_sort, pole
|
||
|
||
;*** ¤®¡ ¢«¥¨¥ â®ç¥çëå ®¡ê¥ªâ®¢ ( ®á®¢¥ ¯®¤¯¨á¥©) ***
|
||
stdcall dword[tl_node_poi_get_info],0,tree1
|
||
pop esi
|
||
@@:
|
||
cmp esi,0
|
||
je @f
|
||
cmp word[esi],el_icon_captions ;¯®«ã票¥ ç¥à¥§ esi ⨯ ¨ª®ª¨
|
||
jne .end_add_p6
|
||
stdcall [tl_node_poi_get_data], esi, tree1
|
||
pop ecx
|
||
cmp byte[ecx+8],'n'
|
||
je .end_add_p6
|
||
stdcall pole_cell_creat, pole,[ecx],[ecx+4],0
|
||
.end_add_p6:
|
||
stdcall dword[tl_node_poi_get_next_info],esi,tree1
|
||
pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
|
||
jmp @b
|
||
@@:
|
||
stdcall pole_sort, pole
|
||
|
||
;*** à¨á®¢ ¨¥ ¯à®¢®¤®¢ ( ®á®¢¥ â®ç¥çëå ®¡ê¥ªâ®¢) ***
|
||
stdcall dword[tl_node_poi_get_info],0,tree1
|
||
pop esi
|
||
xor ecx,ecx
|
||
@@:
|
||
cmp esi,0
|
||
je @f
|
||
cmp word[esi],el_icon_points ;¯®«ã票¥ ç¥à¥§ esi ⨯ ¨ª®ª¨, ¨ ¯à®¯ã᪠¥ â®ç¥çëå ®¡ê¥ªâ®¢
|
||
jne .end_add_p4
|
||
stdcall [tl_node_poi_get_data], esi, tree1
|
||
pop eax
|
||
movzx ebx,byte[eax+8]
|
||
stdcall shem_create_line, dword[eax],dword[eax+4],ebx
|
||
add ecx,edx
|
||
.end_add_p4:
|
||
stdcall dword[tl_node_poi_get_next_info],esi,tree1
|
||
pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
|
||
cmp ecx,250 ;ecx - ç¨á«® ¤®¡ ¢«¥ëå â®ç¥ª
|
||
jl @b
|
||
xor ecx,ecx
|
||
stdcall pole_sort, pole ;á®àâ¨à㥬 ¤«ï ®¯â¨¬¨§ 樨 ¡ëáâத¥©á⢨ï
|
||
jmp @b
|
||
@@:
|
||
stdcall pole_sort, pole
|
||
|
||
stdcall pole_reset_cells, pole ;ç¨á⪠¯à®¢®¤®¢
|
||
|
||
;*** ¤®¡ ¢«¥¨¥ ¨§®«ï樮ëå ®¡ê¥ªâ®¢ (¯àאַ ¨§ ä ©« , ¬¨ãï § ¯¨áì ¢ ᯨ᮪) ***
|
||
mov dword[shem_sub_points],0
|
||
mov esi,txt_sub_points
|
||
call str_analiz_r
|
||
cmp edi,0
|
||
je .end_sub_points ;¥á«¨ ®¯¨á ¨ï â®ç¥ª ¥â ¢ ä ©«¥
|
||
stdcall str_len,esi
|
||
add edi,eax
|
||
stdcall conv_str_to_int,edi
|
||
cmp eax,0
|
||
jle .end_sub_points ;¥á«¨ ç¨á«® â®ç¥ª = 0
|
||
mov [shem_sub_points],eax
|
||
mov ecx,eax
|
||
.cycle_sub_poi:
|
||
call str_next_val
|
||
stdcall conv_str_to_int,edi
|
||
mov ebx,eax ;ª®®à¤¨ â x
|
||
call str_next_val
|
||
stdcall conv_str_to_int,edi ;ª®®à¤¨ â y
|
||
stdcall pole_cell_creat, pole,ebx,eax,2
|
||
|
||
dec ecx
|
||
jnz .cycle_sub_poi
|
||
.end_sub_points:
|
||
|
||
stdcall pole_sort, pole
|
||
|
||
;*** 㤠«¥¨¥ ª«î祢ëå â®ç¥ª ᮠᯨ᪠***
|
||
mov ecx,[shem_points]
|
||
inc ecx
|
||
cld
|
||
@@:
|
||
stdcall [tl_info_undo],tree1
|
||
loop @b
|
||
|
||
;*** ä®à¬¨à®¢ ¨¥ ¯®¤¯¨á¥© ® ¯ à ¬¥âà å á奬ë ***
|
||
mov dword[txt_info.size],0
|
||
mov eax,dword[shem_w]
|
||
mov edi,txt_info.size
|
||
call convert_int_to_str
|
||
stdcall str_cat, edi,txt_mull
|
||
mov eax,dword[shem_h]
|
||
mov edi,txt_buf
|
||
call convert_int_to_str
|
||
stdcall str_cat, txt_info.size,edi
|
||
stdcall str_cat, txt_info.size,txt_space ;§ ¢¥àè î騩 ¯à®¡¥«
|
||
|
||
;---
|
||
call but_center ;æ¥â஢ª á奬ë á ãç¥â®¬ shem_w ¨ shem_h
|
||
call but_set_none
|
||
.end_open_file:
|
||
popad
|
||
ret
|
||
|
||
align 4
|
||
proc but_save_file
|
||
locals
|
||
napr dd ?
|
||
s_param dd ? ;¯ à ¬¥âà ¤«ï ªà ᨢ®£® á®åà ¥¨ï
|
||
endl
|
||
pushad
|
||
;*** ¢ë§®¢ ¤¨ «®£®¢®£® ®ª ¤«ï á®åà ¥¨ï ä ©«
|
||
copy_path open_dialog_name,communication_area_default_path,file_name,0
|
||
mov [OpenDialog_data.type],1
|
||
stdcall [OpenDialog_Start],OpenDialog_data
|
||
cmp [OpenDialog_data.status],1 ;if status==1 then save
|
||
jne .end_save_file
|
||
|
||
;*** ¯à®¢¥àª ¥áâì «¨ ¯à®¢®¤ á奬¥
|
||
mov edi,pole
|
||
mov esi,pole_index
|
||
cmp dword[esi],0
|
||
je .cycle1_beg ;.end_save_file ;¥á«¨ ¥â ï祥ª (¯à®¢®¤®¢) â® ¢ë室
|
||
|
||
;*** ãáâ ¢«¨¢ ¥¬ ¬¥âª¨ ª«îç¥¢ë¥ â®çª¨, ª®â®àë¥ ¡ã¤ãâ á®åà ¥ë ¢ ä ©«
|
||
mov dword[shem_points],0 ;¤«ï ¯¥à¥®¯à¥¤¥«¥¨ï â®ç¥ª
|
||
mov dword[shem_sub_points],0
|
||
mov ecx,dword[esi]
|
||
.cycle0: ;横« ¯® ¢á¥¬ â®çª ¬
|
||
add esi,4
|
||
mov ebx,[esi]
|
||
imul ebx,sizeof.Cell
|
||
add ebx,pole_data
|
||
|
||
cmp byte[ebx+offs_cell_liv],2
|
||
jne @f
|
||
inc dword[shem_sub_points]
|
||
jmp .cycle0_next
|
||
@@:
|
||
|
||
mov dword[napr],0
|
||
|
||
mov edx,[ebx+offs_cell_y]
|
||
push edx
|
||
mov edx,[ebx+offs_cell_x]
|
||
inc edx
|
||
push edx
|
||
stdcall pole_cell_find, edi
|
||
cmp eax,0
|
||
je @f
|
||
or dword[napr],1
|
||
@@:
|
||
|
||
mov edx,[ebx+offs_cell_y]
|
||
inc edx
|
||
push edx
|
||
mov edx,[ebx+offs_cell_x]
|
||
push edx
|
||
stdcall pole_cell_find, edi
|
||
cmp eax,0
|
||
je @f
|
||
or dword[napr],2
|
||
@@:
|
||
|
||
mov edx,[ebx+offs_cell_y]
|
||
push edx
|
||
mov edx,[ebx+offs_cell_x]
|
||
dec edx
|
||
push edx
|
||
stdcall pole_cell_find, edi
|
||
cmp eax,0
|
||
je @f
|
||
or dword[napr],4
|
||
@@:
|
||
|
||
mov edx,[ebx+offs_cell_y]
|
||
dec edx
|
||
push edx
|
||
mov edx,[ebx+offs_cell_x]
|
||
push edx
|
||
stdcall pole_cell_find, edi
|
||
cmp eax,0
|
||
je @f
|
||
or dword[napr],8
|
||
@@:
|
||
|
||
cmp dword[napr],5
|
||
je @f
|
||
cmp dword[napr],10
|
||
je @f
|
||
cmp dword[napr],15
|
||
je @f
|
||
mov eax,dword[napr]
|
||
mov byte[ebx+offs_cell_liv],3 ;ãáâ ®¢ª ¬¥âª¨
|
||
mov byte[ebx+offs_cell_napr],al ;ãáâ ®¢ª ¯à ¢«¥¨©
|
||
inc dword[shem_points]
|
||
@@:
|
||
.cycle0_next:
|
||
dec ecx
|
||
jnz .cycle0
|
||
|
||
;*** áï⨥ ¬¥âª¨ á â®ç¥ª, ª®â®àë¥ å®¤ïâáï ¢å®¤ëå ®£ å «®£¨ç¥áª¨å í«¥¬¥â®¢
|
||
.cycle1_beg:
|
||
mov dword[shem_elems],0 ;¤«ï ¯¥¯¥®¯à¥¤¥«¥¨ï ç¨á« í«¥¬¥â®¢
|
||
stdcall dword[tl_node_poi_get_info],0,tree1
|
||
pop esi
|
||
.cycle1:
|
||
cmp esi,0
|
||
je .cycle1_end
|
||
cmp word[esi],el_icon_elems ;¯®«ã票¥ ç¥à¥§ esi ⨯ ¨ª®ª¨
|
||
jne .end_add_p1
|
||
; stdcall [tl_node_poi_get_data], esi, tree1
|
||
; pop ecx
|
||
inc dword[shem_elems]
|
||
if 0
|
||
xor edx,edx ;edx - ®¬¥à ¢å®¤®© ®£¨
|
||
@@:
|
||
stdcall el_get_leg_coords, ecx,edx
|
||
test eax,eax
|
||
jz @f ;¥á«¨ ª®®à¤¨ âë ¥ ¢§ï«¨áì (eax=0 && ebx=0)
|
||
test ebx,ebx
|
||
jz @f ;¥á«¨ ª®®à¤¨ âë ¥ ¢§ï«¨áì (eax=0 && ebx=0)
|
||
stdcall pole_cell_find, edi,eax,ebx
|
||
test eax,eax
|
||
jz .no_erase
|
||
get_cell_offset ebx,eax
|
||
mov byte[ebx+offs_cell_liv],0 ;áï⨥ ¬¥âª¨
|
||
dec dword[shem_points]
|
||
.no_erase:
|
||
inc edx
|
||
jmp @b
|
||
@@:
|
||
;mov edx,(1 shl 16) ;edx - ®¬¥à ¢ë室®© ®£¨
|
||
end if
|
||
.end_add_p1:
|
||
stdcall dword[tl_node_poi_get_next_info],esi,tree1
|
||
pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
|
||
jmp .cycle1
|
||
.cycle1_end:
|
||
|
||
;*** ᮧ¤ ¨¥ ¨ä®à¬ 樨 ¤«ï § ¯¨á¨ ¢ ä ©« ***
|
||
mov edi,open_file_lif
|
||
stdcall mem_copy,edi,txt_size,5
|
||
stdcall str_cat,edi,txt_space
|
||
mov eax,dword[shem_w]
|
||
add edi,5
|
||
stdcall convert_int_to_str
|
||
stdcall str_cat,edi,txt_space
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
mov eax,[shem_h]
|
||
stdcall convert_int_to_str
|
||
stdcall str_cat,edi,txt_nl
|
||
|
||
;*** á®åà ¥¨¥ «®£¨ç¥áª¨å í«¥¬¥â®¢ ***
|
||
stdcall str_cat,edi,txt_elements
|
||
stdcall str_cat,edi,txt_space
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
mov eax,[shem_elems]
|
||
stdcall convert_int_to_str
|
||
stdcall str_cat,edi,txt_nl
|
||
|
||
cmp eax,1
|
||
jl .cycle2_end
|
||
stdcall dword[tl_node_poi_get_info],0,tree1
|
||
pop esi
|
||
.cycle2:
|
||
cmp esi,0
|
||
je .cycle2_end
|
||
cmp word[esi],el_icon_elems ;¯®«ã票¥ ç¥à¥§ esi ⨯ ¨ª®ª¨
|
||
jne .end_add_p2
|
||
stdcall [tl_node_poi_get_data], esi, tree1
|
||
pop ecx
|
||
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
mov eax,[ecx] ;coord x
|
||
stdcall convert_int_to_str
|
||
stdcall str_cat,edi,txt_space
|
||
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
mov eax,[ecx+4] ;coord y
|
||
stdcall convert_int_to_str
|
||
stdcall str_cat,edi,txt_space
|
||
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
movzx eax,byte[ecx+sp_offs_el_angle] ;angle
|
||
stdcall convert_int_to_str
|
||
stdcall str_cat,edi,txt_space
|
||
|
||
;¨¬ï í«¥¬¥â
|
||
movzx eax,byte[ecx+sp_offs_el_type]
|
||
imul eax,size_el_opt
|
||
add eax,el_opt_beg+el_offs_nam
|
||
stdcall str_cat,edi,eax
|
||
|
||
stdcall str_cat,edi,txt_nl
|
||
|
||
.end_add_p2:
|
||
stdcall dword[tl_node_poi_get_next_info],esi,tree1
|
||
pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
|
||
jmp .cycle2
|
||
.cycle2_end:
|
||
|
||
;*** á®åà ¥¨¥ ¯®¤¯¨á¥© ***
|
||
stdcall str_cat,edi,txt_captions
|
||
stdcall str_cat,edi,txt_space
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
mov eax,[shem_captions]
|
||
stdcall convert_int_to_str
|
||
stdcall str_cat,edi,txt_nl
|
||
|
||
cmp eax,1
|
||
jl .cycle3_end
|
||
stdcall dword[tl_node_poi_get_info],0,tree1
|
||
pop esi
|
||
.cycle3:
|
||
cmp esi,0
|
||
je .cycle3_end
|
||
cmp word[esi],el_icon_captions ;¯®«ã票¥ ç¥à¥§ esi ⨯ ¨ª®ª¨
|
||
jne .end_add_p3
|
||
stdcall [tl_node_poi_get_data], esi, tree1
|
||
pop ecx
|
||
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
mov eax,[ecx] ;coord x
|
||
stdcall convert_int_to_str
|
||
stdcall str_cat,edi,txt_space
|
||
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
mov eax,[ecx+4] ;coord y
|
||
stdcall convert_int_to_str
|
||
stdcall str_cat,edi,txt_space
|
||
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
movzx eax,byte[ecx+8] ;n,z,o
|
||
mov ah,' ' ;¯à®¡¥« ¯®á«¥ ¡ãª¢ë, çâ® ¡ë ¥ ¤®¡ ¢«ïâì txt_space
|
||
mov dword[edi],eax ;al
|
||
|
||
;¨¬ï í«¥¬¥â
|
||
mov ebx,edi
|
||
mov edi,ecx
|
||
add edi,capt_offs
|
||
call str_next_val
|
||
call str_next_val
|
||
;call str_next_val
|
||
xchg ebx,edi
|
||
stdcall str_cat,edi,ebx
|
||
|
||
stdcall str_cat,edi,txt_nl
|
||
|
||
.end_add_p3:
|
||
stdcall dword[tl_node_poi_get_next_info],esi,tree1
|
||
pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
|
||
jmp .cycle3
|
||
.cycle3_end:
|
||
|
||
;*** á®åà ¥¨¥ ª«î祢ëå â®ç¥ª ***
|
||
stdcall str_cat,edi,txt_points
|
||
stdcall str_cat,edi,txt_space
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
mov eax,[shem_points]
|
||
stdcall convert_int_to_str
|
||
stdcall str_cat,edi,txt_nl
|
||
|
||
mov eax,edi
|
||
mov edi,pole
|
||
mov esi,pole_index
|
||
cmp dword[esi],0
|
||
je .no_points ;¥á«¨ ¥â ï祥ª (¯à®¢®¤®¢) â® ¯à®¯ãáª
|
||
mov ebx,pole_data
|
||
mov dword[napr],ebx
|
||
mov edi,eax
|
||
|
||
mov ecx,dword[esi]
|
||
mov dword[s_param],0
|
||
.cycle4: ;横« ¯® ¢á¥¬ â®çª ¬
|
||
add esi,4
|
||
mov ebx,[esi]
|
||
imul ebx,sizeof.Cell
|
||
add ebx,dword[napr] ;pole_data
|
||
|
||
movzx edx,word[ebx+offs_cell_liv] ;also use offs_cell_napr
|
||
cmp dl,3
|
||
jne @f
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
mov eax,dword[ebx+offs_cell_x]
|
||
stdcall convert_int_to_str
|
||
stdcall str_cat,edi,txt_space
|
||
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
mov eax,dword[ebx+offs_cell_y]
|
||
stdcall convert_int_to_str
|
||
stdcall str_cat,edi,txt_space
|
||
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
movzx eax,dh
|
||
stdcall convert_int_to_str
|
||
|
||
cmp dword[s_param],7 ;¤«ï ä®à¬ â áâப¨
|
||
je .new_line
|
||
inc dword[s_param]
|
||
stdcall str_cat,edi,txt_space
|
||
jmp @f
|
||
.new_line:
|
||
mov dword[s_param],0
|
||
stdcall str_cat,edi,txt_nl
|
||
@@:
|
||
dec ecx
|
||
jnz .cycle4
|
||
cmp dword[s_param],0
|
||
je @f
|
||
stdcall str_cat,edi,txt_nl
|
||
@@:
|
||
|
||
;*** á®åà ¥¨¥ ¨§®«ï樮ëå â®ç¥ª ***
|
||
stdcall str_cat,edi,txt_sub_points
|
||
stdcall str_cat,edi,txt_space
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
mov eax,[shem_sub_points]
|
||
stdcall convert_int_to_str
|
||
stdcall str_cat,edi,txt_nl
|
||
|
||
mov eax,edi
|
||
mov edi,pole
|
||
mov esi,pole_index
|
||
;cmp dword[esi],0
|
||
;je .no_points ;¥á«¨ ¥â ï祥ª (¯à®¢®¤®¢) â® ¯à®¯ãáª
|
||
;mov ebx,pole_data
|
||
;mov dword[napr],ebx
|
||
mov edi,eax
|
||
|
||
mov ecx,dword[esi]
|
||
.cycle5: ;横« ¯® ¢á¥¬ â®çª ¬
|
||
add esi,4
|
||
mov ebx,[esi]
|
||
imul ebx,sizeof.Cell
|
||
add ebx,dword[napr] ;pole_data
|
||
|
||
movzx edx,byte[ebx+offs_cell_liv]
|
||
cmp dl,2
|
||
jne @f
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
mov eax,dword[ebx+offs_cell_x]
|
||
stdcall convert_int_to_str
|
||
stdcall str_cat,edi,txt_space
|
||
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
mov eax,dword[ebx+offs_cell_y]
|
||
stdcall convert_int_to_str
|
||
stdcall str_cat,edi,txt_space
|
||
|
||
;stdcall str_cat,edi,txt_nl
|
||
@@:
|
||
dec ecx
|
||
jnz .cycle5
|
||
stdcall str_cat,edi,txt_nl
|
||
|
||
.no_points:
|
||
|
||
;*** ®¯à¥¤¥«¥¨¥ ¯ à ¬¥â஢ ä ©«
|
||
mov edi,open_file_lif
|
||
stdcall str_len,edi
|
||
mov ecx,eax
|
||
|
||
;*** § ¯¨áì ä ©«
|
||
mov eax,70
|
||
mov [run_file_70.Function], 2
|
||
mov [run_file_70.Position], 0
|
||
mov [run_file_70.Flags], 0
|
||
mov dword[run_file_70.Count], ecx
|
||
mov [run_file_70.Buffer], edi
|
||
mov byte[run_file_70+20], 0
|
||
mov dword[run_file_70.FileName], openfile_path
|
||
mov ebx,run_file_70
|
||
int 0x40 ;á®åà 塞 ä ©«
|
||
|
||
call redraw_pole
|
||
.end_save_file:
|
||
popad
|
||
ret
|
||
endp
|
||
|
||
;ä®à¬¨à®¢ ¨¥ ¯®¤¯¨á¨ ¤«ï ᯨáª
|
||
align 4
|
||
proc make_list_capts uses eax ebx ecx edi, buf:dword, txt:dword
|
||
mov ebx,dword[buf]
|
||
|
||
mov edi,ebx
|
||
add edi,capt_offs
|
||
mov dword[edi],' ' ;¯à®¡¥«ë ¤«ï ¢ëà ¢¨¢ ¨ï ¬ «¥ìª¨å ç¨á¥«
|
||
|
||
mov eax,dword[ebx] ;+0 - offset coord x
|
||
cmp eax,100
|
||
jge @f
|
||
inc edi
|
||
@@:
|
||
cmp eax,10
|
||
jge @f
|
||
inc edi
|
||
@@:
|
||
call convert_int_to_str ;ª®®à¤¨ â x (¤«ï ¯®¤¯¨á¨)
|
||
stdcall str_cat,edi,txt_space
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
mov eax,dword[ebx+4] ;+4 - offset coord y
|
||
call convert_int_to_str ;ª®®à¤¨ â y (¤«ï ¯®¤¯¨á¨)
|
||
stdcall str_cat,edi,txt_space
|
||
|
||
mov edi,dword[txt]
|
||
cmp edi,0
|
||
je .end_f
|
||
stdcall str_len,edi ;eax = strlen([edi])
|
||
mov ecx,edi
|
||
call str_next_spaces
|
||
sub edi,ecx ;®¯à¥¤¥«ï¥¬ ¤«¨ã ¯®¤¯¨á¨
|
||
|
||
cmp edi,eax
|
||
jle @f
|
||
mov edi,eax ;¥á«¨ áâப § ª®ç¨« áì ¥ ¯à®¡¥«®¬
|
||
@@:
|
||
;cmp edi,1
|
||
;jge @f
|
||
; mov edi,1 ;¬¨¨¬ã¬ 1 ᨬ¢®«
|
||
;@@:
|
||
|
||
add ebx,capt_offs
|
||
stdcall str_n_cat, ebx,ecx,edi
|
||
.end_f:
|
||
ret
|
||
endp
|
||
|
||
;¤®¡ ¢«¥¨¥ ®¢®£® í«¥¬¥â ã¯à ¢«¥¨ï á奬ã
|
||
;¯à¨ ¤®¡ ¢«¥¨¨ ¨á¯®«ì§ãîâáï áâ ¤ àâë¥ áâனª¨
|
||
align 4
|
||
proc shem_element_creat uses eax ebx, coord_x:dword, coord_y:dword
|
||
mov eax,dword[coord_x]
|
||
mov dword[txt_buf],eax ;ª®®à¤¨ â x
|
||
mov ebx,dword[coord_y]
|
||
|
||
stdcall element_is_click,eax,ebx ;¯à®¢¥à塞 ¥áâì «¨ ¢ ¤ ®© â®çª¥ ¤à㣮© í«¥¬¥â ᮧ¤ ë© à ìè¥
|
||
test eax,eax
|
||
jnz .end_f ;¯à¨ ¦ ⨨ ¯®¯ «¨ ®¤¨ ¨§ í«¥¬¥â®¢
|
||
mov dword[txt_buf+4],ebx ;ª®®à¤¨ â y
|
||
|
||
;xor eax,eax
|
||
mov byte[txt_buf+sp_offs_el_angle],al ; ¯à ¢«¥¨¥
|
||
|
||
stdcall [tl_node_get_data], tree2
|
||
pop ebx
|
||
test ebx,ebx
|
||
jnz @f
|
||
mov ebx,el_opt_beg+el_offs_nam ;¥á«¨ ¥ ¢§ï«®áì ¨¬ï í«¥¬¥â , â® ¯® 㬮«ç ¨î ¡¥à¥¬ 1-© ¨§ ᯨáª
|
||
@@:
|
||
stdcall el_get_name, ebx,0
|
||
mov byte[txt_buf+sp_offs_el_type],al ;⨯ í«¥¬¥â
|
||
|
||
stdcall make_list_capts,txt_buf,ebx
|
||
stdcall [tl_node_add], txt_buf,(el_icon_elems shl 16)+1, tree1
|
||
stdcall [tl_cur_next], tree1
|
||
stdcall [tl_draw], tree1
|
||
.end_f:
|
||
ret
|
||
endp
|
||
|
||
;description:
|
||
; «¨§¨àã¥â áâபã á ¨¬¥¥¬ «®£. í«¥¬¥â ¨ ¢®§¢à é ¥â ®¬¥à «®£. í«¥¬¥â
|
||
;input:
|
||
; str - 㪠§ ⥫ì áâபã ᮤ¥à¦ éãî ¨¬ï «®£. í«¥¬¥â
|
||
; asciiz - ᨬ¢®« ª®â®àë© ¤®«¦¥ ¡ëâì § ¬¥¥ ascii 0
|
||
;output:
|
||
; eax - ⨯ í«¥¬¥â
|
||
align 4
|
||
proc el_get_name uses ebx ecx edi esi, str:dword, asciiz:dword
|
||
mov edi,[str]
|
||
cmp dword[asciiz],0
|
||
je @f
|
||
mov eax,dword[asciiz]
|
||
mov ecx,el_offs_col ;à §¬¥à ⥪áâ ¢ str ¥ ¡®«ìè¥ el_offs_col
|
||
cld
|
||
repne scasb
|
||
mov ebx,edi
|
||
dec ebx
|
||
mov byte[ebx],0 ;0 - ᨬ¢®« ª®æ áâப¨ ¤«ï ¯à ¢¨«ì®© à ¡®âë str_cmp
|
||
@@:
|
||
|
||
mov edi,[str]
|
||
mov esi,el_opt_beg+el_offs_nam
|
||
xor ecx,ecx
|
||
@@:
|
||
stdcall str_cmp, edi,esi
|
||
cmp eax,0
|
||
je @f
|
||
add esi,size_el_opt
|
||
cmp esi,el_opt_beg.end
|
||
jge @f
|
||
inc ecx
|
||
jmp @b
|
||
@@:
|
||
mov eax,ecx
|
||
|
||
cmp dword[asciiz],0
|
||
je @f
|
||
mov ecx,dword[asciiz]
|
||
mov byte[ebx],cl
|
||
@@:
|
||
ret
|
||
endp
|
||
|
||
;input:
|
||
; el_data - 㪠§ â¥«ì ¤ ë¥ í«¥¬¥â
|
||
; l_opt - ®¬¥à ®£¨, ¤«ï ª®â®à®© ¨éãâáï ª®®à¤¨ âë, ¢å®¤ ï/¢ë室 ï ®£
|
||
;output:
|
||
; eax - coord x (if not found eax=0)
|
||
; ebx - coord y (if not found ebx=0)
|
||
align 4
|
||
proc el_get_leg_coords uses ecx edx edi esi, el_data:dword, l_opt:dword
|
||
mov edi,[el_data] ;¤ ë¥ í«¥¬¥â
|
||
movzx esi,byte[edi+sp_offs_el_type] ;⨯ í«¥¬¥â
|
||
imul esi,size_el_opt
|
||
add esi,el_opt_beg
|
||
;esi+el_offs_legs_inp - 㪠§ ⥫ì â ¡«¨æã á ¯ à ¬¥âà ¬¨ ¢å®¤ëå ®£
|
||
|
||
mov eax,[edi+0]
|
||
mov ebx,[edi+4]
|
||
mov edx,[l_opt]
|
||
movzx edi,byte[edi+sp_offs_el_angle] ;㣮« ¯®¢®à®â / 90 (®â 0-3)
|
||
|
||
btr edx,16 ;¢å®¤ ï/¢ë室 ï ®£
|
||
jc .output_leg
|
||
|
||
;¥á«¨ ®£ ¢å®¤ ï
|
||
inc edx ;®¬¥à æ¨ï ®£ ç¨ ¥âáï á ã«ï, ¯®â®¬ã ¤®¡ ¢«ï¥¬ 1
|
||
stdcall move_rotate_x_n90, -2,edi
|
||
mov esi,[esi+el_offs_legs_inp]
|
||
@@:
|
||
movzx ecx,byte[esi]
|
||
cmp ecx,0
|
||
je .not_found ;®£¨ ª®ç¨«¨áì à ìè¥, 祬 ®¦¨¤ «®áì
|
||
stdcall move_rotate_n90, 0,ecx,edi
|
||
inc esi
|
||
dec edx
|
||
jnz @b
|
||
jmp .end_f
|
||
|
||
;¥á«¨ ®£ ¢ë室 ï
|
||
.output_leg:
|
||
inc edx ;®¬¥à æ¨ï ®£ ç¨ ¥âáï á ã«ï, ¯®â®¬ã ¤®¡ ¢«ï¥¬ 1
|
||
movzx ecx,byte[esi+el_offs_box_x]
|
||
add ecx,2
|
||
stdcall move_rotate_x_n90, ecx,edi
|
||
add esi,el_offs_legs_out
|
||
@@:
|
||
movzx ecx,byte[esi]
|
||
cmp ecx,0
|
||
je .not_found ;®£¨ ª®ç¨«¨áì à ìè¥, 祬 ®¦¨¤ «®áì
|
||
stdcall move_rotate_n90, 0,ecx,edi
|
||
inc esi
|
||
dec edx
|
||
jnz @b
|
||
jmp .end_f
|
||
|
||
.not_found:
|
||
xor eax,eax
|
||
xor ebx,ebx
|
||
.end_f:
|
||
ret
|
||
endp
|
||
|
||
align 4
|
||
proc move_rotate_n90 uses ecx edi, d_x:dword, d_y:dword, angle:dword
|
||
mov edi,[angle] ;㣮« ¯®¢®à®â / 90 (®â 0-3)
|
||
and edi,3
|
||
shl edi,4 ;edi*=16
|
||
add edi,mcs
|
||
|
||
mov ecx,[d_x]
|
||
imul ecx,dword[edi]
|
||
add eax,ecx
|
||
mov ecx,[d_y]
|
||
imul ecx,dword[edi+4]
|
||
add eax,ecx
|
||
|
||
mov ecx,[d_x]
|
||
imul ecx,dword[edi+8]
|
||
add ebx,ecx
|
||
mov ecx,[d_y]
|
||
imul ecx,dword[edi+12]
|
||
add ebx,ecx
|
||
ret
|
||
endp
|
||
|
||
align 4
|
||
proc mem_copy, destination:dword, source: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
|
||
|
||
;description:
|
||
; ”ãªæ¨ï ¯à®¯ã᪠¥â ®¤® á«®¢® (¨«¨ ç¨á«®) á ãç¥â®¬ à §¤¥«¨â¥«ìëå ᨬ¢®«®¢:
|
||
; ¯à®¡¥« , â ¡ã«ï樨, ®¢®© áâப¨. <20>㦠¤«ï ¯®á«¥¤®¢ ⥫쮣® áç¨âë¢ ¨ ç¨á¥« ¨§ áâப¨
|
||
;input:
|
||
; edi - 㪠§ â¥«ì ¯à®¡¥« ¨«¨ á«®¢®
|
||
;output:
|
||
; edi - 㪠§ ⥫ì á«¥¤ãî饥 á«®¢®
|
||
align 4
|
||
str_next_val:
|
||
call str_skip_spaces
|
||
@@:
|
||
cmp byte[edi],0
|
||
je @f
|
||
|
||
cmp byte[edi],' '
|
||
je @f
|
||
cmp byte[edi],9
|
||
je @f
|
||
cmp byte[edi],10
|
||
je @f
|
||
cmp byte[edi],13
|
||
je @f
|
||
|
||
inc edi
|
||
jmp @b
|
||
@@:
|
||
call str_skip_spaces
|
||
ret
|
||
|
||
align 4
|
||
str_skip_spaces:
|
||
dec edi
|
||
@@:
|
||
inc edi
|
||
cmp byte[edi],' '
|
||
je @b
|
||
cmp byte[edi],9
|
||
je @b
|
||
cmp byte[edi],10
|
||
je @b
|
||
cmp byte[edi],13
|
||
je @b
|
||
ret
|
||
|
||
align 4
|
||
str_next_spaces:
|
||
dec edi
|
||
@@:
|
||
inc edi
|
||
cmp byte[edi],0
|
||
je @f
|
||
cmp byte[edi],' '
|
||
je @f
|
||
cmp byte[edi],9
|
||
je @f
|
||
cmp byte[edi],10
|
||
je @f
|
||
cmp byte[edi],13
|
||
je @f
|
||
jmp @b
|
||
@@:
|
||
ret
|
||
|
||
;input:
|
||
; esi - 㪠§ â¥«ì ¨áª®¬®¥ á«®¢®
|
||
;output:
|
||
; edi - 㪠§ â¥«ì ¯®§¨æ¨î ¢ ª®â®à®© á«®¢® ©¤¥®, ¥á«¨ á«®¢® ¥ ©¤¥® â® edi=0
|
||
;¯®àâïâáï ॣ¨áâàë:
|
||
; eax ecx
|
||
align 4
|
||
str_analiz_r:
|
||
mov edi,open_file_lif
|
||
mov ecx,dword[f_size]
|
||
@@:
|
||
mov al,byte[esi] ;ãáâ ¢«¨¢ ¥¬ ¯¥à¢ë© ᨬ¢®« ¤«ï ¯®¨áª
|
||
cld
|
||
repnz scasb
|
||
cmp ecx,0
|
||
je @f ;¥á«¨ § ª®ç¨«áï ¢¥áì ⥪áâ, â® ¢ë室 ¨§ äãªæ¨¨
|
||
;¯¥à¢ë© ᨬ¢®« ¯® ¤à¥áã edi-1 ¤®«¦¥ ¡ëâì ¨§ áâப¨ esi
|
||
dec edi
|
||
stdcall str_instr, edi,esi ;¯à®¢¥à塞 á«®¢® ᮢ¯ ¤¥¨¥
|
||
inc edi
|
||
cmp al,0
|
||
jne @b ;¥á«¨ á«®¢® ¥ ᮢ¯ «®, ¨é¥¬ ¢ áâப¥ á«¥¤ãî騩 ¯¥à¢ë© ᨬ¢®« ¤«ï áà ¢¥¨ï
|
||
;áî¤ ¯®¯ ¤ ¥¬ ¥á«¨ 諨 á«®¢® esi ¯® ¤à¥áã edi
|
||
jmp .exit_f
|
||
@@:
|
||
;áî¤ ¯®¯ ¤ ¥¬ ¥á«¨ ¥ 諨 á«®¢® esi ¯® ¤à¥áã edi
|
||
xor edi,edi
|
||
.exit_f:
|
||
ret
|
||
|
||
;description:
|
||
; ¯à®¢¥àï¥â ᮤ¥à¦¨âáï «¨ áâப str1 ¢ áâப¥ str0
|
||
; ¯à®¢¥àª ¤¥« ¥âáï ⮫쪮 ç¨ ï á ¯¥à¢ëå ᨬ¢®«®¢, 㪠§ ëå ¢ str0 ¨ str1
|
||
; ¯à¨¬¥à 1: ¥á«¨ str0='aaabbbccc', str1='bbb' ᮢ¯ ¤¥¨ï ¥ ¡ã¤¥â
|
||
; ¯à¨¬¥à 2: ¥á«¨ str0='aaabbbccc', str1='aaa' ᮢ¯ ¤¥¨¥ ¡ã¤¥â
|
||
;output:
|
||
; al = 0 ¥á«¨ áâப str1 ᮤ¥à¦¨âáï ¢ str0
|
||
; al != 0 ¥á«¨ áâப str1 ¥ ᮤ¥à¦¨âáï ¢ str0
|
||
align 4
|
||
proc str_instr uses edi esi, str0:dword, str1:dword
|
||
;xor eax,eax
|
||
mov edi,[str0]
|
||
mov esi,[str1]
|
||
cld
|
||
@@:
|
||
mov al,[esi]
|
||
cmp al,0
|
||
je .e1
|
||
inc esi
|
||
scasb ;áà ¢¨¢ ¥¬ ᨬ¢®«ë
|
||
jz @b ;¥á«¨ ᮢ¯ «¨, â® ¯¥à¥å®¤¨¬ ª áà ¢¥¨î á«¥¤ãîé¨å
|
||
;áî¤ ¯®¯ ¤ ¥¬ ¥á«¨ áâப¨ ¥ ᮢ¯ «¨
|
||
sub al,[edi-1]
|
||
.e1: ;áî¤ ¯®¯ ¤ ¥¬ ¥á«¨ áâப str1 (esi) § ª®ç¨« áì
|
||
ret
|
||
endp
|
||
|
||
;description:
|
||
; ¯à®¢¥àï¥â ᮢ¯ ¤¥¨¥ áâப str0 ¨ str1
|
||
;output:
|
||
; eax = 0 ¥á«¨ str0 = str1
|
||
; eax = 1 ¥á«¨ str0 != str1
|
||
align 4
|
||
proc str_cmp uses ecx edi esi, str0:dword, str1:dword
|
||
xor eax,eax
|
||
mov edi,[str0]
|
||
mov esi,[str1]
|
||
mov ecx,0x8fffffff ;ecx - ®ç¥ì ¡®«ì讥 ç¨á«®
|
||
cld
|
||
repne scasb
|
||
;dec edi
|
||
sub edi,[str0]
|
||
mov ecx,edi ;ecx = strlen(str0)+1
|
||
|
||
mov edi,[str0]
|
||
repe cmpsb
|
||
je @f
|
||
inc eax
|
||
@@:
|
||
ret
|
||
endp
|
||
|
||
align 4
|
||
proc but_run_stop
|
||
xor byte[tim_ch],1
|
||
cmp byte[tim_ch],0
|
||
jne @f
|
||
;®áâ ®¢ª á奬ë
|
||
stdcall pole_reset_cells, pole ;ç¨á⪠¯à®¢®¤®¢
|
||
call redraw_pole
|
||
jmp .end_f
|
||
@@:
|
||
;¯®¤£®â®¢ª áå¥¬ë ª § ¯ãáªã
|
||
call sign_clear
|
||
call sign_set_captions_angles
|
||
.end_f:
|
||
ret
|
||
endp
|
||
|
||
align 4
|
||
proc but_set_0 uses eax
|
||
stdcall [tl_node_get_data], tree1
|
||
pop eax
|
||
test eax,eax
|
||
jz .end_f
|
||
;el_icon_captions
|
||
; cmp byte[eax+8],'n'
|
||
; je .end_f
|
||
cmp byte[eax+8],'o' ;¢à¥¬¥®¥ ®âá¥ç¥¨¥, ¯®ª ¥â ¯à®¢¥àª¨ ⨯ ⥪ã饩 ¨ª®ª¨
|
||
jne .end_f
|
||
mov byte[eax+8],'z'
|
||
.end_f:
|
||
ret
|
||
endp
|
||
|
||
align 4
|
||
proc but_set_1 uses eax
|
||
stdcall [tl_node_get_data], tree1
|
||
pop eax
|
||
test eax,eax
|
||
jz .end_f
|
||
;el_icon_captions
|
||
; cmp byte[eax+8],'n'
|
||
; je .end_f
|
||
cmp byte[eax+8],'z' ;¢à¥¬¥®¥ ®âá¥ç¥¨¥, ¯®ª ¥â ¯à®¢¥àª¨ ⨯ ⥪ã饩 ¨ª®ª¨
|
||
jne .end_f
|
||
mov byte[eax+8],'o'
|
||
.end_f:
|
||
ret
|
||
endp
|
||
|
||
;ᤢ¨£ ®¡ê¥ªâ ¢«¥¢®
|
||
align 4
|
||
proc but_mov_l uses eax edi
|
||
cmp byte[tim_ch],0
|
||
jne .end_f
|
||
stdcall [tl_node_get_data], tree1
|
||
pop eax
|
||
test eax,eax
|
||
jz .end_f
|
||
cmp dword[eax],1
|
||
jle .end_f
|
||
dec dword[eax]
|
||
mov edi,eax
|
||
stdcall mem_copy,txt_buf,eax,capt_offs
|
||
add edi,capt_offs
|
||
call str_next_val
|
||
call str_next_val
|
||
stdcall make_list_capts,txt_buf,edi
|
||
stdcall mem_copy,eax,txt_buf,32 ;capt_offs
|
||
call redraw_pole
|
||
stdcall [tl_draw],tree1
|
||
.end_f:
|
||
ret
|
||
endp
|
||
|
||
;ᤢ¨£ ®¡ê¥ªâ ¢¯à ¢®
|
||
align 4
|
||
proc but_mov_r uses eax edi
|
||
cmp byte[tim_ch],0
|
||
jne .end_f
|
||
stdcall [tl_node_get_data], tree1
|
||
pop eax
|
||
test eax,eax
|
||
jz .end_f
|
||
inc dword[eax]
|
||
mov edi,eax
|
||
stdcall mem_copy,txt_buf,eax,capt_offs
|
||
add edi,capt_offs
|
||
call str_next_val
|
||
call str_next_val
|
||
stdcall make_list_capts,txt_buf,edi
|
||
stdcall mem_copy,eax,txt_buf,32 ;capt_offs
|
||
call redraw_pole
|
||
stdcall [tl_draw],tree1
|
||
.end_f:
|
||
ret
|
||
endp
|
||
|
||
align 4
|
||
proc but_mov_u uses eax edi
|
||
cmp byte[tim_ch],0
|
||
jne .end_f
|
||
stdcall [tl_node_get_data], tree1
|
||
pop eax
|
||
test eax,eax
|
||
jz .end_f
|
||
cmp dword[eax+4],1
|
||
jle .end_f
|
||
dec dword[eax+4]
|
||
mov edi,eax
|
||
stdcall mem_copy,txt_buf,eax,capt_offs
|
||
add edi,capt_offs
|
||
call str_next_val
|
||
call str_next_val
|
||
stdcall make_list_capts,txt_buf,edi
|
||
stdcall mem_copy,eax,txt_buf,32 ;capt_offs
|
||
call redraw_pole
|
||
stdcall [tl_draw],tree1
|
||
.end_f:
|
||
ret
|
||
endp
|
||
|
||
align 4
|
||
proc but_mov_d uses eax edi
|
||
cmp byte[tim_ch],0
|
||
jne .end_f
|
||
stdcall [tl_node_get_data], tree1
|
||
pop eax
|
||
test eax,eax
|
||
jz .end_f
|
||
inc dword[eax+4]
|
||
mov edi,eax
|
||
stdcall mem_copy,txt_buf,eax,capt_offs
|
||
add edi,capt_offs
|
||
call str_next_val
|
||
call str_next_val
|
||
stdcall make_list_capts,txt_buf,edi
|
||
stdcall mem_copy,eax,txt_buf,32 ;capt_offs
|
||
call redraw_pole
|
||
stdcall [tl_draw],tree1
|
||
.end_f:
|
||
ret
|
||
endp
|
||
|
||
;ãáâ ®¢ª ®¡ë箣® ०¨¬ , ¡¥§ à¨á®¢ ¨ï
|
||
align 4
|
||
proc but_set_none
|
||
mov byte[pen_mode],0
|
||
cmp [cursor_pointer],0
|
||
je @f
|
||
push eax ebx ecx
|
||
mcall 37,6,[cursor_pointer]
|
||
pop ecx ebx eax
|
||
@@:
|
||
ret
|
||
endp
|
||
|
||
;hot_p - ª®®à¤¨ âë £®àï祩 â®çª¨ ªãàá®à , ᬥé¥ë¥ ¡¨â 16 ((cx shl 8) + cy) shl 16
|
||
align 4
|
||
proc set_pen_mode uses eax ebx ecx edx, mode:dword, icon:dword, hot_p:dword
|
||
mov eax,[mode]
|
||
cmp byte[pen_mode],al
|
||
je @f
|
||
mov byte[pen_mode],al
|
||
mov edx,[hot_p]
|
||
mov dx,2 ;LOAD_INDIRECT
|
||
mov ecx,[icon]
|
||
shl ecx,12 ;㬮¦ ¥¬ 4 ª¡
|
||
add ecx,[buf_curs.data]
|
||
mcall 37,4
|
||
|
||
cmp eax,0
|
||
je @f
|
||
mov [cursor_pointer],eax
|
||
mcall 37,5,[cursor_pointer]
|
||
@@:
|
||
ret
|
||
endp
|
||
|
||
;¤ ë¥ ¤«ï ¤¨ «®£ ®âªàëâ¨ï ä ©«®¢
|
||
align 4
|
||
OpenDialog_data:
|
||
.type dd 0 ;0 - ®âªàëâì, 1 - á®åà ¨âì, 2 - ¢ë¡à âì ¤â४â®à¨î
|
||
.procinfo dd procinfo ;+4
|
||
.com_area_name dd communication_area_name ;+8
|
||
.com_area dd 0 ;+12
|
||
.opendir_path dd plugin_path ;+16
|
||
.dir_default_path dd default_dir ;+20
|
||
.start_path dd file_name ;+24 ¯ãâì ª ¤¨ «®£ã ®âªàëâ¨ï ä ©«®¢
|
||
.draw_window dd draw_window ;+28
|
||
.status dd 0 ;+32
|
||
.openfile_path dd openfile_path ;+36 ¯ãâì ª ®âªàë¢ ¥¬®¬ã ä ©«ã
|
||
.filename_area dd filename_area ;+40
|
||
.filter_area dd Filter
|
||
.x:
|
||
.x_size dw 420 ;+48 ; Window X size
|
||
.x_start dw 10 ;+50 ; Window X position
|
||
.y:
|
||
.y_size dw 320 ;+52 ; Window y size
|
||
.y_start dw 10 ;+54 ; Window Y position
|
||
|
||
default_dir db '/rd/1',0
|
||
|
||
communication_area_name:
|
||
db 'FFFFFFFF_open_dialog',0
|
||
open_dialog_name:
|
||
db 'opendial',0
|
||
communication_area_default_path:
|
||
db '/rd/1/File managers/',0
|
||
|
||
Filter:
|
||
dd Filter.end - Filter ;.1
|
||
.1:
|
||
db 'TXT',0
|
||
db 'ASM',0
|
||
.end:
|
||
db 0
|
||
|
||
include 'le_libs.inc'
|
||
|
||
mouse_dd dd 0x0
|
||
sc system_colors
|
||
last_time dd 0
|
||
|
||
|
||
|
||
align 16
|
||
procinfo process_information
|
||
|
||
align 4
|
||
buf_0: dd 0 ;
|
||
.l: dw 170 ;+4 left
|
||
.t: dw panel_1_coord_top ;+6 top
|
||
.w: dd 395 ;+8 w
|
||
.h: dd 340 ;+12 h
|
||
.color: dd ini_def_c_bkgnd ;+16 color
|
||
db 24 ;+20 bit in pixel
|
||
|
||
align 4
|
||
buf_font: ;¡ãä¥à á® èà¨ä⮬
|
||
dd 0 ;㪠§ â¥«ì ¡ãä¥à ¨§®¡à ¦¥¨ï
|
||
dw 25 ;+4 left
|
||
dw 25 ;+6 top
|
||
dd 96 ;+8 w
|
||
dd 144 ;+12 h
|
||
dd 0 ;+16 color
|
||
db 24 ;+20 bit in pixel
|
||
|
||
align 4
|
||
buf_curs: ;¡ãä¥à á ªãàá®à ¬¨
|
||
.data: dd 0 ;㪠§ â¥«ì ¡ãä¥à ¨§®¡à ¦¥¨ï
|
||
dw 0 ;+4 left
|
||
dw 0 ;+6 top
|
||
dd 32 ;+8 w
|
||
dd 32*cursors_count ;+12 h
|
||
dd 0 ;+16 color
|
||
db 24 ;+20 bit in pixel
|
||
|
||
align 4
|
||
buf_curs_8: ;¡ãä¥à á ªãàá®à ¬¨
|
||
.data: dd 0 ;㪠§ â¥«ì ¡ãä¥à ¨§®¡à ¦¥¨ï
|
||
dw 0 ;+4 left
|
||
dw 0 ;+6 top
|
||
dd 32 ;+8 w
|
||
dd 32*cursors_count ;+12 h
|
||
dd 0 ;+16 color
|
||
db 24 ;+20 bit in pixel
|
||
|
||
cursor_pointer dd 0 ;㪠§ â¥«ì ¤ ë¥ ¤«ï ªãàá®à
|
||
|
||
el_focus dd 0
|
||
tree1 tree_list 32,points_max+2, tl_key_no_edit, 16,16,\
|
||
0x8080ff,0x0000ff,0xffffff, 5,panel_3_coord_top+85,145,170, 0,capt_offs,0,\
|
||
el_focus, wScr1,0
|
||
tree2 tree_list el_offs_col-el_offs_nam,100+2, tl_key_no_edit+tl_list_box_mode, 16,16,\
|
||
0x8080ff,0x0000ff,0xffffff, 5,panel_3_coord_top,145,80, 0,0,0,\
|
||
el_focus, wScr2,0
|
||
|
||
align 4
|
||
wScr1:
|
||
.x:
|
||
.size_x dw 16 ;+0
|
||
.start_x dw 0 ;+2
|
||
.y:
|
||
.size_y dw 150 ;+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
|
||
|
||
align 4
|
||
wScr2:
|
||
.x:
|
||
.size_x dw 16 ;+0
|
||
.start_x dw 0 ;+2
|
||
.y:
|
||
.size_y dw 150 ;+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
|
||
|
||
align 4
|
||
proc str_n_cat uses eax ecx edi esi, str1:dword, str2:dword, n:dword
|
||
mov esi,dword[str2]
|
||
mov ecx,dword[n]
|
||
mov edi,dword[str1]
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
cld
|
||
repne movsb
|
||
mov byte[edi],0
|
||
ret
|
||
endp
|
||
|
||
align 4
|
||
proc str_cat uses eax ecx edi esi, str1:dword, str2:dword
|
||
mov esi,dword[str2]
|
||
stdcall str_len,esi
|
||
mov ecx,eax
|
||
inc ecx
|
||
mov edi,dword[str1]
|
||
stdcall str_len,edi
|
||
add edi,eax
|
||
cld
|
||
repne movsb
|
||
ret
|
||
endp
|
||
|
||
;output:
|
||
; eax = strlen
|
||
align 4
|
||
proc str_len, str1:dword
|
||
mov eax,[str1]
|
||
@@:
|
||
cmp byte[eax],0
|
||
je @f
|
||
inc eax
|
||
jmp @b
|
||
@@:
|
||
sub eax,[str1]
|
||
ret
|
||
endp
|
||
|
||
;input:
|
||
; buf - 㪠§ ⥫ì áâபã, ç¨á«® ¤®«¦® ¡ëâì ¢ 10 ¨«¨ 16 à¨ç®¬ ¢¨¤¥
|
||
;output:
|
||
; eax - ç¨á«®
|
||
align 4
|
||
proc conv_str_to_int, buf:dword
|
||
xor eax,eax
|
||
push ebx ecx esi
|
||
xor ebx,ebx
|
||
mov esi,[buf]
|
||
|
||
; á«ãç © ¥á«¨ ¯¥à¥¤ ç¨á«®¬ 室ïâáï ¯à®¡¥«ë
|
||
@@:
|
||
cmp byte[esi],' '
|
||
jne @f
|
||
inc esi
|
||
jmp @b
|
||
@@:
|
||
|
||
;®¯à¥¤¥«¥¨¥ ®âà¨æ ⥫ìëå ç¨á¥«
|
||
xor ecx,ecx
|
||
inc ecx
|
||
cmp byte[esi],'-'
|
||
jne @f
|
||
dec ecx
|
||
inc esi
|
||
@@:
|
||
|
||
cmp word[esi],'0x'
|
||
je .load_digit_16
|
||
|
||
.load_digit_10: ;áç¨âë¢ ¨¥ 10-â¨çëå æ¨äà
|
||
mov bl,byte[esi]
|
||
cmp bl,'0'
|
||
jl @f
|
||
cmp bl,'9'
|
||
jg @f
|
||
sub bl,'0'
|
||
imul eax,10
|
||
add eax,ebx
|
||
inc esi
|
||
jmp .load_digit_10
|
||
jmp @f
|
||
|
||
.load_digit_16: ;áç¨âë¢ ¨¥ 16-à¨çëå æ¨äà
|
||
add esi,2
|
||
.cycle_16:
|
||
mov bl,byte[esi]
|
||
cmp bl,'0'
|
||
jl @f
|
||
cmp bl,'f'
|
||
jg @f
|
||
cmp bl,'9'
|
||
jle .us1
|
||
cmp bl,'A'
|
||
jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'9' ¨ <'A'
|
||
.us1: ;á®áâ ¢®¥ ãá«®¢¨¥
|
||
cmp bl,'F'
|
||
jle .us2
|
||
cmp bl,'a'
|
||
jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'F' ¨ <'a'
|
||
sub bl,32 ;¯¥à¥¢®¤¨¬ ᨬ¢®«ë ¢ ¢¥à娩 ॣ¨áâà, ¤«ï ã¯à®é¥¨ï ¨å ¯®á«¥¤ã饩 ®¡à ¡®âª¨
|
||
.us2: ;á®áâ ¢®¥ ãá«®¢¨¥
|
||
sub bl,'0'
|
||
cmp bl,9
|
||
jle .cor1
|
||
sub bl,7 ;convert 'A' to '10'
|
||
.cor1:
|
||
shl eax,4
|
||
add eax,ebx
|
||
inc esi
|
||
jmp .cycle_16
|
||
@@:
|
||
cmp ecx,0 ;¥á«¨ ç¨á«® ®âà¨æ ⥫쮥
|
||
jne @f
|
||
sub ecx,eax
|
||
mov eax,ecx
|
||
@@:
|
||
pop esi ecx ebx
|
||
ret
|
||
endp
|
||
|
||
;íâ®â ª®¤ ¥ ¬®©, ® ¯à¥®¡à §ã¥â ç¨á«® ¢ áâபã
|
||
;input:
|
||
; eax = value
|
||
; edi = string buffer
|
||
;output:
|
||
align 4
|
||
proc convert_int_to_str uses eax ecx edx edi
|
||
mov dword[edi+1],0
|
||
call .str
|
||
ret
|
||
endp
|
||
|
||
align 4
|
||
.str:
|
||
mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬ áç¨á«¥¨ï ¨§¬¥ïîâáï ॣ¨áâàë 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 ;¢¥àãâìáï ç¥ì ¨â¥à¥áë© å®¤ â.ª. ¯®ª ¢ á⥪¥ åà ¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
|
||
|
||
i_end:
|
||
rb 1024
|
||
stacktop:
|
||
sys_path rb 1024
|
||
file_name:
|
||
rb 1024 ;4096
|
||
library_path rb 1024
|
||
plugin_path rb 4096
|
||
openfile_path rb 4096
|
||
filename_area rb 256
|
||
mem:
|