Subversion Repositories Kolibri OS

Rev

Rev 2574 | Rev 3014 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. use32
  2.         org 0x0
  3.         db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
  4.         dd 0x1
  5.         dd start
  6.         dd i_end ;à §¬¥à ¯à¨«®¦¥­¨ï
  7.         dd mem
  8.         dd stacktop
  9.         dd 0
  10.         dd sys_path
  11.  
  12. ini_def_c_bkgnd equ 0
  13. ini_def_c_border equ 0xff0000
  14. color_s0 equ 0xff ;ᨣ­ « 0
  15. color_s1 equ 0xffffff ;ᨣ­ « 1
  16. color_s2 equ 0xff00 ;â®çª  ¡¥§ ¯¥à¥á¥ç¥­¨ï
  17. color_s3 equ 0xff0000 ;¢à¥¬¥­­®¥ §­ ç¥­¨¥ ¤«ï á®åà ­¥­¨ï
  18.  
  19. color_border dd ini_def_c_border
  20. opt_sign_moves dd 4
  21. opt_fast_mode dd 0 ;¡ëáâàë© à¥¦¨¬
  22.  
  23. debug equ 0
  24.  
  25. ;­®¬ à  ¨ª®­®ª:
  26. el_icon_group equ 0 ;£à㯯®¢ ï
  27. el_icon_points equ 1 ;â®çª¨
  28. el_icon_sub_points equ 2 ;¨§®«ï樨
  29. el_icon_elems equ 3 ;í«¥¬¥­â 
  30. el_icon_captions equ 4 ;¯®¤¯¨á¨
  31.  
  32. size_el_opt equ 34 ;à §¬¥à áâàãªâãàë á ®¯æ¨ï¬¨ í«¥¬¥­â 
  33. el_offs_nam equ 0 ;ᬥ饭¨¥ ¤«ï ­ ç «  ¨¬¥­¨ í«¥¬¥­â 
  34. el_offs_col equ 16 ;梥â í«¥¬¥­â 
  35. el_offs_box_x equ 20 ;è¨à¨­  ª®à®¡ª¨ í«¥¬¥­â 
  36. el_offs_box_y equ 21 ;¢ëá®â  ª®à®¡ª¨ í«¥¬¥­â 
  37. el_offs_table equ 22 ;㪠§ â¥«ì ­  â ¡«¨æã à ¡®âë í«¥¬¥­â 
  38. el_offs_legs_inp equ 26 ;㪠§ â¥«ì ­  â ¡«¨æã ®¯¨á ­¨ï ¢å®¤­ëå ­®£
  39. el_offs_legs_out equ 30 ;ᬥ饭¨¥ ­  ®¯¨á ­¨¥ ¢ë室­ëå ­®£
  40.  
  41. sp_offs_el_angle equ 8 ;ᬥ饭¨¥ ¤«ï 㣫  ¯®¢®à®â  í«¥¬¥­â  ¢ ᯨ᪥
  42. sp_offs_el_type equ 9 ;ᬥ饭¨¥ ¤«ï ⨯  í«¥¬¥­â  ¢ ᯨ᪥
  43.  
  44. points_max equ 1000
  45. capt_offs equ 10 ;ᬥ饭¨¥ ¤«ï ­ ç «  ¯®¤¯¨á¨ ¢ «¨á⥠tree1
  46.  
  47. include '../../../macros.inc'
  48. include '../../../proc32.inc'
  49. include '../../../develop/libraries/box_lib/load_lib.mac'
  50. include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
  51. include 'mem.inc'
  52. include 'dll.inc'
  53. include 'le_pole.inc'
  54. include 'le_signal.inc'
  55.  
  56. @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
  57. caption db '‹®£¨ç¥áª¨¥ í«¥¬¥­âë 19.04.12',0 ;¯®¤¯¨áì ®ª­ 
  58.  
  59. panel_0_coord_top equ 5 ;¢¥àå­ïï ª®®à¤¨­ â  0-£® à鸞 ¯ ­¥«¨ ¨­áâà㬥­â®¢
  60. panel_1_coord_top equ 35
  61. panel_2_coord_top equ 60
  62. panel_3_coord_top equ 85
  63.  
  64. align 4
  65. proc move_rotate_x_n90 uses ecx edi, d_x:dword, angle:dword
  66.         mov edi,[angle] ;㣮« ¯®¢®à®â  / 90 (®â 0-3)
  67.         and edi,3
  68.         shl edi,4 ;edi*=16
  69.         add edi,mcs
  70.  
  71.         mov ecx,[d_x]
  72.         imul ecx,dword[edi]
  73.         add eax,ecx
  74.  
  75.         mov ecx,[d_x]
  76.         imul ecx,dword[edi+8]
  77.         add ebx,ecx
  78.  
  79.         ret
  80. endp
  81.  
  82. struct FileInfoBlock
  83.         Function dd ?
  84.         Position dd ?
  85.         Flags    dd ?
  86.         Count    dd ?
  87.         Buffer   dd ?
  88.                 db ?
  89.         FileName dd ?
  90. ends
  91.  
  92. macro elOpt nam,col,box_x,box_y,table, tbl_i_legs, ol0, ol1, ol2
  93. {
  94.         @@: db nam,0
  95.         rb @b+el_offs_col-$
  96.         dd col
  97.         db box_x
  98.         db box_y
  99.         dd table+0 ;+el_offs_table
  100.         dd tbl_i_legs+0 ;+26 ¢å®¤­ë¥ ­®£¨
  101. ;+30 ¢ë室­ë¥ ­®£¨
  102.         db ol0+0, ol1+0, ol2+0, 0
  103. }
  104.  
  105. align 4
  106. el_opt_beg:
  107. elOpt 'or[2]', 0xff00ff,5,5,tbl_or, tbl_il_2, 2
  108. elOpt 'or[3]', 0xff00ff,5,7,tbl_or, tbl_il_3, 3
  109. elOpt 'or[4]', 0xff00ff,5,9,tbl_or, tbl_il_4, 4
  110. elOpt 'and[2]',0xffff00,5,5,tbl_and.2, tbl_il_2, 2
  111. elOpt 'and[3]',0xffff00,5,7,tbl_and.3, tbl_il_3, 3
  112. elOpt 'and[4]',0xffff00,5,9,tbl_and.4, tbl_il_4, 4
  113. elOpt 'and[5]',0xffff00,5,11,tbl_and.5, tbl_il_5, 5
  114. elOpt 'not',   0xffff,  3,3,tbl_not, tbl_il_1, 1
  115. elOpt 'xor',   0x8000ff,5,5,tbl_xor, tbl_il_2, 2
  116. elOpt 'sm[1]', 0x8080ff,7,7,tbl_sm,  tbl_il_3, 1,4
  117. elOpt 'ms[2]', 0x8080ff,7,14,tbl_ms_2,  tbl_il_m2,6
  118. elOpt 'ms[2]e',0x8080ff,7,17,tbl_ms_2_e,tbl_il_m2e,8
  119. ;elOpt 'cd[8]', 0x8000, 7,17,tbl_cd_8,tbl_il_8, 6,2,2 ;è¨äà â®à ­  8 ¢å®¤®¢
  120. .end:
  121. elOpt '???', 0x808080,3,3,tbl_and.3, tbl_il_1, 1 ;­¥ ®¯®§­ ­­ë© í«¥¬¥­â
  122.  
  123. ;â ¡«¨æë ¯® ª®â®àë¬ § ¤ îâáï ¯à ¢¨«  à ¡®âë í«¥¬¥­â®¢
  124. align 4
  125. tbl_or db 0,1,1,1, 1,1,1,1 ;or2, or3
  126.         db 1,1,1,1,1,1,1,1 ;or4
  127. tbl_and:
  128. .5: dq 0,0
  129. .4: dq 0
  130. .3: dd 0
  131. .2: db 0,0,0,1
  132. tbl_xor db 0,1,1,0
  133. tbl_sm db 0,2,2,1, 2,1,1,3
  134. tbl_not db 1,0 ;not
  135.  
  136. ;¬ã«ì⨯«¥ªá®à ¤«ï 2-å à §à來®£® ᨣ­ « 
  137. align 4
  138. tbl_ms_2_e: ;á® ¢å®¤®¬ 'e'
  139. dq 0,0,0,0,0,0,0,0
  140. tbl_ms_2:
  141. db 0,1,0,1,0,1,0,1
  142. db 0,1,0,1,0,1,0,1
  143. db 0,0,1,1,0,0,1,1
  144. db 0,0,1,1,0,0,1,1
  145. db 0,0,0,0,1,1,1,1
  146. db 0,0,0,0,1,1,1,1
  147. dq 0
  148. db 1,1,1,1,1,1,1,1
  149. ;tbl_cd_8 db ;256=2^8
  150.  
  151. ;â ¡«¨æë ¤«ï ¢å®¤­ëå ­®£
  152. tbl_il_1 db 1,0   ;ª®à¯ãá ­  1 ­®£ã
  153. tbl_il_2 db 1,2,0 ;ª®à¯ãá ­  2 ­®£¨
  154. tbl_il_3 db 1,2,2,0
  155. tbl_il_4 db 1,2,2,2,0
  156. tbl_il_5 db 1,2,2,2,2,0
  157. tbl_il_m2  db 1,2,2,2,3,2,0
  158. tbl_il_m2e db 1,2,2,2,3,2,3,0
  159. ;tbl_il_8 db 1,2,2,2,2,2,2,2,0
  160.  
  161. time dd 0
  162. tim_ch db 0
  163. pen_mode dd 0 ;०¨¬ à¨á®¢ ­¨ï ¯à®¢®¤ 
  164. pen_coord_x dd 0 ;ª®®à¤¨­ â  x ­ ç «ì­®© â®çª¨ à¨á®¢ ­¨ï
  165. pen_coord_y dd 0
  166.  
  167. txt_set_0 db '0',0
  168. txt_set_1 db '1',0
  169. ;txt_mov_l db 27,0 ;<-
  170. ;txt_mov_r db 26,0 ;->
  171.  
  172. txt_size db 'size',0
  173. txt_elements db 'elements',0
  174. txt_points db 'points',0
  175. txt_sub_points db 'subpoints',0
  176. txt_captions db 'captions',0
  177.  
  178. ;¬ âà¨æ  ª®á¨­ãᮢ ¨ ᨭãᮢ, ¨á¯®«ì§ã¥¬ ï ¤«ï ¯®¢®à®â®¢ ᨣ­ «®¢ ¨ í«¥¬¥­â®¢
  179. align 4
  180. mcs dd 1, 0, 0, 1,\
  181.            0, 1,-1, 0,\
  182.           -1, 0, 0,-1,\
  183.            0,-1, 1, 0
  184.  
  185. run_file_70 FileInfoBlock
  186. image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
  187.  
  188. IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
  189. IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*25
  190. image_data_toolbar dd 0
  191.  
  192. TREE_ICON_SYS16_BMP_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*11+54 ;à §¬¥à bmp ä ©«  á á¨á⥬­ë¬¨ ¨ª®­ª ¬¨
  193. icon_tl_sys dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï á¨á⥬­ëå ¨ª®­®ª
  194. TOOLBAR_ICON_BMP_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*5+54 ;à §¬¥à bmp ä ©«  á ¨ª®­ª ¬¨ ®¡ê¥ªâ®¢
  195. icon_toolbar dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï ¨ª®­®ª ®¡ê¥ªâ®¢
  196.  
  197. IMAGE_FONT_SIZE equ 128*144*3
  198. image_data_gray dd 0 ;¯ ¬ïâì á ¢à¥¬¥­­ë¬¨ á¥à묨 ¨§®¡à ¦¥­¨ï¬¨ ¢ ä®à¬ â¥ 24-bit, ¨§ ª®â®àëå ¡ã¤ãâ ᮧ¤ ¢ âìáï âà ä à¥âë
  199.  
  200. cursors_count equ 4
  201. IMAGE_CURSORS_SIZE equ 4096*cursors_count ;à §¬¥à ª à⨭ª¨ á ªãàá®à ¬¨
  202.  
  203. macro load_image_file path,buf,size { ;¬ ªà®á ¤«ï § £à㧪¨ ¨§®¡à ¦¥­¨©
  204.         ;path - ¬®¦¥â ¡ëâì ¯¥à¥¬¥­­®© ¨«¨ áâப®¢ë¬ ¯ à ¬¥â஬
  205.         if path eqtype '' ;¯à®¢¥à塞 § ¤ ­ «¨ áâப®© ¯ à ¬¥âà path
  206.                 jmp @f
  207.                         local .path_str
  208.                         .path_str db path ;ä®à¬¨à㥬 «®ª «ì­ãî ¯¥à¥¬¥­­ãî
  209.                         db 0
  210.                 @@:
  211.                 ;32 - áâ ­¤ àâ­ë©  ¤à¥á ¯® ª®â®à®¬ã ¤®«¦¥­ ¡ëâì ¡ãä¥à á á¨á⥬­ë¬ ¯ã⥬
  212.                 copy_path .path_str,[32],file_name,0x0
  213.         else
  214.                 copy_path path,[32],file_name,0x0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
  215.         end if
  216.  
  217.         stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
  218.         mov [buf],eax
  219.  
  220.         mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
  221.         mov [run_file_70.Function], 0
  222.         mov [run_file_70.Position], 0
  223.         mov [run_file_70.Flags], 0
  224.         mov [run_file_70.Count], dword size
  225.         m2m [run_file_70.Buffer], [buf]
  226.         mov byte[run_file_70+20], 0
  227.         mov [run_file_70.FileName], file_name
  228.         mov ebx,run_file_70
  229.         int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
  230.         cmp ebx,0xffffffff
  231.         je @f
  232.                 ;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data
  233.                 stdcall dword[img_decode], dword[buf],ebx,0
  234.                 mov dword[image_data],eax
  235.                 ;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥­¨¥ ª ä®à¬ âã rgb
  236.                 stdcall dword[img_to_rgb2], dword[image_data],dword[buf]
  237.                 ;㤠«ï¥¬ ¢à¥¬¥­­ë© ¡ãä¥à image_data
  238.                 stdcall dword[img_destroy], dword[image_data]
  239.         @@:
  240. }
  241.  
  242. ini_name db 'log_el.ini',0 ;¨¬ï ä ©« 
  243. ini_sec_color db 'Colors',0
  244. key_color_bkgnd db 'background',0
  245. key_color_border db 'border',0
  246. key_color_s0 db 's0',0
  247. key_color_s1 db 's1',0
  248. key_color_s2 db 's2',0
  249. key_color_captions db 'captions',0
  250. ini_sec_options db 'Options',0
  251. key_opt_sign_moves db 'signal_moves',0
  252. key_opt_fast_mode db 'fast_mode',0
  253.  
  254. align 4
  255. start:
  256.         load_libraries l_libs_start,l_libs_end
  257.         ;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ¡¨¡«¨®â¥ª 
  258.         mov     ebp,lib_7
  259.         cmp     dword [ebp+ll_struc_size-4],0
  260.         jz      @f
  261.                 mcall -1 ;exit not correct
  262.         @@:
  263.         mcall 48,3,sc,sizeof.system_colors
  264.         mcall 40,0x27
  265.  
  266.         ;*** áç¨â뢠­¨¥ ­ áâ஥ª ¨§ *.ini ä ©« 
  267.         copy_path ini_name,sys_path,file_name,0x0
  268.  
  269.         stdcall dword[ini_get_color],file_name,ini_sec_color,key_color_bkgnd,ini_def_c_bkgnd
  270.         mov dword[buf_0.color],eax
  271.         stdcall dword[ini_get_color],file_name,ini_sec_color,key_color_border,ini_def_c_border
  272.         mov dword[color_border],eax
  273.         stdcall dword[ini_get_color],file_name,ini_sec_color,key_color_s0,color_s0
  274.         mov dword[shem_colors],eax
  275.         stdcall dword[ini_get_color],file_name,ini_sec_color,key_color_s1,color_s1
  276.         mov dword[shem_colors+4],eax
  277.         stdcall dword[ini_get_color],file_name,ini_sec_color,key_color_s2,color_s2
  278.         mov dword[shem_colors+8],eax
  279.         stdcall dword[ini_get_color],file_name,ini_sec_color,key_color_captions,[color_captions]
  280.         mov dword[color_captions],eax
  281.  
  282.         mov ebx,el_opt_beg+el_offs_nam
  283.         mov ecx,(el_opt_beg.end-el_opt_beg)/size_el_opt ;ª®««¨ç¥á⢮ ⨯®¢ í«¥¬¥­â®¢
  284.         cld
  285.         @@:
  286.                 push ecx
  287.                 stdcall dword[ini_get_color],file_name,ini_sec_color,ebx,[ebx+el_offs_col-el_offs_nam]
  288.                 pop ecx
  289.                 mov dword[ebx+el_offs_col-el_offs_nam],eax
  290.                 add ebx,size_el_opt
  291.                 loop @b
  292.  
  293.         stdcall dword[ini_get_int],file_name,ini_sec_options,key_opt_sign_moves,[opt_sign_moves]
  294.         mov dword[opt_sign_moves],eax
  295.         stdcall dword[ini_get_int],file_name,ini_sec_options,key_opt_fast_mode,[opt_fast_mode]
  296.         mov dword[opt_fast_mode],eax
  297.  
  298.         ;*** ¯®¤£®â®¢ª  ¤¨ «®£ 
  299.         stdcall [OpenDialog_Init],OpenDialog_data
  300.         stdcall [buf2d_create], buf_0 ;ᮧ¤ ­¨¥ ¡ãä¥à 
  301.         load_image_file 'toolbar.png', image_data_toolbar,IMAGE_TOOLBAR_SIZE
  302.  
  303.         stdcall pole_init, pole
  304.         stdcall dword[tl_data_init], tree1
  305.         stdcall dword[tl_data_init], tree2
  306.  
  307.         ;á¨á⥬­ë¥ ¨ª®­ª¨ 16*16 ¤«ï tree_list
  308.         load_image_file 'tl_sys_16.png', icon_tl_sys,TREE_ICON_SYS16_BMP_SIZE
  309.         ;¥á«¨ ¨§®¡à ¦¥­¨¥ ­¥ ®âªàë«®áì, â® ¢ icon_tl_sys ¡ã¤ãâ
  310.         ;­¥ ¨­¨æ¨ «¨§¨à®¢ ­­ë¥ ¤ ­­ë¥, ­® ®è¨¡ª¨ ­¥ ¡ã¤¥â, â. ª. ¡ãä¥à ­ã¦­®£® à §¬¥à 
  311.         mov eax,dword[icon_tl_sys]
  312.         mov dword[tree1.data_img_sys],eax
  313.         mov dword[tree2.data_img_sys],eax
  314.  
  315.         load_image_file 'objects.png', icon_toolbar,TOOLBAR_ICON_BMP_SIZE
  316.         mov eax,dword[icon_toolbar]
  317.         mov dword[tree1.data_img],eax
  318.         mov dword[tree2.data_img],eax
  319.  
  320.         ;*** § £à㧪  èà¨äâ 
  321.         load_image_file 'font6x9.bmp', image_data_gray,IMAGE_FONT_SIZE
  322.         stdcall [buf2d_create_f_img], buf_font,[image_data_gray] ;ᮧ¤ ¥¬ ¡ãä¥à
  323.         stdcall mem.Free,[image_data_gray] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
  324.  
  325.         stdcall [buf2d_conv_24_to_8], buf_font,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç­®á⨠8 ¡¨â
  326.         stdcall [buf2d_convert_text_matrix], buf_font
  327.  
  328.         ;*** § £à㧪  ªãàá®à®¢
  329.         load_image_file 'cursors_gr.png',image_data_gray,IMAGE_CURSORS_SIZE
  330.         stdcall [buf2d_create_f_img], buf_curs_8,[image_data_gray] ;ᮧ¤ ¥¬ ¡ãä¥à
  331.         stdcall mem.Free,[image_data_gray] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
  332.  
  333.         load_image_file 'cursors.png',image_data_gray, IMAGE_CURSORS_SIZE
  334.         stdcall [buf2d_create_f_img], buf_curs,[image_data_gray] ;ᮧ¤ ¥¬ ¡ãä¥à
  335.         stdcall mem.Free,[image_data_gray] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
  336.  
  337.         stdcall [buf2d_conv_24_to_8], buf_curs_8,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç­®á⨠8¡¨â
  338.         stdcall [buf2d_conv_24_to_32],buf_curs,buf_curs_8 ;¤¥« ¥¬ ¡ãä¥à rgba 32¡¨â
  339.  
  340.         stdcall sign_init, 3000
  341.         mov eax,el_opt_beg+el_offs_nam
  342.         mov ecx,(el_opt_beg.end-el_opt_beg)/size_el_opt ;ª®««¨ç¥á⢮ ⨯®¢ í«¥¬¥­â®¢
  343.         cld
  344.         @@:
  345.                 stdcall [tl_node_add], eax, el_icon_elems shl 16, tree2
  346.                 stdcall [tl_cur_next], tree2
  347.                 add eax,size_el_opt
  348.                 loop @b
  349.         stdcall [tl_cur_beg], tree2
  350.  
  351.         ;*** ãáâ ­®¢ª  ¢à¥¬¥­¨ ¤«ï â ©¬¥à 
  352.         mcall 26,9
  353.         mov [last_time],eax
  354.  
  355. align 4
  356. red_win:
  357.         call draw_window
  358.  
  359. align 4
  360. still:
  361.         mcall 26,9
  362.         mov ebx,[last_time]
  363.         add ebx,10 ;§ ¤¥à¦ª 
  364.         cmp ebx,eax
  365.         jge @f
  366.                 mov ebx,eax
  367.         @@:
  368.         sub ebx,eax
  369.         ;cmp ebx,10 ;§ ¤¥à¦ª 
  370.         ;ja timer_funct
  371.         ;test ebx,ebx
  372.         ;jz timer_funct
  373.         mcall 23
  374.         cmp eax,0
  375.         je timer_funct
  376.  
  377.         cmp al,1
  378.         jz red_win
  379.         cmp al,EV_KEY
  380.         jz key
  381.         cmp al,3
  382.         jz button
  383.         cmp al,EV_MOUSE
  384.         jne @f
  385.                 call mouse
  386.         @@:
  387.         jmp still
  388.  
  389. align 4
  390. timer_funct:
  391.         pushad
  392.         mcall 26,9
  393.         mov [last_time],eax
  394.  
  395.         cmp byte[tim_ch],0
  396.         je @f
  397.                 inc dword[time]
  398.         cmp dword[opt_fast_mode],0
  399.         jne .fast_m
  400.                 call sign_move
  401.                 stdcall [buf2d_draw], buf_0
  402.                 mov eax,[time]
  403.                 xor edx,edx
  404.                 div dword[opt_sign_moves]
  405.                 cmp edx,0 ;¯à®¢¥à塞 ªà â­®áâì opt_sign_moves
  406.                 jnz @f
  407.                         call sign_from_elems
  408.                         call sign_from_captions
  409.                 jmp @f
  410.         .fast_m:
  411.                 mov ecx,[opt_sign_moves]
  412.                 cld
  413.                 .cycle:
  414.                 call sign_move
  415.                 loop .cycle
  416.                 call sign_from_elems
  417.                 call sign_from_captions
  418.                 stdcall [buf2d_draw], buf_0
  419.         @@:
  420.  
  421.         popad
  422.         jmp still
  423.  
  424. align 4
  425. mouse:
  426.         stdcall [tl_mouse], tree1
  427.         stdcall [tl_mouse], tree2
  428.  
  429.         pushad
  430.         mcall 37,2 ;­ ¦ âë¥ ª­®¯ª¨ ¬ëè¨
  431.         bt eax,0 ;«¥¢ ï ª­®¯ª  ­ ¦ â ?
  432.         jc @f
  433.         bt eax,1 ;¯à ¢ ï ª­®¯ª  ­ ¦ â ?
  434.         jc @f
  435.                 xor eax,eax
  436.                 mov [pen_coord_x],eax
  437.                 mov [pen_coord_y],eax
  438.                 jmp .end_buf_wnd
  439.         @@:
  440.         mov esi,eax
  441.  
  442.         mcall 37,1 ;eax = (x shl 16) + y
  443.         cmp ax,word[buf_0.t]
  444.         jl .end_buf_wnd ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ y
  445.  
  446.         mov ebx,eax
  447.         shr ebx,16
  448.         cmp bx,word[buf_0.l]
  449.         jl .end_buf_wnd ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ x
  450.  
  451.                 and eax,0xffff ;®áâ ¢«ï¥¬ ª®®à¤¨­ âã y
  452.                 sub ax,word[buf_0.t]
  453.                 sub bx,word[buf_0.l]
  454.                 ;*** ¤¥«¥­¨¥ ­  zoom
  455.                 movzx ecx,byte[zoom]
  456.                 xor edx,edx
  457.                 div ecx
  458.                 xchg eax,ebx ;ebx ¤¥«¨¬ ­  ecx
  459.                 xor edx,edx
  460.                 div ecx
  461.  
  462.                 sub eax,[Cor_x]
  463.                 sub ebx,[Cor_y]
  464.  
  465.                 ;*** ¯à®¢¥àª  ­  ¯®¯ ¤¥­¨¥ ¢ á奬ã
  466.                 bt eax,31
  467.                 jc .end_buf_wnd
  468.                 bt ebx,31
  469.                 jc .end_buf_wnd
  470.                 cmp eax,[shem_w]
  471.                 jge .end_buf_wnd
  472.                 cmp ebx,[shem_h]
  473.                 jge .end_buf_wnd
  474.  
  475.                 cmp byte[pen_mode],0
  476.                 jne .end_mode_0
  477.                         bt esi,1
  478.                         jc .end_mode_0
  479.                         ;०¨¬ ªãàá®à  (¢ë¡®à í«¥¬¥­â  ¯à¨ ­ ¦ â¨¨)
  480.                         stdcall element_is_click,eax,ebx
  481.                         test eax,eax
  482.                         jz .end_buf_wnd ;¯à¨ ­ ¦ â¨¨ ­¥ ¯®¯ «¨ ­¨ ­  ®¤¨­ ¨§ í«¥¬¥­â®¢
  483.                                 stdcall [tl_node_get_data], tree1
  484.                                 pop ebx
  485.                                 cmp eax,ebx
  486.                                 je .end_buf_wnd ;¥á«¨ 㦥 ªãàá®à á⮨â â ¬ £¤¥ ­ã¦­®
  487.                                
  488.                                 stdcall [tl_cur_beg], tree1
  489.                                 .cycle0:
  490.                                 stdcall [tl_node_get_data], tree1
  491.                                 pop ebx
  492.                                 test ebx,ebx
  493.                                 jz .end_buf_wnd
  494.                                 cmp eax,ebx
  495.                                 je @f
  496.                                         stdcall [tl_cur_next], tree1
  497.                                         jmp .cycle0
  498.                                 @@:
  499.                                 stdcall [tl_draw], tree1
  500.                         jmp .end_buf_wnd
  501.                 .end_mode_0:
  502.                 cmp byte[pen_mode],1
  503.                 jne .end_mode_1
  504.                         ;०¨¬ à¨á®¢ ­¨ï ¯à®¢®¤ 
  505.                         cmp dword[pen_coord_x],0
  506.                         jne @f
  507.                         cmp dword[pen_coord_y],0
  508.                         jne @f
  509.                                 mov [pen_coord_x],eax
  510.                                 mov [pen_coord_y],ebx
  511.                         @@:
  512.  
  513.                         cmp dword[pen_coord_x],eax
  514.                         je .beg_draw
  515.                         cmp dword[pen_coord_y],ebx
  516.                         je .beg_draw
  517.  
  518.                         mov ecx,eax
  519.                         sub ecx,[pen_coord_x]
  520.                         bt ecx,31
  521.                         jnc @f
  522.                                 neg ecx
  523.                                 inc ecx
  524.                         @@:
  525.                         mov edx,ebx
  526.                         sub edx,[pen_coord_y]
  527.                         bt edx,31
  528.                         jnc @f
  529.                                 neg edx
  530.                                 inc edx
  531.                         @@:
  532.                         cmp ecx,edx
  533.                         jl @f
  534.                                 mov ebx,[pen_coord_y] ;¯à¨¢ï§ª  ª ª®®à¤¨­ â¥ y
  535.                                 jmp .beg_draw
  536.                         @@:
  537.                         mov eax,[pen_coord_x] ;¯à¨¢ï§ª  ª ª®®à¤¨­ â¥ x
  538.  
  539.                         .beg_draw:
  540.                         bt esi,1
  541.                         jc @f
  542.                                 stdcall pole_cell_creat, pole,eax,ebx,0
  543.                                 ;­¨ç¥£® ­¥ ã¡à «®áì redraw_pole ­¥ ¯®¤å®¤¨â, â. ª. ç¨áâ¨âì ¯®«¥ ­¥ ­ã¦­®
  544.                                 stdcall pole_paint, pole
  545.                                 stdcall [buf2d_draw], buf_0
  546.                                 jmp .end_buf_wnd
  547.                         @@:
  548.                                 stdcall pole_cell_delete, pole,eax,ebx
  549.                                 call redraw_pole
  550.                                 jmp .end_buf_wnd
  551.                 .end_mode_1:
  552.                 cmp byte[pen_mode],2
  553.                 jne @f
  554.                         ;०¨¬ à¨á®¢ ­¨ï ¨§®«ï樨 ¤«ï ¯à®¢®¤ 
  555.                         bt esi,1
  556.                         jc .mode_2_del
  557.                                 stdcall pole_cell_creat, pole,eax,ebx,2
  558.                                 jmp .mode_2_draw
  559.                         .mode_2_del:
  560.                                 ;áâ¨à ­¨¥ ¨§®«ï樨
  561.                                 mov ecx,eax
  562.                                 stdcall pole_cell_find, pole,ecx,ebx
  563.                                 test eax,eax
  564.                                 jz .end_buf_wnd
  565.                                 stdcall pole_cell_creat, pole,ecx,ebx,0
  566.                         .mode_2_draw:
  567.                         stdcall pole_paint, pole
  568.                         stdcall [buf2d_draw], buf_0
  569.                         jmp .end_buf_wnd
  570.                 @@:
  571.                 cmp byte[pen_mode],3
  572.                 jne @f
  573.                         bt esi,1
  574.                         jc @f
  575.                         ;०¨¬ áâ¨à ­¨ï ¯à®¢®¤ 
  576.                         stdcall pole_cell_delete, pole,eax,ebx
  577.                         call redraw_pole
  578.                         jmp .end_buf_wnd
  579.                 @@:
  580.                 cmp byte[pen_mode],4
  581.                 jne @f
  582.                         bt esi,1
  583.                         jc .rotate
  584.                         ;०¨¬ ᮧ¤ ­¨ï í«¥¬¥­â®¢
  585.                         stdcall shem_element_creat, eax,ebx
  586.                         stdcall pole_paint, pole
  587.                         stdcall [buf2d_draw], buf_0
  588.                         jmp .end_buf_wnd
  589.                         .rotate:
  590.                         ;¯®¢®à®â í«¥¬¥­â®¢ ­  90 £à ¤ãᮢ
  591.                         stdcall element_is_click,eax,ebx
  592.                         test eax,eax
  593.                         jz .end_buf_wnd
  594.                                 inc byte[eax+sp_offs_el_angle]
  595.                                 and byte[eax+sp_offs_el_angle],3 ;¤«ï ª®­âà®«ï ­  ¯¥à¥¯®«­¥­¨¥
  596.                                 call redraw_pole
  597.                         jmp .end_buf_wnd
  598.                 @@:
  599.  
  600.         .end_buf_wnd:
  601. if debug
  602. stdcall but_test_pole, pole
  603. end if
  604.         popad
  605.         ret
  606.  
  607. ;output:
  608. ; eax - pointer to element data
  609. align 4
  610. proc element_is_click uses ebx ecx edx esi edi, coord_x:dword, coord_y:dword
  611.         stdcall dword[tl_node_poi_get_info],0,tree1
  612.         pop esi
  613.         @@:
  614.                 cmp esi,0
  615.                 je @f
  616.                 cmp word[esi],el_icon_elems ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
  617.                 jne .end_add_p1
  618.                         stdcall [tl_node_poi_get_data], esi, tree1
  619.                         pop ecx
  620.  
  621.                         movzx edx,byte[ecx+sp_offs_el_type]
  622.                         imul edx,size_el_opt
  623.                         add edx,el_opt_beg ;­ å®¤¨¬ ®¯æ¨î ᮠ᢮©á⢠¬¨ ¤ ­­®£® í«¥¬¥­â 
  624.  
  625.                         mov eax,[ecx] ;element coord x
  626.                         mov ebx,[ecx+4] ;element coord y
  627.                         movzx edi,byte[ecx+sp_offs_el_angle]
  628.                         push edi
  629.                         movzx edi,byte[edx+el_offs_box_y]
  630.                         dec edi
  631.                         push edi
  632.                         movzx edi,byte[edx+el_offs_box_x]
  633.                         dec edi
  634.                         push edi
  635.                         stdcall move_rotate_n90 ;,[edx+el_offs_box_x],[edx+el_offs_box_y],[ecx+sp_offs_el_angle]
  636.                         ;Rect(eax,ebx,[ecx],[ecx+4])
  637.                         stdcall point_in_rect, [coord_x],[coord_y], eax,ebx,[ecx],[ecx+4]
  638.                         test eax,eax
  639.                         jz .end_add_p1
  640.                                 mov eax,ecx
  641.                                 jmp .end_f
  642.                 .end_add_p1:
  643.                 stdcall dword[tl_node_poi_get_next_info],esi,tree1
  644.                 pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  645.                 jmp @b
  646.         @@:
  647.                 xor eax,eax ;¥á«¨ ­¥ ­ è«¨
  648.         .end_f:
  649.         ret
  650. endp
  651.  
  652. ;¯à®¢¥àª  ¯®¯ ¤¥­¨ï â®çª¨ ¢ ¯àאַ㣮«ì­¨ª
  653. ;१ã«ìâ â:
  654. ; ¥á«¨ ­¥ ¯®¯ ¤ ¥â â® eax=0
  655. ; ¥á«¨ ¯®¯ ¤ ¥â â® eax=1
  656. align 4
  657. proc point_in_rect uses ebx ecx, px:dword, py:dword, rx0:dword, ry0:dword, rx1:dword, ry1:dword
  658.         xor eax,eax
  659.  
  660.         ;¯à®¢¥àª  ¯® ®á¨ x
  661.         mov ebx,[rx0]
  662.         mov ecx,[rx1]
  663.         cmp ebx,ecx
  664.         jle @f
  665.                 xchg ebx,ecx
  666.         @@:
  667.         cmp ebx,[px]
  668.         jg .no_contains
  669.         cmp ecx,[px]
  670.         jl .no_contains
  671.  
  672.         ;¯à®¢¥àª  ¯® ®á¨ y
  673.         mov ebx,[ry0]
  674.         mov ecx,[ry1]
  675.         cmp ebx,ecx
  676.         jle @f
  677.                 xchg ebx,ecx
  678.         @@:
  679.         cmp ebx,[py]
  680.         jg .no_contains
  681.         cmp ecx,[py]
  682.         jl .no_contains
  683.  
  684.         ;¥á«¨ ¯®¯ «¨ â® eax=1
  685.                 inc eax
  686.                 ;stdcall draw_scaled_rect, [rx0],[ry0],[rx1],[ry1], 0xffffff
  687.                 ;stdcall [buf2d_draw], buf_0
  688.         .no_contains:
  689.         ret
  690. endp
  691.  
  692. align 4
  693. draw_window:
  694. pushad
  695.         mcall 12,1
  696.  
  697.         ; *** à¨á®¢ ­¨¥ £« ¢­®£® ®ª­  (¢ë¯®«­ï¥âáï 1 à § ¯à¨ § ¯ã᪥) ***
  698.         xor eax,eax
  699.         mov ebx,(20 shl 16)+580
  700.         mov ecx,(20 shl 16)+415
  701.         mov edx,[sc.work]
  702.         or  edx,(3 shl 24)+0x10000000+0x20000000
  703.         mov edi,caption
  704.         int 0x40
  705.  
  706.         ; *** ᮧ¤ ­¨¥ ª­®¯®ª ­  ¯ ­¥«ì ***
  707.         mov eax,8
  708.         mov ebx,(5 shl 16)+20
  709.         mov ecx,(panel_0_coord_top shl 16)+20
  710.         mov edx,3
  711.         mov esi,[sc.work_button]
  712.         int 0x40
  713.  
  714.         add ebx,25 shl 16
  715.         mov edx,4
  716.         int 0x40
  717.  
  718.         add ebx,25 shl 16
  719.         mov edx,5
  720.         int 0x40
  721.  
  722.         add ebx,30 shl 16
  723.         mov edx,6 ;¯ã᪠| ®áâ ­®¢ª 
  724.         int 0x40
  725.  
  726.         add ebx,25 shl 16
  727.         mov edx,7
  728.         int 0x40
  729.  
  730.         add ebx,25 shl 16
  731.         mov edx,8
  732.         int 0x40
  733.  
  734.         add ebx,25 shl 16
  735.         mov edx,9
  736.         int 0x40
  737.  
  738.         add ebx,25 shl 16
  739.         mov edx,10
  740.         int 0x40
  741.  
  742.         add ebx,25 shl 16
  743.         mov edx,11
  744.         int 0x40
  745.  
  746.         add ebx,25 shl 16
  747.         mov edx,12
  748.         int 0x40
  749.  
  750.         add ebx,30 shl 16
  751.         mov edx,13 ;業â஢ª  á奬ë
  752.         int 0x40
  753.  
  754.         add ebx,25 shl 16
  755.         mov edx,14
  756.         int 0x40
  757.  
  758.         add ebx,25 shl 16
  759.         mov edx,15
  760.         int 0x40
  761.  
  762.         add ebx,25 shl 16
  763.         mov edx,16 ;ᤢ¨£ áå¥¬ë ¢¢¥àå
  764.         int 0x40
  765.  
  766.         add ebx,25 shl 16
  767.         mov edx,17 ;ᤢ¨£ áå¥¬ë ¢­¨§
  768.         int 0x40
  769.  
  770.         ; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
  771.         mov eax,7
  772.         mov ebx,[image_data_toolbar]
  773.         mov ecx,(16 shl 16)+16
  774.         mov edx,(7 shl 16)+panel_0_coord_top+2 ;icon new
  775.         int 0x40
  776.  
  777.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  778.         add edx,(25 shl 16) ;icon open
  779.         int 0x40
  780.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  781.         add edx,(25 shl 16) ;icon save
  782.         int 0x40
  783.  
  784.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  785.         add edx,(30 shl 16) ;+
  786.         int 0x40
  787.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  788.         add edx,(25 shl 16) ;-
  789.         int 0x40
  790.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  791.         add edx,(25 shl 16) ;
  792.         int 0x40
  793.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  794.         add edx,(25 shl 16) ;m
  795.         int 0x40
  796.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  797.         add edx,(25 shl 16) ;m
  798.         int 0x40
  799.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  800.         add edx,(25 shl 16) ;m
  801.         int 0x40
  802.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  803.         add edx,(25 shl 16) ;m
  804.         int 0x40
  805.  
  806.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  807.         add edx,(30 shl 16) ;center
  808.         int 0x40
  809.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  810.         add edx,(25 shl 16) ;m
  811.         int 0x40
  812.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  813.         add edx,(25 shl 16) ;m
  814.         int 0x40
  815.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  816.         add edx,(25 shl 16) ;m
  817.         int 0x40
  818.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  819.         add edx,(25 shl 16) ;m
  820.         int 0x40
  821.  
  822.         ; *** à¨á®¢ ­¨¥ ¡ãä¥à  ***
  823.         stdcall [buf2d_draw], buf_0
  824.         mov dword[wScr1.all_redraw],1
  825.         stdcall [tl_draw], tree1
  826.         mov dword[wScr2.all_redraw],1
  827.         stdcall [tl_draw], tree2
  828.         stdcall pole_draw_pok, pole
  829.  
  830.         ; *** ᮧ¤ ­¨¥ ª­®¯®ª ãáâ ­®¢ª¨ ᨣ­ «®¢ set_0 ¨ set_1 ***
  831.         mov eax,8
  832.         mov ebx,(5 shl 16)+20
  833.         mov ecx,(panel_1_coord_top shl 16)+20
  834.         mov edx,20
  835.         mov esi,[sc.work_button]
  836.         int 0x40
  837.  
  838.         add ebx,25 shl 16
  839.         mov edx,21
  840.         int 0x40
  841.  
  842.         add ebx,30 shl 16
  843.         mov edx,22
  844.         int 0x40
  845.  
  846.         add ebx,25 shl 16
  847.         mov edx,23
  848.         int 0x40
  849.  
  850.         add ebx,25 shl 16
  851.         mov edx,24
  852.         int 0x40
  853.  
  854.         add ebx,25 shl 16
  855.         mov edx,25
  856.         int 0x40
  857.  
  858.         mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
  859.         mov ebx,(10 shl 16)+panel_1_coord_top+5
  860.         mov ecx,[sc.work_text]
  861.         or  ecx,0x80000000 ;or (1 shl 30)
  862.         mov edx,txt_set_0
  863.         ;mov edi,[sc.work]
  864.         int 0x40
  865.  
  866.         add ebx,25 shl 16
  867.         mov edx,txt_set_1
  868.         int 0x40
  869.  
  870.         ; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
  871.         mov eax,7
  872.         mov ebx,[image_data_toolbar]
  873.         mov ecx,(16 shl 16)+16
  874.         mov edx,(62 shl 16)+panel_1_coord_top+2
  875.  
  876.         add ebx,IMAGE_TOOLBAR_ICON_SIZE*15
  877.         int 0x40
  878.  
  879.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  880.         add edx,(25 shl 16)
  881.         int 0x40
  882.  
  883.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  884.         add edx,(25 shl 16)
  885.         int 0x40
  886.  
  887.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  888.         add edx,(25 shl 16)
  889.         int 0x40
  890.  
  891.         ; *** ᮧ¤ ­¨¥ ª­®¯®ª à¨á®¢ ­¨ï ¯à®¢®¤  ***
  892.         mov eax,8
  893.         mov ebx,(5 shl 16)+20
  894.         mov ecx,(panel_2_coord_top shl 16)+20
  895.         mov edx,30
  896.         mov esi,[sc.work_button]
  897.         int 0x40
  898.  
  899.         add ebx,30 shl 16
  900.         mov edx,31
  901.         int 0x40
  902.  
  903.         add ebx,25 shl 16
  904.         mov edx,32
  905.         int 0x40
  906.  
  907.         add ebx,25 shl 16
  908.         mov edx,33
  909.         int 0x40
  910.  
  911.         add ebx,25 shl 16
  912.         mov edx,34
  913.         int 0x40
  914.  
  915.         add ebx,25 shl 16
  916.         mov edx,35
  917.         int 0x40
  918.  
  919.         ; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
  920.         mov eax,7
  921.         mov ebx,[image_data_toolbar]
  922.         mov ecx,(16 shl 16)+16
  923.         mov edx,(7 shl 16)+panel_2_coord_top+2 ;¨ª®­ª  áâ५ 
  924.  
  925.         add ebx,IMAGE_TOOLBAR_ICON_SIZE*19
  926.         int 0x40
  927.  
  928.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  929.         add edx,(30 shl 16) ;icon - à¨á®¢ ­¨¥ ¯à®¢®¤ 
  930.         int 0x40
  931.  
  932.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  933.         add edx,(25 shl 16) ;icon - à¨á®¢ ­¨¥ ¯¥à¥á¥ç¥­¨© ¯à®¢®¤®¢
  934.         int 0x40
  935.  
  936.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  937.         add edx,(25 shl 16) ;icon - à¨á®¢ ­¨¥ «®£¨ç¥áª¨å í«¥¬¥­â®¢
  938.         int 0x40
  939.  
  940.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  941.         add edx,(25 shl 16) ;icon - à¨á®¢ ­¨¥ ¯®¤¯¨á¥©
  942.         int 0x40
  943.  
  944.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  945.         add edx,(25 shl 16) ;icon - § â¨à çª 
  946.         int 0x40
  947.  
  948.         mcall 12,2
  949. popad
  950.         ret
  951.  
  952. align 4
  953. key:
  954.         mcall 2
  955.         stdcall [tl_key], dword tree1
  956.         stdcall [tl_key], dword tree2
  957.         jmp still
  958.  
  959.  
  960. align 4
  961. button:
  962.         mcall 17
  963.         cmp ah,3
  964.         jne @f
  965.                 call but_new_file
  966.         @@:
  967.         cmp ah,4
  968.         jne @f
  969.                 call but_open_file
  970.         @@:
  971.         cmp ah,5
  972.         jne @f
  973.                 call but_save_file
  974.         @@:
  975.         cmp ah,6
  976.         jne @f
  977.                 call but_run_stop
  978.         @@:
  979.         cmp ah,7
  980.         jne @f
  981.                 call but_zoom_p
  982.         @@:
  983.         cmp ah,8
  984.         jne @f
  985.                 call but_zoom_m
  986.         @@:
  987.         cmp ah,9
  988.         jne @f
  989.                 call but_pole_left
  990.         @@:
  991.         cmp ah,10
  992.         jne @f
  993.                 call but_pole_right
  994.         @@:
  995.         cmp ah,11
  996.         jne @f
  997.                 call but_pole_up
  998.         @@:
  999.         cmp ah,12
  1000.         jne @f
  1001.                 call but_pole_dn
  1002.         @@:
  1003.         cmp ah,13
  1004.         jne @f
  1005.                 call but_center
  1006.         @@:
  1007.  
  1008.         ;¯¥à¥¤¢¨¦¥­¨¥ ¢á¥å ®¡ê¥ªâ®¢ á奬ë
  1009.         cmp byte[tim_ch],0
  1010.         jne .no_move
  1011.         cmp ah,14
  1012.         jne @f
  1013.                 stdcall pole_move_all, pole, -1, 0
  1014.                 call redraw_pole
  1015.         @@:
  1016.         cmp ah,15
  1017.         jne @f
  1018.                 stdcall pole_move_all, pole, 1, 0
  1019.                 call redraw_pole
  1020.         @@:
  1021.         cmp ah,16 ;ᤢ¨£ áå¥¬ë ¢¢¥àå
  1022.         jne @f
  1023.                 stdcall pole_move_all, pole, 0, -1
  1024.                 call redraw_pole
  1025.         @@:
  1026.         cmp ah,17 ;ᤢ¨£ áå¥¬ë ¢­¨§
  1027.         jne @f
  1028.                 stdcall pole_move_all, pole, 0, 1
  1029.                 call redraw_pole
  1030.         @@:
  1031.         .no_move:
  1032.  
  1033.         cmp ah,20
  1034.         jne @f
  1035.                 call but_set_0
  1036.         @@:
  1037.         cmp ah,21
  1038.         jne @f
  1039.                 call but_set_1
  1040.         @@:
  1041.         cmp ah,22
  1042.         jne @f
  1043.                 call but_mov_l
  1044.         @@:
  1045.         cmp ah,23
  1046.         jne @f
  1047.                 call but_mov_r
  1048.         @@:
  1049.         cmp ah,24
  1050.         jne @f
  1051.                 call but_mov_u
  1052.         @@:
  1053.         cmp ah,25
  1054.         jne @f
  1055.                 call but_mov_d
  1056.         @@:
  1057.         cmp ah,30
  1058.         jne @f
  1059.                 call but_set_none
  1060.         @@:
  1061.         cmp ah,31
  1062.         jne @f
  1063.                 stdcall set_pen_mode,1,0,((9 shl 8)+9) shl 16 ;ãáâ ­®¢ª  ०¨¬  à¨á®¢ ­¨ï ¯à®¢®¤ 
  1064.         @@:
  1065.         cmp ah,32
  1066.         jne @f
  1067.                 stdcall set_pen_mode,2,1,((9 shl 8)+9) shl 16
  1068.         @@:
  1069.         cmp ah,33
  1070.         jne @f
  1071.                 stdcall set_pen_mode,4,3,((9 shl 8)+9) shl 16 ;ãáâ ­®¢ª  ०¨¬  ᮧ¤ ­¨ï í«¥¬¥­â®¢
  1072.         @@:
  1073.         cmp ah,35
  1074.         jne @f
  1075.                 stdcall set_pen_mode,3,2,((15 shl 8)+9) shl 16 ;ãáâ ­®¢ª  ०¨¬  áâ¨à ­¨ï ¯à®¢®¤ 
  1076.         @@:
  1077.         cmp ah,1
  1078.         jne still
  1079. .exit:
  1080.         stdcall [buf2d_delete],buf_0
  1081.         stdcall [buf2d_delete],buf_font
  1082.         stdcall [buf2d_delete],buf_curs
  1083.         stdcall mem.Free,[image_data_toolbar]
  1084.         stdcall pole_delete, pole
  1085.         call sign_delete
  1086.         stdcall [tl_data_clear], tree1
  1087.         ;ç¨á⨬ 㪠§ â¥«¨ ­  ¨§®¡à ¦¥­¨ï, ª®â®àë¥ ¡ë«¨ ®¡é¨¬¨ ¤«ï «¨á⮢ ¨ 㤠«¥­ë «¨á⮬ tree1
  1088.         mov dword[tree2.data_img_sys],0
  1089.         mov dword[tree2.data_img],0
  1090.         stdcall [tl_data_clear], tree2
  1091.         cmp [cursor_pointer],0
  1092.         je @f
  1093.                 mcall 37,6,[cursor_pointer]
  1094.         @@:
  1095.         mcall -1
  1096.  
  1097. ;ᮧ¤ ­¨¥ ­®¢®© á奬ë
  1098. align 4
  1099. proc but_new_file uses eax
  1100.         call but_set_none
  1101.         stdcall [tl_info_clear],tree1
  1102.         stdcall [tl_draw],tree1
  1103.         xor eax,eax
  1104.         mov [shem_elems],eax
  1105.         mov [shem_captions],eax
  1106.         stdcall pole_clear, pole
  1107.         call redraw_pole
  1108.         ret
  1109. endp
  1110.  
  1111. align 4
  1112. f_size dd 0 ;à §¬¥à ®âªà뢠¥¬®£® ä ©« 
  1113. shem_w dd 192 ;è¨à¨­  á奬ë
  1114. shem_h dd 128 ;¢ëá®â  á奬ë
  1115. shem_points dd 0 ;ª®««¨ç¥á⢮ 㧫®¢ ­  á奬¥
  1116. shem_sub_points dd 0 ;ª®««¨ç¥á⢮ ¨§®«¨à®¢ ­­ëå 㧫®¢ ­  á奬¥
  1117. shem_elems dd 0 ;ª®««¨ç¥á⢮ í«¥¬¥­â®¢ ­  á奬¥
  1118. shem_captions dd 0
  1119. shem_colors:
  1120.         dd color_s0, color_s1, color_s2, color_s3
  1121. color_captions dd 0x808080
  1122.  
  1123. align 4
  1124. open_file_lif:
  1125.         rb 2*4096 ;®¡« áâì ¤«ï ®âªàëâ¨ï ä ©«®¢
  1126. .end:
  1127.  
  1128. align 4
  1129. but_open_file:
  1130.         pushad
  1131.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  1132.         mov [OpenDialog_data.type],0
  1133.         stdcall [OpenDialog_Start],OpenDialog_data
  1134.         cmp [OpenDialog_data.status],1 ;0 - Cancel 1 - Open 2 - Error open dialog
  1135.         jne .end_open_file
  1136.         ;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
  1137.  
  1138.         mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
  1139.         mov [run_file_70.Function], 0
  1140.         mov [run_file_70.Position], 0
  1141.         mov [run_file_70.Flags], 0
  1142.         mov dword[run_file_70.Count], open_file_lif.end-open_file_lif
  1143.         m2m [run_file_70.Buffer], open_file_lif
  1144.         mov byte[run_file_70+20], 0
  1145.         mov dword[run_file_70.FileName], openfile_path
  1146.         mov ebx,run_file_70
  1147.         int 0x40 ;§ £à㦠¥¬ ä ©«
  1148.         cmp ebx,0xffffffff
  1149.         je .end_open_file
  1150.  
  1151.                 mov dword[f_size],ebx
  1152.                 add ebx,open_file_lif
  1153.                 mov byte[ebx],0 ;­  á«ãç © ¥á«¨ à ­¥¥ ¡ë« ®âªàëâ ä ©« ¡®«ì襣® à §¬¥à  ç¨á⨬ ª®­¥æ ¡ãä¥à  á ä ©«®¬
  1154.                 mcall 71,1,openfile_path
  1155.                 ;---
  1156.  
  1157.                 ;§ ¤ ¥¬ ¬¨­¨¬ «ì­ë¥ §­ ç¥­¨ï, ­  á«ãç © ¥á«¨ ¢ ä ©«¥ ¡ã¤ãâ ­¥ª®à¥ªâ­ë¥ à §¬¥àë
  1158.                 mov dword[shem_w],5
  1159.                 mov dword[shem_h],5
  1160.  
  1161.                 mov esi,txt_size
  1162.                 call str_analiz_r
  1163.                 cmp edi,0
  1164.                 je @f
  1165.                         stdcall str_len,esi
  1166.                         add edi,eax
  1167.                         stdcall conv_str_to_int,edi
  1168.                         cmp eax,5
  1169.                         jl @f ;®è¨¡ª  ¢ ä ©«¥ (­  .end_open_file ­¥ ¯¥à¥å®¤¨¬, ¯ëâ ¥¬áï ¯à®ç¨â âì ¤àã£ãî ¨­ä®à¬ æ¨î)
  1170.                         mov dword[shem_w],eax
  1171.  
  1172.                         call str_next_val
  1173.                         stdcall conv_str_to_int,edi
  1174.                         cmp eax,5
  1175.                         jl @f ;®è¨¡ª  ¢ ä ©«¥
  1176.                         mov dword[shem_h],eax
  1177.                 @@:
  1178.  
  1179.                 stdcall [tl_info_clear],tree1
  1180.  
  1181.                 ;*** ¤®¡ ¢«¥­¨¥ ¢ ᯨ᮪ «®£¨ç¥áª¨å í«¥¬¥­â®¢ ***
  1182.                 stdcall [tl_node_add], txt_elements-capt_offs,(el_icon_group shl 16), tree1
  1183.                 stdcall [tl_cur_next], tree1
  1184.  
  1185.                 mov esi,txt_elements
  1186.                 call str_analiz_r
  1187.                 cmp edi,0
  1188.                 je .end_elems
  1189.                         stdcall str_len,esi
  1190.                         add edi,eax
  1191.                         stdcall conv_str_to_int,edi
  1192.                         cmp eax,0
  1193.                         jle .end_elems ;¥á«¨ ç¨á«® í«¥¬¥­â®¢ = 0
  1194.                         mov [shem_elems],eax
  1195.                         mov ecx,eax
  1196.                         .cycle_elem:
  1197.                                 call str_next_val
  1198.                                 stdcall conv_str_to_int,edi
  1199.                                 mov dword[txt_buf],eax ;ª®®à¤¨­ â  x
  1200.                                 call str_next_val
  1201.                                 stdcall conv_str_to_int,edi
  1202.                                 mov dword[txt_buf+4],eax ;ª®®à¤¨­ â  y
  1203.                                 call str_next_val
  1204.                                 stdcall conv_str_to_int,edi
  1205.                                 mov byte[txt_buf+sp_offs_el_angle],al ;­ ¯à ¢«¥­¨¥
  1206.                                 call str_next_val
  1207.                                 ;¯®  ¤à¥áã edi ­ §¢ ­¨¥ í«¥¬¥­â 
  1208.                                 stdcall el_get_name, edi,13 ;13 - ascii code
  1209.                                 mov byte[txt_buf+sp_offs_el_type],al ;⨯ í«¥¬¥­â 
  1210.  
  1211.                                 stdcall make_list_capts,txt_buf,edi
  1212.  
  1213.                                 stdcall [tl_node_add], txt_buf,(el_icon_elems shl 16)+1, tree1
  1214.                                 stdcall [tl_cur_next], tree1
  1215.                                 dec ecx
  1216.                                 jnz .cycle_elem
  1217.                 .end_elems:
  1218.  
  1219.                 ;*** ¤®¡ ¢«¥­¨¥ ¢ ᯨ᮪ ⥪á⮢ëå ¯®¤¯¨á¥© ***
  1220.                 stdcall [tl_node_add], txt_captions-capt_offs,(el_icon_group shl 16), tree1
  1221.                 stdcall [tl_cur_next], tree1
  1222.  
  1223.                 mov esi,txt_captions
  1224.                 call str_analiz_r
  1225.                 cmp edi,0
  1226.                 je .end_captions
  1227.                         stdcall str_len,esi
  1228.                         add edi,eax
  1229.                         stdcall conv_str_to_int,edi
  1230.                         cmp eax,0
  1231.                         jle .end_captions ;¥á«¨ ç¨á«® ¯®¤¯¨á¥© = 0
  1232.                         mov [shem_captions],eax
  1233.                         mov ecx,eax
  1234.                         .cycle_captions:
  1235.                                 call str_next_val
  1236.                                 stdcall conv_str_to_int,edi
  1237.                                 mov dword[txt_buf],eax ;ª®®à¤¨­ â  x
  1238.                                 call str_next_val
  1239.                                 stdcall conv_str_to_int,edi
  1240.                                 mov dword[txt_buf+4],eax ;ª®®à¤¨­ â  y
  1241.                                 call str_next_val
  1242.                                 mov al,byte[edi]
  1243.                                 mov byte[txt_buf+8],al ;¢¨¤ ¯®¤¯¨á¨ ('z' - ᨣ­ « á 0, 'o' - ᨣ­ « á 1, 'n' - ­¥â ᨣ­ « )
  1244.                                 call str_next_val
  1245.  
  1246.                                 stdcall make_list_capts,txt_buf,edi
  1247.  
  1248.                                 stdcall [tl_node_add], txt_buf,(el_icon_captions shl 16)+1, tree1
  1249.                                 stdcall [tl_cur_next], tree1
  1250.                                 dec ecx
  1251.                                 jnz .cycle_captions
  1252.                 .end_captions:
  1253.  
  1254.                 mov byte[txt_buf+capt_offs],0 ;®¡­ã«¥­¨¥ ¯®¤¯¨á¥©
  1255.  
  1256.                 ;*** ¤®¡ ¢«¥­¨¥ ¢ ᯨ᮪ ª«î祢ëå â®ç¥ª ***
  1257.                 stdcall [tl_node_add], txt_points-capt_offs,(el_icon_group shl 16), tree1
  1258.                 stdcall [tl_cur_next], tree1
  1259.  
  1260.                 mov dword[shem_points],0
  1261.                 mov esi,txt_points
  1262.                 call str_analiz_r
  1263.                 cmp edi,0
  1264.                 je .end_points ;¥á«¨ ®¯¨á ­¨ï â®ç¥ª ­¥â ¢ ä ©«¥
  1265.                         stdcall str_len,esi
  1266.                         add edi,eax
  1267.                         stdcall conv_str_to_int,edi
  1268.                         cmp eax,0
  1269.                         jle .end_points ;¥á«¨ ç¨á«® â®ç¥ª = 0
  1270.                         mov [shem_points],eax
  1271.                         mov ecx,eax
  1272.                         .cycle_poi:
  1273.                                 call str_next_val
  1274.                                 stdcall conv_str_to_int,edi
  1275.                                 mov dword[txt_buf],eax ;ª®®à¤¨­ â  x
  1276.                                 call str_next_val
  1277.                                 stdcall conv_str_to_int,edi
  1278.                                 mov dword[txt_buf+4],eax ;ª®®à¤¨­ â  y
  1279.                                 call str_next_val
  1280.                                 stdcall conv_str_to_int,edi
  1281.                                 mov byte[txt_buf+8],al ;­ ¯à ¢«¥­¨ï
  1282.  
  1283. ;                               stdcall make_list_capts,txt_buf,0
  1284.  
  1285.                                 stdcall [tl_node_add], txt_buf,(el_icon_points shl 16)+1, tree1
  1286.                                 stdcall [tl_cur_next], tree1
  1287.                                 dec ecx
  1288.                                 jnz .cycle_poi
  1289.                 .end_points:
  1290.  
  1291.                 stdcall [tl_cur_beg], tree1
  1292.  
  1293.         ;*** ¤®¡ ¢«¥­¨¥ â®ç¥ç­ëå ®¡ê¥ªâ®¢ ***
  1294.         stdcall pole_clear, pole
  1295.         stdcall dword[tl_node_poi_get_info],0,tree1
  1296.         pop esi
  1297.         @@:
  1298.                 cmp esi,0
  1299.                 je @f
  1300.                 cmp word[esi],el_icon_points ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨, ¨ ¯à®¯ã᪠­¥ â®ç¥ç­ëå ®¡ê¥ªâ®¢
  1301.                 jne .end_add_p0
  1302.                         stdcall [tl_node_poi_get_data], esi, tree1
  1303.                         pop eax
  1304.                         stdcall pole_cell_creat, pole,dword[eax],dword[eax+4],0
  1305.                 .end_add_p0:
  1306.                 stdcall dword[tl_node_poi_get_next_info],esi,tree1
  1307.                 pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  1308.                 jmp @b
  1309.         @@:
  1310.         stdcall pole_sort, pole
  1311.  
  1312.         ;*** ¤®¡ ¢«¥­¨¥ â®ç¥ç­ëå ®¡ê¥ªâ®¢ (­  ®á­®¢¥ «®£¨ç¥áª¨å í«¥¬¥­â®¢) ***
  1313.         stdcall dword[tl_node_poi_get_info],0,tree1
  1314.         pop esi
  1315.         @@:
  1316.                 cmp esi,0
  1317.                 je @f
  1318.                 cmp word[esi],el_icon_elems ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
  1319.                 jne .end_add_p3
  1320.                         stdcall [tl_node_poi_get_data], esi, tree1
  1321.                         pop ecx
  1322.  
  1323.                         xor edx,edx ;edx - ­®¬¥à ¢å®¤­®© ­®£¨
  1324.                         .add_p1:
  1325.                                 stdcall el_get_leg_coords, ecx,edx
  1326.                                 test eax,eax
  1327.                                 jnz .add_beg1
  1328.                                 test ebx,ebx
  1329.                                 jnz .add_beg1
  1330.                                         jmp .end_add_p1 ;¥á«¨ ª®®à¤¨­ âë ­¥ ¢§ï«¨áì (eax=0 && ebx=0), ¢ë室 ¨§ 横« 
  1331.                                 .add_beg1:
  1332.                                 stdcall pole_cell_creat, pole,eax,ebx,0
  1333.                                 inc edx
  1334.                                 jmp .add_p1
  1335.                         .end_add_p1:
  1336.  
  1337.                         mov edx,(1 shl 16) ;edx - ­®¬¥à ¢ë室­®© ­®£¨
  1338.                         .add_p2:
  1339.                                 stdcall el_get_leg_coords, ecx,edx
  1340.                                 test eax,eax
  1341.                                 jnz .add_beg2
  1342.                                 test ebx,ebx
  1343.                                 jnz .add_beg2
  1344.                                         jmp .end_add_p2 ;¥á«¨ ª®®à¤¨­ âë ­¥ ¢§ï«¨áì (eax=0 && ebx=0), ¢ë室 ¨§ 横« 
  1345.                                 .add_beg2:
  1346.                                 stdcall pole_cell_creat, pole,eax,ebx,0
  1347.                                 inc edx
  1348.                                 jmp .add_p2
  1349.                         .end_add_p2:
  1350.  
  1351.                 .end_add_p3:
  1352.                 stdcall dword[tl_node_poi_get_next_info],esi,tree1
  1353.                 pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  1354.                 jmp @b
  1355.         @@:
  1356.         stdcall pole_sort, pole
  1357.  
  1358.         ;*** ¤®¡ ¢«¥­¨¥ â®ç¥ç­ëå ®¡ê¥ªâ®¢ (­  ®á­®¢¥ ¯®¤¯¨á¥©) ***
  1359.         stdcall dword[tl_node_poi_get_info],0,tree1
  1360.         pop esi
  1361.         @@:
  1362.                 cmp esi,0
  1363.                 je @f
  1364.                 cmp word[esi],el_icon_captions ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
  1365.                 jne .end_add_p6
  1366.                         stdcall [tl_node_poi_get_data], esi, tree1
  1367.                         pop ecx
  1368.                         cmp byte[ecx+8],'n'
  1369.                         je .end_add_p6
  1370.                                 stdcall pole_cell_creat, pole,[ecx],[ecx+4],0
  1371.                 .end_add_p6:
  1372.                 stdcall dword[tl_node_poi_get_next_info],esi,tree1
  1373.                 pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  1374.                 jmp @b
  1375.         @@:
  1376.         stdcall pole_sort, pole
  1377.  
  1378.         ;*** à¨á®¢ ­¨¥ ¯à®¢®¤®¢ (­  ®á­®¢¥ â®ç¥ç­ëå ®¡ê¥ªâ®¢) ***
  1379.         stdcall dword[tl_node_poi_get_info],0,tree1
  1380.         pop esi
  1381.         xor ecx,ecx
  1382.         @@:
  1383.                 cmp esi,0
  1384.                 je @f
  1385.                 cmp word[esi],el_icon_points ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨, ¨ ¯à®¯ã᪠­¥ â®ç¥ç­ëå ®¡ê¥ªâ®¢
  1386.                 jne .end_add_p4
  1387.                         stdcall [tl_node_poi_get_data], esi, tree1
  1388.                         pop eax
  1389.                         movzx ebx,byte[eax+8]
  1390.                         stdcall shem_create_line, dword[eax],dword[eax+4],ebx
  1391.                         add ecx,edx
  1392.                 .end_add_p4:
  1393.                 stdcall dword[tl_node_poi_get_next_info],esi,tree1
  1394.                 pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  1395.                 cmp ecx,250 ;ecx - ç¨á«® ¤®¡ ¢«¥­­ëå â®ç¥ª
  1396.                 jl @b
  1397.                 xor ecx,ecx
  1398.                 stdcall pole_sort, pole ;á®àâ¨à㥬 ¤«ï ®¯â¨¬¨§ æ¨¨ ¡ëáâத¥©á⢨ï
  1399.                 jmp @b
  1400.         @@:
  1401.         stdcall pole_sort, pole
  1402.  
  1403.                 stdcall pole_reset_cells, pole ;ç¨á⪠ ¯à®¢®¤®¢
  1404.  
  1405.                 ;*** ¤®¡ ¢«¥­¨¥ ¨§®«ï樮­­ëå ®¡ê¥ªâ®¢ (¯àאַ ¨§ ä ©« , ¬¨­ãï § ¯¨áì ¢ ᯨ᮪) ***
  1406.                 mov dword[shem_sub_points],0
  1407.                 mov esi,txt_sub_points
  1408.                 call str_analiz_r
  1409.                 cmp edi,0
  1410.                 je .end_sub_points ;¥á«¨ ®¯¨á ­¨ï â®ç¥ª ­¥â ¢ ä ©«¥
  1411.                         stdcall str_len,esi
  1412.                         add edi,eax
  1413.                         stdcall conv_str_to_int,edi
  1414.                         cmp eax,0
  1415.                         jle .end_sub_points ;¥á«¨ ç¨á«® â®ç¥ª = 0
  1416.                         mov [shem_sub_points],eax
  1417.                         mov ecx,eax
  1418.                         .cycle_sub_poi:
  1419.                                 call str_next_val
  1420.                                 stdcall conv_str_to_int,edi
  1421.                                 mov ebx,eax ;ª®®à¤¨­ â  x
  1422.                                 call str_next_val
  1423.                                 stdcall conv_str_to_int,edi ;ª®®à¤¨­ â  y
  1424.                                 stdcall pole_cell_creat, pole,ebx,eax,2
  1425.  
  1426.                                 dec ecx
  1427.                                 jnz .cycle_sub_poi
  1428.                 .end_sub_points:
  1429.  
  1430.                 stdcall pole_sort, pole
  1431.  
  1432.                 ;*** 㤠«¥­¨¥ ª«î祢ëå â®ç¥ª ᮠᯨ᪠ ***
  1433.                 mov ecx,[shem_points]
  1434.                 inc ecx
  1435.                 cld
  1436.                 @@:
  1437.                         stdcall [tl_info_undo],tree1
  1438.                 loop @b
  1439.  
  1440.                 ;*** ä®à¬¨à®¢ ­¨¥ ¯®¤¯¨á¥© ® ¯ à ¬¥âà å á奬ë ***
  1441.                 mov dword[txt_info.size],0
  1442.                 mov eax,dword[shem_w]
  1443.                 mov edi,txt_info.size
  1444.                 call convert_int_to_str
  1445.                 stdcall str_cat, edi,txt_mull
  1446.                 mov eax,dword[shem_h]
  1447.                 mov edi,txt_buf
  1448.                 call convert_int_to_str
  1449.                 stdcall str_cat, txt_info.size,edi
  1450.                 stdcall str_cat, txt_info.size,txt_space ;§ ¢¥àè î騩 ¯à®¡¥«
  1451.  
  1452.                 ;---
  1453.                 call but_center ;業â஢ª  á奬ë á ãç¥â®¬ shem_w ¨ shem_h
  1454.                 call but_set_none
  1455.         .end_open_file:
  1456.         popad
  1457.         ret
  1458.  
  1459. align 4
  1460. proc but_save_file
  1461. locals
  1462.         napr dd ?
  1463.         s_param dd ? ;¯ à ¬¥âà ¤«ï ªà á¨¢®£® á®åà ­¥­¨ï
  1464. endl
  1465. pushad
  1466.         ;*** ¢ë§®¢ ¤¨ «®£®¢®£® ®ª­  ¤«ï á®åà ­¥­¨ï ä ©« 
  1467.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  1468.         mov [OpenDialog_data.type],1
  1469.         stdcall [OpenDialog_Start],OpenDialog_data
  1470.         cmp [OpenDialog_data.status],1 ;if status==1 then save
  1471.         jne .end_save_file
  1472.  
  1473.         ;*** ¯à®¢¥àª  ¥áâì «¨ ¯à®¢®¤  ­  á奬¥
  1474.         mov edi,pole
  1475.         mov esi,pole_index
  1476.         cmp dword[esi],0
  1477.         je .cycle1_beg ;.end_save_file ;¥á«¨ ­¥â ï祥ª (¯à®¢®¤®¢) â® ¢ë室
  1478.  
  1479.         ;*** ãáâ ­ ¢«¨¢ ¥¬ ¬¥âª¨ ­  ª«îç¥¢ë¥ â®çª¨, ª®â®àë¥ ¡ã¤ãâ á®åà ­¥­ë ¢ ä ©«
  1480.         mov dword[shem_points],0 ;¤«ï ¯¥à¥®¯à¥¤¥«¥­¨ï â®ç¥ª
  1481.         mov dword[shem_sub_points],0
  1482.         mov ecx,dword[esi]
  1483.         .cycle0: ;横« ¯® ¢á¥¬ â®çª ¬
  1484.                 add esi,4
  1485.                 mov ebx,[esi]
  1486.                 imul ebx,sizeof.Cell
  1487.                 add ebx,pole_data
  1488.  
  1489.                 cmp byte[ebx+offs_cell_liv],2
  1490.                 jne @f
  1491.                         inc dword[shem_sub_points]
  1492.                         jmp .cycle0_next
  1493.                 @@:
  1494.  
  1495.                 mov dword[napr],0
  1496.  
  1497.                 mov edx,[ebx+offs_cell_y]
  1498.                 push edx
  1499.                 mov edx,[ebx+offs_cell_x]
  1500.                 inc edx
  1501.                 push edx
  1502.                 stdcall pole_cell_find, edi
  1503.                 cmp eax,0
  1504.                 je @f
  1505.                         or dword[napr],1
  1506.                 @@:
  1507.  
  1508.                 mov edx,[ebx+offs_cell_y]
  1509.                 inc edx
  1510.                 push edx
  1511.                 mov edx,[ebx+offs_cell_x]
  1512.                 push edx
  1513.                 stdcall pole_cell_find, edi
  1514.                 cmp eax,0
  1515.                 je @f
  1516.                         or dword[napr],2
  1517.                 @@:
  1518.  
  1519.                 mov edx,[ebx+offs_cell_y]
  1520.                 push edx
  1521.                 mov edx,[ebx+offs_cell_x]
  1522.                 dec edx
  1523.                 push edx
  1524.                 stdcall pole_cell_find, edi
  1525.                 cmp eax,0
  1526.                 je @f
  1527.                         or dword[napr],4
  1528.                 @@:
  1529.  
  1530.                 mov edx,[ebx+offs_cell_y]
  1531.                 dec edx
  1532.                 push edx
  1533.                 mov edx,[ebx+offs_cell_x]
  1534.                 push edx
  1535.                 stdcall pole_cell_find, edi
  1536.                 cmp eax,0
  1537.                 je @f
  1538.                         or dword[napr],8
  1539.                 @@:
  1540.  
  1541.                 cmp dword[napr],5
  1542.                 je @f
  1543.                 cmp dword[napr],10
  1544.                 je @f
  1545.                 cmp dword[napr],15
  1546.                 je @f
  1547.                         mov eax,dword[napr]
  1548.                         mov byte[ebx+offs_cell_liv],3 ;ãáâ ­®¢ª  ¬¥âª¨
  1549.                         mov byte[ebx+offs_cell_napr],al ;ãáâ ­®¢ª  ­ ¯à ¢«¥­¨©
  1550.                         inc dword[shem_points]
  1551.                 @@:
  1552.                 .cycle0_next:
  1553.                 dec ecx
  1554.                 jnz .cycle0
  1555.  
  1556.         ;*** á­ï⨥ ¬¥âª¨ á â®ç¥ª, ª®â®àë¥ ­ å®¤ïâáï ­  ¢å®¤­ëå ­®£ å «®£¨ç¥áª¨å í«¥¬¥­â®¢
  1557.         .cycle1_beg:
  1558.         mov dword[shem_elems],0 ;¤«ï ¯¥¯¥®¯à¥¤¥«¥­¨ï ç¨á«  í«¥¬¥­â®¢
  1559.         stdcall dword[tl_node_poi_get_info],0,tree1
  1560.         pop esi
  1561.         .cycle1:
  1562.                 cmp esi,0
  1563.                 je .cycle1_end
  1564.                 cmp word[esi],el_icon_elems ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
  1565.                 jne .end_add_p1
  1566. ;                       stdcall [tl_node_poi_get_data], esi, tree1
  1567. ;                       pop ecx
  1568.                         inc dword[shem_elems]
  1569. if 0
  1570.                         xor edx,edx ;edx - ­®¬¥à ¢å®¤­®© ­®£¨
  1571.                         @@:
  1572.                                 stdcall el_get_leg_coords, ecx,edx
  1573.                                 test eax,eax
  1574.                                 jz @f ;¥á«¨ ª®®à¤¨­ âë ­¥ ¢§ï«¨áì (eax=0 && ebx=0)
  1575.                                 test ebx,ebx
  1576.                                 jz @f ;¥á«¨ ª®®à¤¨­ âë ­¥ ¢§ï«¨áì (eax=0 && ebx=0)
  1577.                                 stdcall pole_cell_find, edi,eax,ebx
  1578.                                 test eax,eax
  1579.                                 jz .no_erase
  1580.                                         get_cell_offset ebx,eax
  1581.                                         mov byte[ebx+offs_cell_liv],0 ;á­ï⨥ ¬¥âª¨
  1582.                                         dec dword[shem_points]
  1583.                                 .no_erase:
  1584.                                 inc edx
  1585.                                 jmp @b
  1586.                         @@:
  1587.                         ;mov edx,(1 shl 16) ;edx - ­®¬¥à ¢ë室­®© ­®£¨
  1588. end if
  1589.                 .end_add_p1:
  1590.                 stdcall dword[tl_node_poi_get_next_info],esi,tree1
  1591.                 pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  1592.                 jmp .cycle1
  1593.         .cycle1_end:
  1594.  
  1595.         ;*** ᮧ¤ ­¨¥ ¨­ä®à¬ æ¨¨ ¤«ï § ¯¨á¨ ¢ ä ©« ***
  1596.         mov edi,open_file_lif
  1597.         stdcall mem_copy,edi,txt_size,5
  1598.         stdcall str_cat,edi,txt_space
  1599.         mov eax,dword[shem_w]
  1600.         add edi,5
  1601.         stdcall convert_int_to_str
  1602.         stdcall str_cat,edi,txt_space
  1603.         stdcall str_len,edi
  1604.         add edi,eax
  1605.         mov eax,[shem_h]
  1606.         stdcall convert_int_to_str
  1607.         stdcall str_cat,edi,txt_nl
  1608.  
  1609.         ;*** á®åà ­¥­¨¥ «®£¨ç¥áª¨å í«¥¬¥­â®¢ ***
  1610.         stdcall str_cat,edi,txt_elements
  1611.         stdcall str_cat,edi,txt_space
  1612.         stdcall str_len,edi
  1613.         add edi,eax
  1614.         mov eax,[shem_elems]
  1615.         stdcall convert_int_to_str
  1616.         stdcall str_cat,edi,txt_nl
  1617.  
  1618.         cmp eax,1
  1619.         jl .cycle2_end
  1620.         stdcall dword[tl_node_poi_get_info],0,tree1
  1621.         pop esi
  1622.         .cycle2:
  1623.                 cmp esi,0
  1624.                 je .cycle2_end
  1625.                 cmp word[esi],el_icon_elems ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
  1626.                 jne .end_add_p2
  1627.                         stdcall [tl_node_poi_get_data], esi, tree1
  1628.                         pop ecx
  1629.  
  1630.                         stdcall str_len,edi
  1631.                         add edi,eax
  1632.                         mov eax,[ecx] ;coord x
  1633.                         stdcall convert_int_to_str
  1634.                         stdcall str_cat,edi,txt_space
  1635.        
  1636.                         stdcall str_len,edi
  1637.                         add edi,eax
  1638.                         mov eax,[ecx+4] ;coord y
  1639.                         stdcall convert_int_to_str
  1640.                         stdcall str_cat,edi,txt_space
  1641.  
  1642.                         stdcall str_len,edi
  1643.                         add edi,eax
  1644.                         movzx eax,byte[ecx+sp_offs_el_angle] ;angle
  1645.                         stdcall convert_int_to_str
  1646.                         stdcall str_cat,edi,txt_space
  1647.  
  1648.                         ;¨¬ï í«¥¬¥­â 
  1649.                         movzx eax,byte[ecx+sp_offs_el_type]
  1650.                         imul eax,size_el_opt
  1651.                         add eax,el_opt_beg+el_offs_nam
  1652.                         stdcall str_cat,edi,eax
  1653.  
  1654.                         stdcall str_cat,edi,txt_nl
  1655.  
  1656.                 .end_add_p2:
  1657.                 stdcall dword[tl_node_poi_get_next_info],esi,tree1
  1658.                 pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  1659.                 jmp .cycle2
  1660.         .cycle2_end:
  1661.  
  1662.         ;*** á®åà ­¥­¨¥ ¯®¤¯¨á¥© ***
  1663.         stdcall str_cat,edi,txt_captions
  1664.         stdcall str_cat,edi,txt_space
  1665.         stdcall str_len,edi
  1666.         add edi,eax
  1667.         mov eax,[shem_captions]
  1668.         stdcall convert_int_to_str
  1669.         stdcall str_cat,edi,txt_nl
  1670.  
  1671.         cmp eax,1
  1672.         jl .cycle3_end
  1673.         stdcall dword[tl_node_poi_get_info],0,tree1
  1674.         pop esi
  1675.         .cycle3:
  1676.                 cmp esi,0
  1677.                 je .cycle3_end
  1678.                 cmp word[esi],el_icon_captions ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
  1679.                 jne .end_add_p3
  1680.                         stdcall [tl_node_poi_get_data], esi, tree1
  1681.                         pop ecx
  1682.  
  1683.                         stdcall str_len,edi
  1684.                         add edi,eax
  1685.                         mov eax,[ecx] ;coord x
  1686.                         stdcall convert_int_to_str
  1687.                         stdcall str_cat,edi,txt_space
  1688.        
  1689.                         stdcall str_len,edi
  1690.                         add edi,eax
  1691.                         mov eax,[ecx+4] ;coord y
  1692.                         stdcall convert_int_to_str
  1693.                         stdcall str_cat,edi,txt_space
  1694.  
  1695.                         stdcall str_len,edi
  1696.                         add edi,eax
  1697.                         movzx eax,byte[ecx+8] ;n,z,o
  1698.                         mov ah,' ' ;¯à®¡¥« ¯®á«¥ ¡ãª¢ë, çâ® ¡ë ­¥ ¤®¡ ¢«ïâì txt_space
  1699.                         mov dword[edi],eax ;al
  1700.  
  1701.                         ;¨¬ï í«¥¬¥­â 
  1702.                         mov ebx,edi
  1703.                         mov edi,ecx
  1704.                         add edi,capt_offs
  1705.                         call str_next_val
  1706.                         call str_next_val
  1707.                         ;call str_next_val
  1708.                         xchg ebx,edi
  1709.                         stdcall str_cat,edi,ebx
  1710.  
  1711.                         stdcall str_cat,edi,txt_nl
  1712.  
  1713.                 .end_add_p3:
  1714.                 stdcall dword[tl_node_poi_get_next_info],esi,tree1
  1715.                 pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  1716.                 jmp .cycle3
  1717.         .cycle3_end:
  1718.  
  1719.         ;*** á®åà ­¥­¨¥ ª«î祢ëå â®ç¥ª ***
  1720.         stdcall str_cat,edi,txt_points
  1721.         stdcall str_cat,edi,txt_space
  1722.         stdcall str_len,edi
  1723.         add edi,eax
  1724.         mov eax,[shem_points]
  1725.         stdcall convert_int_to_str
  1726.         stdcall str_cat,edi,txt_nl
  1727.  
  1728.         mov eax,edi
  1729.         mov edi,pole
  1730.         mov esi,pole_index
  1731.         cmp dword[esi],0
  1732.         je .no_points ;¥á«¨ ­¥â ï祥ª (¯à®¢®¤®¢) â® ¯à®¯ãáª
  1733.         mov ebx,pole_data
  1734.         mov dword[napr],ebx
  1735.         mov edi,eax
  1736.  
  1737.         mov ecx,dword[esi]
  1738.         mov dword[s_param],0
  1739.         .cycle4: ;横« ¯® ¢á¥¬ â®çª ¬
  1740.                 add esi,4
  1741.                 mov ebx,[esi]
  1742.                 imul ebx,sizeof.Cell
  1743.                 add ebx,dword[napr] ;pole_data
  1744.  
  1745.                 movzx edx,word[ebx+offs_cell_liv] ;also use offs_cell_napr
  1746.                 cmp dl,3
  1747.                 jne @f
  1748.                         stdcall str_len,edi
  1749.                         add edi,eax
  1750.                         mov eax,dword[ebx+offs_cell_x]
  1751.                         stdcall convert_int_to_str
  1752.                         stdcall str_cat,edi,txt_space
  1753.  
  1754.                         stdcall str_len,edi
  1755.                         add edi,eax
  1756.                         mov eax,dword[ebx+offs_cell_y]
  1757.                         stdcall convert_int_to_str
  1758.                         stdcall str_cat,edi,txt_space
  1759.  
  1760.                         stdcall str_len,edi
  1761.                         add edi,eax
  1762.                         movzx eax,dh
  1763.                         stdcall convert_int_to_str
  1764.  
  1765.                         cmp dword[s_param],7 ;¤«ï ä®à¬ â  áâப¨
  1766.                         je .new_line
  1767.                                 inc dword[s_param]
  1768.                                 stdcall str_cat,edi,txt_space
  1769.                         jmp @f
  1770.                         .new_line:
  1771.                                 mov dword[s_param],0
  1772.                                 stdcall str_cat,edi,txt_nl
  1773.                 @@:
  1774.                 dec ecx
  1775.                 jnz .cycle4
  1776.                 cmp dword[s_param],0
  1777.                 je @f
  1778.                         stdcall str_cat,edi,txt_nl
  1779.                 @@:
  1780.  
  1781.         ;*** á®åà ­¥­¨¥ ¨§®«ï樮­­ëå â®ç¥ª ***
  1782.         stdcall str_cat,edi,txt_sub_points
  1783.         stdcall str_cat,edi,txt_space
  1784.         stdcall str_len,edi
  1785.         add edi,eax
  1786.         mov eax,[shem_sub_points]
  1787.         stdcall convert_int_to_str
  1788.         stdcall str_cat,edi,txt_nl
  1789.  
  1790.         mov eax,edi
  1791.         mov edi,pole
  1792.         mov esi,pole_index
  1793.         ;cmp dword[esi],0
  1794.         ;je .no_points ;¥á«¨ ­¥â ï祥ª (¯à®¢®¤®¢) â® ¯à®¯ãáª
  1795.         ;mov ebx,pole_data
  1796.         ;mov dword[napr],ebx
  1797.         mov edi,eax
  1798.  
  1799.         mov ecx,dword[esi]
  1800.         .cycle5: ;横« ¯® ¢á¥¬ â®çª ¬
  1801.                 add esi,4
  1802.                 mov ebx,[esi]
  1803.                 imul ebx,sizeof.Cell
  1804.                 add ebx,dword[napr] ;pole_data
  1805.  
  1806.                 movzx edx,byte[ebx+offs_cell_liv]
  1807.                 cmp dl,2
  1808.                 jne @f
  1809.                         stdcall str_len,edi
  1810.                         add edi,eax
  1811.                         mov eax,dword[ebx+offs_cell_x]
  1812.                         stdcall convert_int_to_str
  1813.                         stdcall str_cat,edi,txt_space
  1814.  
  1815.                         stdcall str_len,edi
  1816.                         add edi,eax
  1817.                         mov eax,dword[ebx+offs_cell_y]
  1818.                         stdcall convert_int_to_str
  1819.                         stdcall str_cat,edi,txt_space
  1820.  
  1821.                         ;stdcall str_cat,edi,txt_nl
  1822.                 @@:
  1823.                 dec ecx
  1824.                 jnz .cycle5
  1825.                 stdcall str_cat,edi,txt_nl
  1826.  
  1827.         .no_points:
  1828.  
  1829.         ;*** ®¯à¥¤¥«¥­¨¥ ¯ à ¬¥â஢ ä ©« 
  1830.         mov edi,open_file_lif
  1831.         stdcall str_len,edi
  1832.         mov ecx,eax
  1833.  
  1834.         ;*** § ¯¨áì ä ©« 
  1835.         mov eax,70
  1836.         mov [run_file_70.Function], 2
  1837.         mov [run_file_70.Position], 0
  1838.         mov [run_file_70.Flags], 0
  1839.         mov dword[run_file_70.Count], ecx
  1840.         mov [run_file_70.Buffer], edi
  1841.         mov byte[run_file_70+20], 0
  1842.         mov dword[run_file_70.FileName], openfile_path
  1843.         mov ebx,run_file_70
  1844.         int 0x40 ;á®å࠭塞 ä ©«
  1845.  
  1846.         call redraw_pole
  1847.         .end_save_file:
  1848. popad
  1849.         ret
  1850. endp
  1851.  
  1852. ;ä®à¬¨à®¢ ­¨¥ ¯®¤¯¨á¨ ¤«ï ᯨ᪠
  1853. align 4
  1854. proc make_list_capts uses eax ebx ecx edi, buf:dword, txt:dword
  1855.         mov ebx,dword[buf]
  1856.  
  1857.         mov edi,ebx
  1858.         add edi,capt_offs
  1859.         mov dword[edi],'    ' ;¯à®¡¥«ë ¤«ï ¢ëà ¢­¨¢ ­¨ï ¬ «¥­ìª¨å ç¨á¥«
  1860.  
  1861.         mov eax,dword[ebx] ;+0 - offset coord x
  1862.         cmp eax,100
  1863.         jge @f
  1864.                 inc edi
  1865.         @@:
  1866.         cmp eax,10
  1867.         jge @f
  1868.                 inc edi
  1869.         @@:
  1870.         call convert_int_to_str ;ª®®à¤¨­ â  x (¤«ï ¯®¤¯¨á¨)
  1871.         stdcall str_cat,edi,txt_space
  1872.         stdcall str_len,edi
  1873.         add edi,eax
  1874.         mov eax,dword[ebx+4] ;+4 - offset coord y
  1875.         call convert_int_to_str ;ª®®à¤¨­ â  y (¤«ï ¯®¤¯¨á¨)
  1876.         stdcall str_cat,edi,txt_space
  1877.  
  1878.         mov edi,dword[txt]
  1879.         cmp edi,0
  1880.         je .end_f
  1881.                 stdcall str_len,edi ;eax = strlen([edi])
  1882.                 mov ecx,edi
  1883.                 call str_next_spaces
  1884.                 sub edi,ecx ;®¯à¥¤¥«ï¥¬ ¤«¨­­ã ¯®¤¯¨á¨
  1885.  
  1886.                 cmp edi,eax
  1887.                 jle @f
  1888.                         mov edi,eax ;¥á«¨ áâப  § ª®­ç¨« áì ­¥ ¯à®¡¥«®¬
  1889.                 @@:
  1890.                 ;cmp edi,1
  1891.                 ;jge @f
  1892.                 ;       mov edi,1 ;¬¨­¨¬ã¬ 1 ᨬ¢®«
  1893.                 ;@@:
  1894.  
  1895.                 add ebx,capt_offs      
  1896.                 stdcall str_n_cat, ebx,ecx,edi
  1897.         .end_f:
  1898.         ret
  1899. endp
  1900.  
  1901. ;¤®¡ ¢«¥­¨¥ ­®¢®£® í«¥¬¥­â  ã¯à ¢«¥­¨ï ­  á奬ã
  1902. ;¯à¨ ¤®¡ ¢«¥­¨¨ ¨á¯®«ì§ãîâáï áâ ­¤ àâ­ë¥ ­ áâனª¨
  1903. align 4
  1904. proc shem_element_creat uses eax ebx, coord_x:dword, coord_y:dword
  1905.         mov eax,dword[coord_x]
  1906.         mov dword[txt_buf],eax ;ª®®à¤¨­ â  x
  1907.         mov ebx,dword[coord_y]
  1908.  
  1909.         stdcall element_is_click,eax,ebx ;¯à®¢¥à塞 ¥áâì «¨ ¢ ¤ ­­®© â®çª¥ ¤à㣮© í«¥¬¥­â ᮧ¤ ­­ë© à ­ìè¥
  1910.         test eax,eax
  1911.         jnz .end_f ;¯à¨ ­ ¦ â¨¨ ¯®¯ «¨ ­  ®¤¨­ ¨§ í«¥¬¥­â®¢
  1912.         mov dword[txt_buf+4],ebx ;ª®®à¤¨­ â  y
  1913.  
  1914.         ;xor eax,eax
  1915.         mov byte[txt_buf+sp_offs_el_angle],al ;­ ¯à ¢«¥­¨¥
  1916.  
  1917.         stdcall [tl_node_get_data], tree2
  1918.         pop ebx
  1919.         test ebx,ebx
  1920.         jnz @f
  1921.                 mov ebx,el_opt_beg+el_offs_nam ;¥á«¨ ­¥ ¢§ï«®áì ¨¬ï í«¥¬¥­â , â® ¯® 㬮«ç ­¨î ¡¥à¥¬ 1-© ¨§ ᯨ᪠
  1922.         @@:
  1923.         stdcall el_get_name, ebx,0
  1924.         mov byte[txt_buf+sp_offs_el_type],al ;⨯ í«¥¬¥­â 
  1925.  
  1926.         stdcall make_list_capts,txt_buf,ebx
  1927.         stdcall [tl_node_add], txt_buf,(el_icon_elems shl 16)+1, tree1
  1928.         stdcall [tl_cur_next], tree1
  1929.         stdcall [tl_draw], tree1
  1930.         .end_f:
  1931.         ret
  1932. endp
  1933.  
  1934. ;description:
  1935. ;  ­ «¨§¨àã¥â áâபã á ¨¬¥­¥¬ «®£. í«¥¬¥­â  ¨ ¢®§¢à é ¥â ­®¬¥à «®£. í«¥¬¥­â 
  1936. ;input:
  1937. ; str - 㪠§ â¥«ì ­  áâபã ᮤ¥à¦ éãî ¨¬ï «®£. í«¥¬¥­â 
  1938. ; asciiz - ᨬ¢®« ª®â®àë© ¤®«¦¥­ ¡ëâì § ¬¥­¥­ ­  ascii 0
  1939. ;output:
  1940. ; eax - ⨯ í«¥¬¥­â 
  1941. align 4
  1942. proc el_get_name uses ebx ecx edi esi, str:dword, asciiz:dword
  1943.         mov edi,[str]
  1944.         cmp dword[asciiz],0
  1945.         je @f
  1946.                 mov eax,dword[asciiz]
  1947.                 mov ecx,el_offs_col ;à §¬¥à ⥪áâ  ¢ str ­¥ ¡®«ìè¥ el_offs_col
  1948.                 cld
  1949.                 repne scasb
  1950.                 mov ebx,edi
  1951.                 dec ebx
  1952.                 mov byte[ebx],0 ;0 - ᨬ¢®« ª®­æ  áâப¨ ¤«ï ¯à ¢¨«ì­®© à ¡®âë str_cmp
  1953.         @@:
  1954.  
  1955.         mov edi,[str]
  1956.         mov esi,el_opt_beg+el_offs_nam
  1957.         xor ecx,ecx
  1958.         @@:
  1959.                 stdcall str_cmp, edi,esi
  1960.                 cmp eax,0
  1961.                 je @f
  1962.                 add esi,size_el_opt
  1963.                 cmp esi,el_opt_beg.end
  1964.                 jge @f
  1965.                 inc ecx
  1966.                 jmp @b
  1967.         @@:
  1968.         mov eax,ecx
  1969.  
  1970.         cmp dword[asciiz],0
  1971.         je @f
  1972.                 mov ecx,dword[asciiz]
  1973.                 mov byte[ebx],cl
  1974.         @@:
  1975.         ret
  1976. endp
  1977.  
  1978. ;input:
  1979. ; el_data - 㪠§ â¥«ì ­  ¤ ­­ë¥ í«¥¬¥­â 
  1980. ; l_opt - ­®¬¥à ­®£¨, ¤«ï ª®â®à®© ¨éãâáï ª®®à¤¨­ âë, ¢å®¤­ ï/¢ë室­ ï ­®£ 
  1981. ;output:
  1982. ; eax - coord x (if not found eax=0)
  1983. ; ebx - coord y (if not found ebx=0)
  1984. align 4
  1985. proc el_get_leg_coords uses ecx edx edi esi, el_data:dword, l_opt:dword
  1986.         mov edi,[el_data] ;¤ ­­ë¥ í«¥¬¥­â 
  1987.         movzx esi,byte[edi+sp_offs_el_type] ;⨯ í«¥¬¥­â 
  1988.         imul esi,size_el_opt
  1989.         add esi,el_opt_beg
  1990.         ;esi+el_offs_legs_inp - 㪠§ â¥«ì ­  â ¡«¨æã á ¯ à ¬¥âà ¬¨ ¢å®¤­ëå ­®£
  1991.  
  1992.         mov eax,[edi+0]
  1993.         mov ebx,[edi+4]
  1994.         mov edx,[l_opt]
  1995.         movzx edi,byte[edi+sp_offs_el_angle] ;㣮« ¯®¢®à®â  / 90 (®â 0-3)
  1996.  
  1997.         btr edx,16 ;¢å®¤­ ï/¢ë室­ ï ­®£ 
  1998.         jc .output_leg
  1999.  
  2000.         ;¥á«¨ ­®£  ¢å®¤­ ï
  2001.         inc edx ;­®¬¥à æ¨ï ­®£ ­ ç¨­ ¥âáï á ­ã«ï, ¯®â®¬ã ¤®¡ ¢«ï¥¬ 1
  2002.         stdcall move_rotate_x_n90, -2,edi
  2003.         mov esi,[esi+el_offs_legs_inp]
  2004.         @@:
  2005.                 movzx ecx,byte[esi]
  2006.                 cmp ecx,0
  2007.                 je .not_found ;­®£¨ ª®­ç¨«¨áì à ­ìè¥, 祬 ®¦¨¤ «®áì
  2008.                 stdcall move_rotate_n90, 0,ecx,edi
  2009.                 inc esi
  2010.                 dec edx
  2011.                 jnz @b
  2012.                 jmp .end_f
  2013.  
  2014.         ;¥á«¨ ­®£  ¢ë室­ ï
  2015.         .output_leg:
  2016.         inc edx ;­®¬¥à æ¨ï ­®£ ­ ç¨­ ¥âáï á ­ã«ï, ¯®â®¬ã ¤®¡ ¢«ï¥¬ 1
  2017.         movzx ecx,byte[esi+el_offs_box_x]
  2018.         add ecx,2
  2019.         stdcall move_rotate_x_n90, ecx,edi
  2020.         add esi,el_offs_legs_out
  2021.         @@:
  2022.                 movzx ecx,byte[esi]
  2023.                 cmp ecx,0
  2024.                 je .not_found ;­®£¨ ª®­ç¨«¨áì à ­ìè¥, 祬 ®¦¨¤ «®áì
  2025.                 stdcall move_rotate_n90, 0,ecx,edi
  2026.                 inc esi
  2027.                 dec edx
  2028.                 jnz @b
  2029.                 jmp .end_f
  2030.  
  2031.         .not_found:
  2032.                 xor eax,eax
  2033.                 xor ebx,ebx
  2034.         .end_f:
  2035.         ret
  2036. endp
  2037.  
  2038. align 4
  2039. proc move_rotate_n90 uses ecx edi, d_x:dword, d_y:dword, angle:dword
  2040.         mov edi,[angle] ;㣮« ¯®¢®à®â  / 90 (®â 0-3)
  2041.         and edi,3
  2042.         shl edi,4 ;edi*=16
  2043.         add edi,mcs
  2044.  
  2045.         mov ecx,[d_x]
  2046.         imul ecx,dword[edi]
  2047.         add eax,ecx
  2048.         mov ecx,[d_y]
  2049.         imul ecx,dword[edi+4]
  2050.         add eax,ecx
  2051.  
  2052.         mov ecx,[d_x]
  2053.         imul ecx,dword[edi+8]
  2054.         add ebx,ecx
  2055.         mov ecx,[d_y]
  2056.         imul ecx,dword[edi+12]
  2057.         add ebx,ecx
  2058.         ret
  2059. endp
  2060.  
  2061. align 4
  2062. proc mem_copy, destination:dword, source:dword, len:dword
  2063.   push ecx esi edi
  2064.     cld
  2065.     mov esi, dword[source]
  2066.     mov edi, dword[destination]
  2067.     mov ecx, dword[len]
  2068.     rep movsb
  2069.   pop edi esi ecx
  2070.   ret
  2071. endp
  2072.  
  2073. ;description:
  2074. ; ”ã­ªæ¨ï ¯à®¯ã᪠¥â ®¤­® á«®¢® (¨«¨ ç¨á«®) á ãç¥â®¬ à §¤¥«¨â¥«ì­ëå ᨬ¢®«®¢:
  2075. ; ¯à®¡¥« , â ¡ã«ï樨, ­®¢®© áâப¨. ã¦­  ¤«ï ¯®á«¥¤®¢ â¥«ì­®£® áç¨â뢠­¨ ç¨á¥« ¨§ áâப¨
  2076. ;input:
  2077. ; edi - 㪠§ â¥«ì ­  ¯à®¡¥« ¨«¨ á«®¢®
  2078. ;output:
  2079. ; edi - 㪠§ â¥«ì ­  á«¥¤ãî饥 á«®¢®
  2080. align 4
  2081. str_next_val:
  2082.         call str_skip_spaces
  2083.         @@:
  2084.                 cmp byte[edi],0
  2085.                 je @f
  2086.  
  2087.                 cmp byte[edi],' '
  2088.                 je @f
  2089.                 cmp byte[edi],9
  2090.                 je @f
  2091.                 cmp byte[edi],10
  2092.                 je @f
  2093.                 cmp byte[edi],13
  2094.                 je @f
  2095.  
  2096.                 inc edi
  2097.                 jmp @b
  2098.         @@:
  2099.         call str_skip_spaces
  2100.         ret
  2101.  
  2102. align 4
  2103. str_skip_spaces:
  2104.         dec edi
  2105.         @@:
  2106.                 inc edi
  2107.                 cmp byte[edi],' '
  2108.                 je @b
  2109.                 cmp byte[edi],9
  2110.                 je @b
  2111.                 cmp byte[edi],10
  2112.                 je @b
  2113.                 cmp byte[edi],13
  2114.                 je @b
  2115.         ret
  2116.  
  2117. align 4
  2118. str_next_spaces:
  2119.         dec edi
  2120.         @@:
  2121.                 inc edi
  2122.                 cmp byte[edi],0
  2123.                 je @f
  2124.                 cmp byte[edi],' '
  2125.                 je @f
  2126.                 cmp byte[edi],9
  2127.                 je @f
  2128.                 cmp byte[edi],10
  2129.                 je @f
  2130.                 cmp byte[edi],13
  2131.                 je @f
  2132.                 jmp @b
  2133.         @@:    
  2134.         ret
  2135.  
  2136. ;input:
  2137. ; esi - 㪠§ â¥«ì ­  ¨áª®¬®¥ á«®¢®
  2138. ;output:
  2139. ; edi - 㪠§ â¥«ì ­  ¯®§¨æ¨î ¢ ª®â®à®© á«®¢® ­ ©¤¥­®, ¥á«¨ á«®¢® ­¥ ­ ©¤¥­® â® edi=0
  2140. ;¯®àâïâáï ॣ¨áâàë:
  2141. ; eax ecx
  2142. align 4
  2143. str_analiz_r:
  2144.         mov edi,open_file_lif
  2145.         mov ecx,dword[f_size]
  2146.         @@:
  2147.                 mov al,byte[esi] ;ãáâ ­ ¢«¨¢ ¥¬ ¯¥à¢ë© ᨬ¢®« ¤«ï ¯®¨áª 
  2148.                 cld
  2149.                 repnz scasb
  2150.                 cmp ecx,0
  2151.                 je @f ;¥á«¨ § ª®­ç¨«áï ¢¥áì ⥪áâ, â® ¢ë室 ¨§ ä㭪樨
  2152.                 ;¯¥à¢ë© ᨬ¢®« ¯®  ¤à¥áã edi-1 ¤®«¦¥­ ¡ëâì ¨§ áâப¨ esi
  2153.                 dec edi
  2154.                 stdcall str_instr, edi,esi ;¯à®¢¥à塞 á«®¢® ­  ᮢ¯ ¤¥­¨¥
  2155.                 inc edi
  2156.                 cmp al,0
  2157.                 jne @b ;¥á«¨ á«®¢® ­¥ ᮢ¯ «®, ¨é¥¬ ¢ áâப¥ á«¥¤ãî騩 ¯¥à¢ë© ᨬ¢®« ¤«ï áà ¢­¥­¨ï
  2158.                 ;á ¯®¯ ¤ ¥¬ ¥á«¨ ­ è«¨ á«®¢® esi ¯®  ¤à¥áã edi
  2159.                 jmp .exit_f
  2160.         @@:
  2161.                 ;á ¯®¯ ¤ ¥¬ ¥á«¨ ­¥ ­ è«¨ á«®¢® esi ¯®  ¤à¥áã edi
  2162.                 xor edi,edi
  2163.         .exit_f:
  2164.         ret
  2165.  
  2166. ;description:
  2167. ; ¯à®¢¥àï¥â ᮤ¥à¦¨âáï «¨ áâப  str1 ¢ áâப¥ str0
  2168. ; ¯à®¢¥àª  ¤¥« ¥âáï ⮫쪮 ­ ç¨­ ï á ¯¥à¢ëå ᨬ¢®«®¢, 㪠§ ­­ëå ¢ str0 ¨ str1
  2169. ; ¯à¨¬¥à 1: ¥á«¨ str0='aaabbbccc', str1='bbb' ᮢ¯ ¤¥­¨ï ­¥ ¡ã¤¥â
  2170. ; ¯à¨¬¥à 2: ¥á«¨ str0='aaabbbccc', str1='aaa' ᮢ¯ ¤¥­¨¥ ¡ã¤¥â
  2171. ;output:
  2172. ; al = 0 ¥á«¨ áâப  str1 ᮤ¥à¦¨âáï ¢ str0
  2173. ; al != 0 ¥á«¨ áâப  str1 ­¥ ᮤ¥à¦¨âáï ¢ str0
  2174. align 4
  2175. proc str_instr uses edi esi, str0:dword, str1:dword
  2176.         ;xor eax,eax
  2177.         mov edi,[str0]
  2178.         mov esi,[str1]
  2179.         cld
  2180.         @@:
  2181.                 mov al,[esi]
  2182.                 cmp al,0
  2183.                 je .e1
  2184.                 inc esi
  2185.                 scasb ;áà ¢­¨¢ ¥¬ ᨬ¢®«ë
  2186.         jz @b ;¥á«¨ ᮢ¯ «¨, â® ¯¥à¥å®¤¨¬ ª áà ¢­¥­¨î á«¥¤ãîé¨å
  2187.         ;á ¯®¯ ¤ ¥¬ ¥á«¨ áâப¨ ­¥ ᮢ¯ «¨
  2188.         sub al,[edi-1]
  2189.         .e1: ;á ¯®¯ ¤ ¥¬ ¥á«¨ áâப  str1 (esi) § ª®­ç¨« áì
  2190.         ret
  2191. endp
  2192.  
  2193. ;description:
  2194. ; ¯à®¢¥àï¥â ᮢ¯ ¤¥­¨¥ áâப str0 ¨ str1
  2195. ;output:
  2196. ; eax = 0 ¥á«¨ str0 = str1
  2197. ; eax = 1 ¥á«¨ str0 != str1
  2198. align 4
  2199. proc str_cmp uses ecx edi esi, str0:dword, str1:dword
  2200.         xor eax,eax
  2201.         mov edi,[str0]
  2202.         mov esi,[str1]
  2203.         mov ecx,0x8fffffff ;ecx - ®ç¥­ì ¡®«ì讥 ç¨á«®
  2204.         cld
  2205.         repne scasb
  2206.         ;dec edi
  2207.         sub edi,[str0]
  2208.         mov ecx,edi ;ecx = strlen(str0)+1
  2209.  
  2210.         mov edi,[str0]
  2211.         repe cmpsb
  2212.         je @f
  2213.                 inc eax
  2214.         @@:
  2215.         ret
  2216. endp
  2217.  
  2218. align 4
  2219. proc but_run_stop
  2220.         xor byte[tim_ch],1
  2221.         cmp byte[tim_ch],0
  2222.         jne @f
  2223.                 ;®áâ ­®¢ª  á奬ë
  2224.                 stdcall pole_reset_cells, pole ;ç¨á⪠ ¯à®¢®¤®¢
  2225.                 call redraw_pole
  2226.                 jmp .end_f
  2227.         @@:
  2228.                 ;¯®¤£®â®¢ª  áå¥¬ë ª § ¯ãáªã
  2229.                 call sign_clear
  2230.                 call sign_set_captions_angles
  2231.         .end_f:
  2232.         ret
  2233. endp
  2234.  
  2235. align 4
  2236. proc but_set_0 uses eax
  2237.         stdcall [tl_node_get_data], tree1
  2238.         pop eax
  2239.         test eax,eax
  2240.         jz .end_f
  2241. ;el_icon_captions
  2242. ;       cmp byte[eax+8],'n'
  2243. ;       je .end_f
  2244.         cmp byte[eax+8],'o' ;¢à¥¬¥­­®¥ ®âá¥ç¥­¨¥, ¯®ª  ­¥â ¯à®¢¥àª¨ ⨯  ⥪ã饩 ¨ª®­ª¨
  2245.         jne .end_f
  2246.                 mov byte[eax+8],'z'
  2247.         .end_f:
  2248.         ret
  2249. endp
  2250.  
  2251. align 4
  2252. proc but_set_1 uses eax
  2253.         stdcall [tl_node_get_data], tree1
  2254.         pop eax
  2255.         test eax,eax
  2256.         jz .end_f
  2257. ;el_icon_captions
  2258. ;       cmp byte[eax+8],'n'
  2259. ;       je .end_f
  2260.         cmp byte[eax+8],'z' ;¢à¥¬¥­­®¥ ®âá¥ç¥­¨¥, ¯®ª  ­¥â ¯à®¢¥àª¨ ⨯  ⥪ã饩 ¨ª®­ª¨
  2261.         jne .end_f
  2262.                 mov byte[eax+8],'o'
  2263.         .end_f:
  2264.         ret
  2265. endp
  2266.  
  2267. ;ᤢ¨£ ®¡ê¥ªâ  ¢«¥¢®
  2268. align 4
  2269. proc but_mov_l uses eax edi
  2270.         cmp byte[tim_ch],0
  2271.         jne .end_f
  2272.         stdcall [tl_node_get_data], tree1
  2273.         pop eax
  2274.         test eax,eax
  2275.         jz .end_f
  2276.                 cmp dword[eax],1
  2277.                 jle .end_f
  2278.                 dec dword[eax]
  2279.                 mov edi,eax
  2280.                 stdcall mem_copy,txt_buf,eax,capt_offs
  2281.                 add edi,capt_offs
  2282.                 call str_next_val
  2283.                 call str_next_val
  2284.                 stdcall make_list_capts,txt_buf,edi
  2285.                 stdcall mem_copy,eax,txt_buf,32 ;capt_offs
  2286.                 call redraw_pole
  2287.                 stdcall [tl_draw],tree1
  2288.         .end_f:
  2289.         ret
  2290. endp
  2291.  
  2292. ;ᤢ¨£ ®¡ê¥ªâ  ¢¯à ¢®
  2293. align 4
  2294. proc but_mov_r uses eax edi
  2295.         cmp byte[tim_ch],0
  2296.         jne .end_f
  2297.         stdcall [tl_node_get_data], tree1
  2298.         pop eax
  2299.         test eax,eax
  2300.         jz .end_f
  2301.                 inc dword[eax]
  2302.                 mov edi,eax
  2303.                 stdcall mem_copy,txt_buf,eax,capt_offs
  2304.                 add edi,capt_offs
  2305.                 call str_next_val
  2306.                 call str_next_val
  2307.                 stdcall make_list_capts,txt_buf,edi
  2308.                 stdcall mem_copy,eax,txt_buf,32 ;capt_offs
  2309.                 call redraw_pole
  2310.                 stdcall [tl_draw],tree1
  2311.         .end_f:
  2312.         ret
  2313. endp
  2314.  
  2315. align 4
  2316. proc but_mov_u uses eax edi
  2317.         cmp byte[tim_ch],0
  2318.         jne .end_f
  2319.         stdcall [tl_node_get_data], tree1
  2320.         pop eax
  2321.         test eax,eax
  2322.         jz .end_f
  2323.                 cmp dword[eax+4],1
  2324.                 jle .end_f
  2325.                 dec dword[eax+4]
  2326.                 mov edi,eax
  2327.                 stdcall mem_copy,txt_buf,eax,capt_offs
  2328.                 add edi,capt_offs
  2329.                 call str_next_val
  2330.                 call str_next_val
  2331.                 stdcall make_list_capts,txt_buf,edi
  2332.                 stdcall mem_copy,eax,txt_buf,32 ;capt_offs
  2333.                 call redraw_pole
  2334.                 stdcall [tl_draw],tree1
  2335.         .end_f:
  2336.         ret
  2337. endp
  2338.  
  2339. align 4
  2340. proc but_mov_d uses eax edi
  2341.         cmp byte[tim_ch],0
  2342.         jne .end_f
  2343.         stdcall [tl_node_get_data], tree1
  2344.         pop eax
  2345.         test eax,eax
  2346.         jz .end_f
  2347.                 inc dword[eax+4]
  2348.                 mov edi,eax
  2349.                 stdcall mem_copy,txt_buf,eax,capt_offs
  2350.                 add edi,capt_offs
  2351.                 call str_next_val
  2352.                 call str_next_val
  2353.                 stdcall make_list_capts,txt_buf,edi
  2354.                 stdcall mem_copy,eax,txt_buf,32 ;capt_offs
  2355.                 call redraw_pole
  2356.                 stdcall [tl_draw],tree1
  2357.         .end_f:
  2358.         ret
  2359. endp
  2360.  
  2361. ;ãáâ ­®¢ª  ®¡ëç­®£® ०¨¬ , ¡¥§ à¨á®¢ ­¨ï
  2362. align 4
  2363. proc but_set_none
  2364.         mov byte[pen_mode],0
  2365.         cmp [cursor_pointer],0
  2366.         je @f
  2367.                 push eax ebx ecx
  2368.                 mcall 37,6,[cursor_pointer]
  2369.                 pop ecx ebx eax
  2370.         @@:
  2371.         ret
  2372. endp
  2373.  
  2374. ;hot_p - ª®®à¤¨­ âë £®àï祩 â®çª¨ ªãàá®à , ᬥ饭­ë¥ ­  ¡¨â 16 ((cx shl 8) + cy) shl 16
  2375. align 4
  2376. proc set_pen_mode uses eax ebx ecx edx, mode:dword, icon:dword, hot_p:dword
  2377.         mov eax,[mode]
  2378.         cmp byte[pen_mode],al
  2379.         je @f
  2380.                 mov byte[pen_mode],al
  2381.                 mov edx,[hot_p]
  2382.                 mov dx,2 ;LOAD_INDIRECT
  2383.                 mov ecx,[icon]
  2384.                 shl ecx,12 ;㬭®¦ ¥¬ ­  4 ª¡
  2385.                 add ecx,[buf_curs.data]
  2386.                 mcall 37,4
  2387.  
  2388.                 cmp eax,0
  2389.                 je @f
  2390.                         mov [cursor_pointer],eax
  2391.                         mcall 37,5,[cursor_pointer]
  2392.         @@:
  2393.         ret
  2394. endp
  2395.  
  2396. ;¤ ­­ë¥ ¤«ï ¤¨ «®£  ®âªàëâ¨ï ä ©«®¢
  2397. align 4
  2398. OpenDialog_data:
  2399. .type                   dd 0 ;0 - ®âªàëâì, 1 - á®åà ­¨âì, 2 - ¢ë¡à âì ¤â४â®à¨î
  2400. .procinfo               dd procinfo     ;+4
  2401. .com_area_name          dd communication_area_name      ;+8
  2402. .com_area               dd 0    ;+12
  2403. .opendir_path           dd plugin_path  ;+16
  2404. .dir_default_path       dd default_dir ;+20
  2405. .start_path             dd file_name ;+24 ¯ãâì ª ¤¨ «®£ã ®âªàëâ¨ï ä ©«®¢
  2406. .draw_window            dd draw_window  ;+28
  2407. .status                 dd 0    ;+32
  2408. .openfile_path          dd openfile_path        ;+36 ¯ãâì ª ®âªà뢠¥¬®¬ã ä ©«ã
  2409. .filename_area          dd filename_area        ;+40
  2410. .filter_area            dd Filter
  2411. .x:
  2412. .x_size                 dw 420 ;+48 ; Window X size
  2413. .x_start                dw 10 ;+50 ; Window X position
  2414. .y:
  2415. .y_size                 dw 320 ;+52 ; Window y size
  2416. .y_start                dw 10 ;+54 ; Window Y position
  2417.  
  2418. default_dir db '/rd/1',0
  2419.  
  2420. communication_area_name:
  2421.         db 'FFFFFFFF_open_dialog',0
  2422. open_dialog_name:
  2423.         db 'opendial',0
  2424. communication_area_default_path:
  2425.         db '/rd/1/File managers/',0
  2426.  
  2427. Filter:
  2428. dd Filter.end - Filter ;.1
  2429. .1:
  2430. db 'TXT',0
  2431. db 'ASM',0
  2432. .end:
  2433. db 0
  2434.  
  2435. include 'le_libs.inc'
  2436.  
  2437. mouse_dd dd 0x0
  2438. sc system_colors
  2439. last_time dd 0
  2440.  
  2441.  
  2442.  
  2443. align 16
  2444. procinfo process_information
  2445.  
  2446. align 4
  2447. buf_0: dd 0 ;
  2448. .l: dw 170 ;+4 left
  2449. .t: dw panel_1_coord_top ;+6 top
  2450. .w: dd 395 ;+8 w
  2451. .h: dd 340 ;+12 h
  2452. .color: dd ini_def_c_bkgnd ;+16 color
  2453.         db 24 ;+20 bit in pixel
  2454.  
  2455. align 4
  2456. buf_font: ;¡ãä¥à á® èà¨ä⮬
  2457.         dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
  2458.         dw 25 ;+4 left
  2459.         dw 25 ;+6 top
  2460.         dd 96 ;+8 w
  2461.         dd 144 ;+12 h
  2462.         dd 0 ;+16 color
  2463.         db 24 ;+20 bit in pixel
  2464.  
  2465. align 4
  2466. buf_curs: ;¡ãä¥à á ªãàá®à ¬¨
  2467. .data: dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
  2468.         dw 0 ;+4 left
  2469.         dw 0 ;+6 top
  2470.         dd 32 ;+8 w
  2471.         dd 32*cursors_count ;+12 h
  2472.         dd 0 ;+16 color
  2473.         db 24 ;+20 bit in pixel
  2474.  
  2475. align 4
  2476. buf_curs_8: ;¡ãä¥à á ªãàá®à ¬¨
  2477. .data: dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
  2478.         dw 0 ;+4 left
  2479.         dw 0 ;+6 top
  2480.         dd 32 ;+8 w
  2481.         dd 32*cursors_count ;+12 h
  2482.         dd 0 ;+16 color
  2483.         db 24 ;+20 bit in pixel
  2484.  
  2485. cursor_pointer dd 0 ;㪠§ â¥«ì ­  ¤ ­­ë¥ ¤«ï ªãàá®à 
  2486.  
  2487. el_focus dd 0
  2488. tree1 tree_list 32,points_max+2, tl_key_no_edit, 16,16,\
  2489.     0x8080ff,0x0000ff,0xffffff, 5,panel_3_coord_top+85,145,170, 0,capt_offs,0,\
  2490.     el_focus, wScr1,0
  2491. tree2 tree_list el_offs_col-el_offs_nam,100+2, tl_key_no_edit+tl_list_box_mode, 16,16,\
  2492.     0x8080ff,0x0000ff,0xffffff, 5,panel_3_coord_top,145,80, 0,0,0,\
  2493.     el_focus, wScr2,0
  2494.  
  2495. align 4
  2496. wScr1:
  2497. .x:
  2498. .size_x     dw 16 ;+0
  2499. .start_x    dw 0 ;+2
  2500. .y:
  2501. .size_y     dw 150 ;+4
  2502. .start_y    dw 0 ;+6
  2503. .btn_high   dd 15 ;+8
  2504. .type       dd 1  ;+12
  2505. .max_area   dd 100  ;+16
  2506. .cur_area   dd 30  ;+20
  2507. .position   dd 0  ;+24
  2508. .bckg_col   dd 0xeeeeee ;+28
  2509. .frnt_col   dd 0xbbddff ;+32
  2510. .line_col   dd 0  ;+36
  2511. .redraw     dd 0  ;+40
  2512. .delta      dw 0  ;+44
  2513. .delta2     dw 0  ;+46
  2514. .run_x:
  2515. .r_size_x   dw 0  ;+48
  2516. .r_start_x  dw 0  ;+50
  2517. .run_y:
  2518. .r_size_y   dw 0 ;+52
  2519. .r_start_y  dw 0 ;+54
  2520. .m_pos      dd 0 ;+56
  2521. .m_pos_2    dd 0 ;+60
  2522. .m_keys     dd 0 ;+64
  2523. .run_size   dd 0 ;+68
  2524. .position2  dd 0 ;+72
  2525. .work_size  dd 0 ;+76
  2526. .all_redraw dd 0 ;+80
  2527. .ar_offset  dd 1 ;+84
  2528.  
  2529. align 4
  2530. wScr2:
  2531. .x:
  2532. .size_x     dw 16 ;+0
  2533. .start_x    dw 0 ;+2
  2534. .y:
  2535. .size_y     dw 150 ;+4
  2536. .start_y    dw 0 ;+6
  2537. .btn_high   dd 15 ;+8
  2538. .type       dd 1  ;+12
  2539. .max_area   dd 100  ;+16
  2540. .cur_area   dd 30  ;+20
  2541. .position   dd 0  ;+24
  2542. .bckg_col   dd 0xeeeeee ;+28
  2543. .frnt_col   dd 0xbbddff ;+32
  2544. .line_col   dd 0  ;+36
  2545. .redraw     dd 0  ;+40
  2546. .delta      dw 0  ;+44
  2547. .delta2     dw 0  ;+46
  2548. .run_x:
  2549. .r_size_x   dw 0  ;+48
  2550. .r_start_x  dw 0  ;+50
  2551. .run_y:
  2552. .r_size_y   dw 0 ;+52
  2553. .r_start_y  dw 0 ;+54
  2554. .m_pos      dd 0 ;+56
  2555. .m_pos_2    dd 0 ;+60
  2556. .m_keys     dd 0 ;+64
  2557. .run_size   dd 0 ;+68
  2558. .position2  dd 0 ;+72
  2559. .work_size  dd 0 ;+76
  2560. .all_redraw dd 0 ;+80
  2561. .ar_offset  dd 1 ;+84
  2562.  
  2563. align 4
  2564. proc str_n_cat uses eax ecx edi esi, str1:dword, str2:dword, n:dword
  2565.         mov esi,dword[str2]
  2566.         mov ecx,dword[n]
  2567.         mov edi,dword[str1]
  2568.         stdcall str_len,edi
  2569.         add edi,eax
  2570.         cld
  2571.         repne movsb
  2572.         mov byte[edi],0
  2573.         ret
  2574. endp
  2575.  
  2576. align 4
  2577. proc str_cat uses eax ecx edi esi, str1:dword, str2:dword
  2578.         mov esi,dword[str2]
  2579.         stdcall str_len,esi
  2580.         mov ecx,eax
  2581.         inc ecx
  2582.         mov edi,dword[str1]
  2583.         stdcall str_len,edi
  2584.         add edi,eax
  2585.         cld
  2586.         repne movsb
  2587.         ret
  2588. endp
  2589.  
  2590. ;output:
  2591. ; eax = strlen
  2592. align 4
  2593. proc str_len, str1:dword
  2594.         mov eax,[str1]
  2595.         @@:
  2596.                 cmp byte[eax],0
  2597.                 je @f
  2598.                 inc eax
  2599.                 jmp @b
  2600.         @@:
  2601.         sub eax,[str1]
  2602.         ret
  2603. endp
  2604.  
  2605. ;input:
  2606. ; buf - 㪠§ â¥«ì ­  áâபã, ç¨á«® ¤®«¦­® ¡ëâì ¢ 10 ¨«¨ 16 à¨ç­®¬ ¢¨¤¥
  2607. ;output:
  2608. ; eax - ç¨á«®
  2609. align 4
  2610. proc conv_str_to_int, buf:dword
  2611.         xor eax,eax
  2612.         push ebx ecx esi
  2613.         xor ebx,ebx
  2614.         mov esi,[buf]
  2615.  
  2616.         ;­  á«ãç © ¥á«¨ ¯¥à¥¤ ç¨á«®¬ ­ å®¤ïâáï ¯à®¡¥«ë
  2617.         @@:
  2618.         cmp byte[esi],' '
  2619.         jne @f
  2620.                 inc esi
  2621.                 jmp @b
  2622.         @@:
  2623.  
  2624.         ;®¯à¥¤¥«¥­¨¥ ®âà¨æ â¥«ì­ëå ç¨á¥«
  2625.         xor ecx,ecx
  2626.         inc ecx
  2627.         cmp byte[esi],'-'
  2628.         jne @f
  2629.                 dec ecx
  2630.                 inc esi
  2631.         @@:
  2632.  
  2633.         cmp word[esi],'0x'
  2634.         je .load_digit_16
  2635.  
  2636.         .load_digit_10: ;áç¨â뢠­¨¥ 10-â¨ç­ëå æ¨äà
  2637.                 mov bl,byte[esi]
  2638.                 cmp bl,'0'
  2639.                 jl @f
  2640.                 cmp bl,'9'
  2641.                 jg @f
  2642.                         sub bl,'0'
  2643.                         imul eax,10
  2644.                         add eax,ebx
  2645.                         inc esi
  2646.                         jmp .load_digit_10
  2647.         jmp @f
  2648.  
  2649.         .load_digit_16: ;áç¨â뢠­¨¥ 16-à¨ç­ëå æ¨äà
  2650.                 add esi,2
  2651.         .cycle_16:
  2652.                 mov bl,byte[esi]
  2653.                 cmp bl,'0'
  2654.                 jl @f
  2655.                 cmp bl,'f'
  2656.                 jg @f
  2657.                 cmp bl,'9'
  2658.                 jle .us1
  2659.                         cmp bl,'A'
  2660.                         jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'9' ¨ <'A'
  2661.                 .us1: ;á®áâ ¢­®¥ ãá«®¢¨¥
  2662.                 cmp bl,'F'
  2663.                 jle .us2
  2664.                         cmp bl,'a'
  2665.                         jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'F' ¨ <'a'
  2666.                         sub bl,32 ;¯¥à¥¢®¤¨¬ ᨬ¢®«ë ¢ ¢¥àå­¨© ॣ¨áâà, ¤«ï ã¯à®é¥­¨ï ¨å ¯®á«¥¤ã饩 ®¡à ¡®âª¨
  2667.                 .us2: ;á®áâ ¢­®¥ ãá«®¢¨¥
  2668.                         sub bl,'0'
  2669.                         cmp bl,9
  2670.                         jle .cor1
  2671.                                 sub bl,7 ;convert 'A' to '10'
  2672.                         .cor1:
  2673.                         shl eax,4
  2674.                         add eax,ebx
  2675.                         inc esi
  2676.                         jmp .cycle_16
  2677.         @@:
  2678.         cmp ecx,0 ;¥á«¨ ç¨á«® ®âà¨æ â¥«ì­®¥
  2679.         jne @f
  2680.                 sub ecx,eax
  2681.                 mov eax,ecx
  2682.         @@:
  2683.         pop esi ecx ebx
  2684.         ret
  2685. endp
  2686.  
  2687. ;íâ®â ª®¤ ­¥ ¬®©, ®­ ¯à¥®¡à §ã¥â ç¨á«® ¢ áâபã
  2688. ;input:
  2689. ; eax = value
  2690. ; edi = string buffer
  2691. ;output:
  2692. align 4
  2693. proc convert_int_to_str uses eax ecx edx edi
  2694.         mov dword[edi+1],0
  2695.         call .str
  2696.         ret
  2697. endp
  2698.  
  2699. align 4
  2700. .str:
  2701.         mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
  2702.     ;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢§®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®©
  2703.         cmp eax,ecx  ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
  2704.         jb @f
  2705.                 xor edx,edx  ;®ç¨áâ¨âì edx
  2706.                 div ecx      ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
  2707.                 push edx     ;¯®«®¦¨âì ¢ á⥪
  2708.                 ;dec edi             ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
  2709.                 call .str ;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
  2710.                 pop eax
  2711.         @@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
  2712.         or al,0x30  ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥ 祬 ¤¢¥ ¢ëè¥
  2713.         stosb       ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
  2714.         ret           ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
  2715.  
  2716. i_end:
  2717.         rb 1024
  2718. stacktop:
  2719.         sys_path rb 1024
  2720.         file_name:
  2721.                 rb 1024 ;4096
  2722.         library_path rb 1024
  2723.         plugin_path rb 4096
  2724.         openfile_path rb 4096
  2725.         filename_area rb 256
  2726. mem:
  2727.