Subversion Repositories Kolibri OS

Rev

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