Subversion Repositories Kolibri OS

Rev

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

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