Subversion Repositories Kolibri OS

Rev

Rev 6213 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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