Subversion Repositories Kolibri OS

Rev

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