Subversion Repositories Kolibri OS

Rev

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

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