Subversion Repositories Kolibri OS

Rev

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