Subversion Repositories Kolibri OS

Rev

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