Subversion Repositories Kolibri OS

Rev

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