Subversion Repositories Kolibri OS

Rev

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