Subversion Repositories Kolibri OS

Rev

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

  1. ;Ž£à®¬­ ï ¡« £®¤ à­®áâì Maxxxx32, Diamond, Heavyiron
  2. ;¨ ¤à㣨¬ ¯à®£à ¬¬¨áâ ¬,   â ª¦¥
  3. ;’¥¯«®¢ã €«¥ªá¥î (<Lrz> www.lrz.land.ru)
  4. use32
  5.   org 0x0
  6.   db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
  7.   dd 0x1
  8.   dd start
  9.   dd i_end ; à §¬¥à ¯à¨«®¦¥­¨ï
  10.   dd mem
  11.   dd stacktop
  12.   dd 0x0
  13.   dd sys_path
  14.  
  15. include '../../proc32.inc'
  16. include '../../macros.inc'
  17. include 'mem.inc'
  18. include 'dll.inc'
  19.  
  20. include '../../develop/libraries/box_lib/load_lib.mac'
  21. include '../../develop/libraries/box_lib/trunk/box_lib.mac'
  22.  
  23. min_window_w equ 485 ;¬¨­¨¬ «ì­ ï è¨à¨­  ®ª­ 
  24. min_window_h equ 325 ;¬¨­¨¬ «ì­ ï ¢ëá®â  ®ª­ 
  25. otst_panel_left equ 265
  26.  
  27. include 'tile_fun.inc'
  28. include 'pl_import.inc'
  29.  
  30.   @use_library
  31.  
  32. struct f70
  33.   func_n dd ?
  34.   param1 dd ?
  35.   param2 dd ?
  36.   param3 dd ?
  37.   param4 dd ?
  38.   rezerv db ?
  39.   name dd ?
  40. ends
  41.  
  42. fn_metki db 'pl_metki.lst',0
  43. fn_icon1 db 'tl_sys_16.png',0
  44. fn_icon2 db 'tl_nod_16.bmp',0
  45.  
  46. ini_name db 'planet_v.ini',0
  47. ini_sec  db 'Map',0
  48. ini_k_cache db 'Cache',0
  49. ini_def_cache db '/cache/sat',0
  50. ini_ext  db 'ext'
  51. .number  db '?'
  52. .def db 0 ;à áè¨à¥­¨¥ ¯® 㬮«ç ­¨î
  53.  
  54.  
  55. align 4
  56. start:
  57.   load_libraries l_libs_start,load_lib_end
  58.  
  59. ;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ­ è  «¨¡ 
  60.         mov     ebp,lib0
  61.         cmp     dword [ebp+ll_struc_size-4],0
  62.         jz      @f
  63.         mcall   -1      ;exit not correct
  64. @@:
  65.         mov     ebp,lib1
  66.         cmp     dword [ebp+ll_struc_size-4],0
  67.         jz      @f
  68.         mcall   -1      ;exit not correct
  69. @@:
  70.         mov     ebp,lib2
  71.         cmp     dword [ebp+ll_struc_size-4],0
  72.         jz      @f
  73.         mcall   -1      ;exit not correct
  74. @@:
  75.         mov     ebp,lib3
  76.         cmp     dword [ebp+ll_struc_size-4],0
  77.         jz      @f
  78.         mcall   -1      ;exit not correct
  79. @@:
  80.  
  81.   stdcall dll.Init,dword[lib_init]
  82.   stdcall dll.Init,dword[lib_init_ini]
  83.  
  84.   copy_path ini_name,sys_path,file_name,0x0
  85.   stdcall dword[ini_get_str],file_name,ini_sec,ini_k_cache,dword[edit1.text],dword[edit1.max],ini_def_cache
  86.   stdcall [str_len],dword[edit1.text],dword[edit1.max]
  87.   mov dword[edit1.size],eax
  88.   mov dword[edit1.pos],eax
  89.  
  90.   stdcall dword[tl_data_init], tree1
  91.   stdcall dword[tl_data_init], tree2
  92.  
  93. ;áç¨â뢠¥¬ à áè¨à¥­¨ï ª àâ ¨§ *.ini ä ©« 
  94.   mov byte[ini_ext.number],'0'
  95. @@: ;áç¨â뢠¥¬ ¯ à ¬¥âàë ®â ext1 ¤® ext9
  96.   inc byte[ini_ext.number]
  97.   stdcall dword[ini_get_str],file_name,ini_sec,ini_ext,txt_tile_type_0,dword[tree1.info_capt_len],ini_ext.def
  98.   cmp byte[txt_tile_type_0],0
  99.   je @f
  100.     stdcall dword[tl_node_add], txt_tile_type_0, 0, tree1
  101.   jmp @b
  102. @@:
  103.   mov byte[ini_ext.number],'0' ;áç¨â뢠¥¬ ¯ à ¬¥âà ®â ext0 ª®â®àë© ¡ã¤¥â ¢ë¡à ­ ¢ ᯨ᪥
  104.   stdcall dword[ini_get_str],file_name,ini_sec,ini_ext,txt_tile_type_0,dword[tree1.info_capt_len],ini_ext.def
  105.   cmp byte[txt_tile_type_0],0
  106.   jne @f
  107.     mov dword[txt_tile_type_0],'.bmp' ;¥á«¨ ¢ *.ini ä ©«¥ ­¨ç¥£® ­¥â ¤®¡ ¢«ï¥¬ à áè¨à¥­¨¥ .bmp
  108.   @@:
  109.   stdcall dword[tl_node_add], txt_tile_type_0, 0, tree1
  110.  
  111. ; init bmp file
  112.   push dword RGB_TILE_SIZE+300 ;300 - § ¯ á­ë¥ ¡ ©âë á ãç¥â®¬ § £®«®¢ª  bmp ä ©« 
  113.   call mem.Alloc
  114.   mov [bmp_icon],eax
  115.  
  116.   stdcall array_tile_function, tile_00,max_tiles_count,tile_init
  117.   stdcall tiles_init_grid, tile_00,max_tiles_count,max_tiles_cols
  118.  
  119.   push dword TREE_ICON_SYS16_BMP_SIZE
  120.   call mem.Alloc
  121.   mov [tree_sys_icon],eax
  122.  
  123.   push dword TREE_ICON_NOD16_BMP_SIZE
  124.   call mem.Alloc
  125.   mov [tree_nod_icon],eax
  126.  
  127.   copy_path fn_icon1,sys_path,file_name,0x0
  128.   mov eax,70 ;load icon file
  129.   mov [run_file_70.func_n], 0
  130.   mov [run_file_70.param1], 0
  131.   mov [run_file_70.param2], 0
  132.   mov [run_file_70.param3], TREE_ICON_SYS16_BMP_SIZE
  133.   m2m [run_file_70.param4], [tree_sys_icon]
  134.   mov [run_file_70.rezerv], 0
  135.   mov [run_file_70.name], file_name
  136.   mov ebx,run_file_70
  137.   int 0x40
  138.   cmp ebx,0xffffffff
  139.   je @f
  140.     stdcall dword[img_decode], dword[tree_sys_icon],ebx,0
  141.     mov dword[data_icon],eax
  142.     stdcall dword[img_to_rgb2], dword[data_icon],dword[tree_sys_icon]
  143.     stdcall dword[img_destroy], dword[data_icon]
  144.  
  145.     m2m dword[tree1.data_img_sys],dword[tree_sys_icon]
  146.     m2m dword[tree2.data_img_sys],dword[tree_sys_icon]
  147.   @@:
  148.  
  149.  
  150.   copy_path fn_icon2,sys_path,file_name,0x0
  151.   mov eax,70 ;load icon file
  152.   mov [run_file_70.param3], TREE_ICON_NOD16_BMP_SIZE
  153.   m2m [run_file_70.param4], [tree_nod_icon]
  154.   mov ebx,run_file_70
  155.   int 0x40
  156.   cmp ebx,0xffffffff
  157.   je @f
  158.     stdcall dword[img_decode], dword[tree_nod_icon],ebx,0
  159.     mov dword[data_icon],eax
  160.     stdcall dword[img_to_rgb2], dword[data_icon],dword[tree_nod_icon]
  161.     stdcall dword[img_destroy], dword[data_icon]
  162.  
  163.     m2m dword[tree1.data_img],dword[tree_nod_icon]
  164.     m2m dword[tree2.data_img],dword[tree_nod_icon]
  165.   @@:
  166.  
  167.   mcall 40,0x27
  168.  
  169.   mcall 48,3,sc,sizeof.system_colors
  170.   ;ãáâ ­®¢ª  á¨á⥬­ëå 梥⮢
  171.   edit_boxes_set_sys_color edit1,editboxes_end,sc
  172.   check_boxes_set_sys_color ch1,checkboxes_end,sc
  173.  
  174.   mov byte[file_name],0
  175.  
  176. red_win:
  177.   call draw_win
  178.   call but_MetLoad
  179.  
  180. still:
  181.   mov eax,10
  182.   mcall
  183.  
  184.   cmp al,0x1 ;¨§¬. ¯®«®¦¥­¨¥ ®ª­ 
  185.   jz red_win
  186.   cmp al,0x2
  187.   jz key
  188.   cmp al,0x3
  189.   jz button
  190.  
  191.   push dword ch2
  192.   call [check_box_mouse]
  193.   push dword ch1
  194.   call [check_box_mouse]
  195.  
  196.   stdcall [edit_box_mouse], edit1
  197.   stdcall [edit_box_mouse], edit2
  198.  
  199.   stdcall [tl_mouse], tree1
  200.   stdcall [tl_mouse], tree2
  201.  
  202.   jmp still
  203.  
  204. key:
  205.   push eax ebx
  206.   mcall 2
  207.   stdcall [edit_box_key], edit1
  208.   stdcall [edit_box_key], edit2
  209.  
  210.   push dword tree1
  211.   call [tl_key]
  212.   push dword tree2
  213.   call [tl_key]
  214.  
  215.   mov ebx,dword[el_focus] ;÷òî-áû êàðòà íå äâèãàëàñü åñëè îêíà treelist â ôîêóñå
  216.   cmp ebx, dword tree1
  217.   je .end_f
  218.   cmp ebx, dword tree2
  219.   je .end_f
  220.  
  221.   ;÷òî-áû êàðòà íå äâèãàëàñü åñëè òåêñòîâûå ïîëÿ â ôîêóñå
  222.   test word[edit1.flags],10b ;ed_focus
  223.   jne .end_f
  224.   test word[edit2.flags],10b ;ed_focus
  225.   jne .end_f
  226.  
  227.     cmp ah,179 ;Right
  228.     jne @f
  229.       call CursorMoveRight
  230.     @@:
  231.     cmp ah,176 ;Left
  232.     jne @f
  233.     cmp dword[map.coord_x],0
  234.     je @f
  235.       dec dword[map.coord_x]
  236.       ;ᤢ¨£ ¥¬ á¥âªã â ©«®¢ ¢¯à ¢®, çâ®-¡ë ç áâì â ©«®¢ ᮢ¯ «¨ ¨ ¯à¨è«®áì ¬¥­ìè¥ § £à㦠âì ­®¢ëå
  237.       stdcall tiles_grid_move_right, tile_00,max_tiles_count,max_tiles_cols
  238.       call but_Refresh
  239.     @@:
  240.     cmp ah,177 ;Down
  241.     jne @f
  242.       call CursorMoveDown
  243.     @@:
  244.     cmp ah,178 ;Up
  245.     jne @f
  246.     cmp dword[map.coord_y],0
  247.     je @f
  248.       dec dword[map.coord_y]
  249.       ;ᤢ¨£ ¥¬ á¥âªã â ©«®¢ ¢­¨§
  250.       stdcall tiles_grid_move_down, tile_00,max_tiles_count,max_tiles_rows
  251.       call but_Refresh
  252.     @@:
  253.  
  254.     cmp ah,45 ;-
  255.     jne @f
  256.       call but_ZoomM
  257.     @@:
  258.     cmp ah,61 ;+
  259.     jne @f
  260.       call but_ZoomP
  261.     @@:
  262.  
  263.   .end_f:
  264.   pop ebx eax
  265.   jmp still
  266.  
  267.  
  268. align 4
  269. draw_win:
  270. pushad
  271.   mcall 12,1
  272.  
  273.   xor eax,eax
  274.   mov ebx,20*65536+min_window_w
  275.   mov ecx,20*65536+min_window_h
  276.   mov edx,[sc.work]
  277.   or  edx,0x33000000
  278.   mov edi,hed
  279.   mcall
  280.  
  281.   mcall 9,procinfo,-1
  282.  
  283.   cmp dword[procinfo.box.width],min_window_w ; ¯à®¢¥à塞 è¨à¨­ã ®ª­ 
  284.   jge @f
  285.     mov dword[procinfo.box.width],min_window_w ; ¥á«¨ ®ª­® ®ç¥­ì 㧪®¥, 㢥«¨ç¨¢ ¥¬ è¨à¨­ã ¤«ï ¨§¡¥¦ ­¨ï £«îª®¢
  286.   @@:
  287.  
  288.   mov edi,dword[procinfo.box.width]
  289.   sub edi,min_window_w-otst_panel_left
  290.   mov dword[tree1.box_left],edi
  291.   mov dword[tree2.box_left],edi
  292.  
  293.   mov eax,dword[tree2.box_left] ;¤¢¨£ ¥¬ áªà®««¨­£
  294.   add eax,dword[tree2.box_width]
  295.   mov ebx,dword[tree2.p_scrol]
  296.   mov word[ebx+2],ax
  297.  
  298.   mov dword[edit2.left],edi
  299.   add dword[edit2.left],370-otst_panel_left
  300.  
  301.   stdcall dword[tl_draw],dword tree1
  302.   stdcall dword[tl_draw],dword tree2
  303.   mov dword[wScrMetki.all_redraw],1
  304.   push dword wScrMetki
  305.   call [scrollbar_ver_draw]
  306.  
  307.   mov eax,8 ;ª­®¯ª 
  308.   mov ebx,145*65536+20
  309.   mov ecx,5*65536+25
  310.   mov edx,6
  311.   mov esi,[sc.work_button]
  312.   int 0x40
  313.  
  314.   mov ebx,100*65536+20
  315.   mov ecx,5*65536+25
  316.   mov edx,5
  317.   int 0x40
  318.  
  319.   mov bx,di
  320.   shl ebx,16
  321.   mov bx,100
  322.   mov ecx,265*65536+25
  323.   mov edx,9
  324.   int 0x40
  325.  
  326.   ;ebx ...
  327.   mov ecx,235*65536+25
  328.   mov edx,8
  329.   int 0x40
  330.  
  331.   mov bx,di
  332.   add bx,410-otst_panel_left
  333.   shl ebx,16
  334.   mov bx,55
  335.   ;mov ebx,410*65536+55
  336.   mov ecx,5*65536+25
  337.   mov edx,7
  338.   int 0x40
  339.  
  340.   mov bx,di
  341.   add bx,440-otst_panel_left
  342.   shl ebx,16
  343.   mov bx,30
  344.   ;mov ebx,440*65536+30
  345.   mov ecx,265*65536+25
  346.   mov edx,12
  347.   int 0x40
  348.  
  349.   mov bx,di
  350.   add bx,405-otst_panel_left
  351.   shl ebx,16
  352.   mov bx,30
  353.   ;mov ebx,405*65536+30
  354.   mov ecx,265*65536+25
  355.   mov edx,11
  356.   int 0x40
  357.  
  358.   mov bx,di
  359.   add bx,370-otst_panel_left
  360.   shl ebx,16
  361.   mov bx,30
  362.   ;mov ebx,370*65536+30
  363.   mov ecx,265*65536+25
  364.   mov edx,10
  365.   int 0x40
  366.  
  367.   mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
  368.   mov ebx,152*65536+13
  369.   mov ecx,[sc.work_button_text]
  370.   or  ecx,0x80000000
  371.   mov edx,txt_zoom_p
  372.   mcall
  373.  
  374.   mov ebx,107*65536+13
  375.   mov edx,txt_zoom_m
  376.   int 0x40
  377.  
  378.   mov bx,di
  379.   add bx,270-otst_panel_left
  380.   shl ebx,16
  381.   mov bx,243
  382.   ;mov ebx,270*65536+243
  383.   mov edx,txt151
  384.   int 0x40
  385.  
  386.   mov bx,di
  387.   add bx,270-otst_panel_left
  388.   shl ebx,16
  389.   mov bx,273
  390.   ;mov ebx,270*65536+273
  391.   mov edx,txt152
  392.   int 0x40
  393.  
  394.   mov bx,di
  395.   add bx,415-otst_panel_left
  396.   shl ebx,16
  397.   mov bx,13
  398.   ;mov ebx,415*65536+13
  399.   mov edx,txt_but_refresh
  400.   int 0x40
  401.  
  402.   mov bx,di
  403.   add bx,380-otst_panel_left
  404.   shl ebx,16
  405.   mov bx,275
  406.   ;mov ebx,380*65536+275
  407.   mov edx,txt_met_up
  408.   int 0x40
  409.  
  410.   mov bx,di
  411.   add bx,415-otst_panel_left
  412.   shl ebx,16
  413.   mov bx,275
  414.   ;mov ebx,415*65536+275
  415.   mov edx,txt_met_dn
  416.   int 0x40
  417.  
  418.  
  419.   mov bx,di
  420.   add bx,450-otst_panel_left
  421.   shl ebx,16
  422.   mov bx,275
  423.   ;mov ebx,450*65536+275
  424.   mov edx,txt_met_sh
  425.   int 0x40
  426.  
  427.   mov ecx,[sc.work_text]
  428.   or  ecx,0x80000000
  429.  
  430.   mov ebx,175*65536+13
  431.   mov edx,txt_cache
  432.   int 0x40
  433.  
  434.   mov bx,di
  435.   ;add bx,450-otst_panel_left
  436.   shl ebx,16
  437.   mov bx,35
  438.   ;mov ebx,265*65536+35
  439.   mov edx,txt141
  440.   int 0x40
  441.  
  442.   mov bx,135
  443.   ;mov ebx,265*65536+135
  444.   mov edx,txt142
  445.   int 0x40
  446.  
  447.   call draw_tiles
  448.  
  449.   push dword ch2
  450.   call [check_box_draw]
  451.   push dword ch1
  452.   call [check_box_draw]
  453.  
  454.   stdcall [edit_box_draw], edit1
  455.   stdcall [edit_box_draw], edit2
  456.  
  457.   mcall 12,2
  458. popad
  459.   ret
  460.  
  461.   head_f_i:
  462.   head_f_l  db '‘¨á⥬­ ï ®è¨¡ª ',0
  463.   err_message_found_lib0 db '¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã box_lib.obj',0
  464.   err_message_import0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ box_lib.obj',0
  465.   err_message_found_lib1 db '¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã libimg.obj',0
  466.   err_message_import1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ libimg.obj',0
  467.   err_message_found_lib2 db '¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã str.obj',0
  468.   err_message_import2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ str.obj',0
  469.   err_message_found_lib3 db '¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã libini.obj',0
  470.   err_message_import3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ libini.obj',0
  471.  
  472. system_dir0 db '/sys/lib/'
  473. boxlib_name db 'box_lib.obj',0
  474.  
  475. system_dir1 db '/sys/lib/'
  476. libimg_name db 'libimg.obj',0
  477.  
  478. system_dir2 db '/sys/lib/'
  479. strlib_name db 'str.obj',0
  480.  
  481. system_dir3 db '/sys/lib/'
  482. libini_name db 'libini.obj',0
  483.  
  484. ;library structures
  485. l_libs_start:
  486.   lib0 l_libs boxlib_name, sys_path, file_name, system_dir0, err_message_found_lib0, head_f_l, boxlib_import,err_message_import0, head_f_i
  487.   lib1 l_libs libimg_name, sys_path, file_name, system_dir1, err_message_found_lib1, head_f_l, libimg_import, err_message_import1, head_f_i
  488.   lib2 l_libs strlib_name, sys_path, file_name, system_dir2, err_message_found_lib2, head_f_l, strlib_import, err_message_import2, head_f_i
  489.   lib3 l_libs libini_name, sys_path, file_name, system_dir3, err_message_found_lib3, head_f_l, libini_import, err_message_import3, head_f_i
  490. load_lib_end:
  491.  
  492. align 4
  493. button:
  494.   mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨
  495.   cmp ah,5
  496.   jne @f
  497.     call but_ZoomM
  498.   @@:
  499.   cmp ah,6
  500.   jne @f
  501.     call but_ZoomP
  502.   @@:
  503.   cmp ah,7
  504.   jne @f
  505.     call but_Refresh
  506.   @@:
  507.  
  508.   cmp ah,9
  509.   jz  but_MetSave
  510.   cmp ah,8
  511.   jz  but_MetAdd
  512.  
  513.   cmp ah,10
  514.   jne @f
  515.     call but_met_up
  516.   @@:
  517.   cmp ah,11
  518.   jne @f
  519.     call but_met_dn
  520.   @@:
  521.   cmp ah,12
  522.   jne @f
  523.     call fun_goto_met
  524.   @@:
  525.   cmp ah,1
  526.   jne still
  527.  
  528. .exit:
  529.   push dword[bmp_icon]
  530.   call mem.Free
  531.   stdcall array_tile_function, tile_00,max_tiles_count,tile_destroy
  532.  
  533.   stdcall dword[tl_data_clear], tree1
  534.   mov dword[tree2.data_img_sys],0 ;÷èñòèì óêàçàòåëü íà ñèñòåìíûå èêîíêè,
  535.     ;ò. ê. îíè áûëè óäàëåíû âåðõíåé ôóíêöèåé tl_data_clear
  536.     ;ïîâòîðíûé âûçîâ tl_data_clear áåç ÷èñòêè óêàçàòåëÿ âûçâåò îøèáêó
  537.   mov dword[tree2.data_img],0 ;÷èñòèì óêàçàòåëü íà èêîíêè óçëîâ
  538.   stdcall dword[tl_data_clear], tree2
  539.  
  540. ;  stdcall dword[img_destroy], dword[data_icon]
  541.   mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
  542.  
  543.  
  544. ;input:
  545. ;data_rgb - pointer to rgb data
  546. ;size - count img pixels (size img data / 3(rgb) )
  547. align 4
  548. proc img_rgb_wdiv2 data_rgb:dword, size:dword
  549.   push eax ebx ecx edx
  550.   mov eax,dword[data_rgb]
  551.   mov ecx,dword[size] ;ecx = size
  552.   imul ecx,3
  553.   @@: ;çàòåìíåíèå öâåòà ïèêñåëåé
  554.     shr byte[eax],1
  555.     and byte[eax],0x7f
  556.     inc eax
  557.     loop @b
  558.  
  559.   mov eax,dword[data_rgb]
  560.   mov ecx,dword[size] ;ecx = size
  561.   shr ecx,1
  562.   @@: ;ñëîæåíèå öâåòîâ ïèêñåëåé
  563.     mov ebx,dword[eax+3] ;êîïèðóåì öâåò ñîñåäíåãî ïèêñåëÿ
  564.     add word[eax],bx
  565.     shr ebx,16
  566.     add byte[eax+2],bl
  567.  
  568.     add eax,6 ;=2*3
  569.     loop @b
  570.  
  571.   mov eax,dword[data_rgb]
  572.   add eax,3
  573.   mov ebx,eax
  574.   add ebx,3
  575.   mov ecx,dword[size] ;ecx = size
  576.   shr ecx,1
  577.   dec ecx ;ëèøíèé ïèêñåëü
  578.   @@: ;ïîäæàòèå ïèêñåëåé
  579.     mov edx,dword[ebx]
  580.     mov word[eax],dx
  581.     shr edx,16
  582.     mov byte[eax+2],dl
  583.  
  584.     add eax,3
  585.     add ebx,6
  586.     loop @b
  587.  
  588.   pop edx ecx ebx eax
  589.   ret
  590. endp
  591.  
  592. ;input:
  593. ;data_rgb - pointer to rgb data
  594. ;size - count img pixels (size img data / 3(rgb) )
  595. ;size_w - width img in pixels
  596. align 4
  597. proc img_rgb_hdiv2, data_rgb:dword, size:dword, size_w:dword
  598.   pushad
  599.  
  600.   mov eax,dword[data_rgb] ;eax =
  601.   mov ecx,dword[size]     ;ecx = size
  602.   imul ecx,3
  603.   @@: ;çàòåìíåíèå öâåòà ïèêñåëåé
  604.     shr byte[eax],1
  605.     and byte[eax],0x7f
  606.     inc eax
  607.     loop @b
  608.  
  609.   mov eax,dword[data_rgb] ;eax =
  610.   mov edi,dword[size_w]
  611.   lea esi,[edi+edi*2] ;esi = width*3(rgb)
  612.   mov ebx,esi
  613.   add ebx,eax
  614.   mov ecx,dword[size]  ;ecx = size
  615.   shr ecx,1
  616.   xor edi,edi
  617.   @@: ;ñëîæåíèå öâåòîâ ïèêñåëåé
  618.     mov edx,dword[ebx] ;êîïèðóåì öâåò íèæíåãî ïèêñåëÿ
  619.     add word[eax],dx
  620.     shr edx,16
  621.     add byte[eax+2],dl
  622.  
  623.     add eax,3
  624.     add ebx,3
  625.     inc edi
  626.     cmp edi,dword[size_w]
  627.     jl .old_line
  628.       add eax,esi
  629.       add ebx,esi
  630.       xor edi,edi
  631.     .old_line:
  632.     loop @b
  633.  
  634.  
  635.   mov eax,dword[data_rgb] ;eax =
  636.   add eax,esi ;esi = width*3(rgb)
  637.   mov ebx,esi
  638.   add ebx,eax
  639.   mov ecx,dword[size]  ;ecx = size
  640.   shr ecx,1
  641.   sub ecx,dword[size_w] ;ëèøíÿÿ ñòðîêà ïèêñåëåé
  642.   xor edi,edi
  643.   @@: ;ïîäæàòèå ïèêñåëåé
  644.     mov edx,dword[ebx] ;êîïèðóåì öâåò íèæíåãî ïèêñåëÿ
  645.     mov word[eax],dx
  646.     shr edx,16
  647.     mov byte[eax+2],dl
  648.  
  649.     add eax,3
  650.     add ebx,3
  651.     inc edi
  652.     cmp edi,dword[size_w]
  653.     jl .old_line_2
  654.       add ebx,esi
  655.       xor edi,edi
  656.     .old_line_2:
  657.     loop @b
  658.  
  659.   popad
  660.   ret
  661. endp
  662.  
  663. ;input:
  664. ;data_rgb - pointer to rgb data
  665. ;size - count img pixels (size img data / 3(rgb) )
  666. align 4
  667. proc img_rgb_wmul2, data_rgb:dword, size:dword
  668.   push eax ebx ecx edx
  669.   ;eax - source
  670.   ;ebx - destination
  671.   mov ecx,dword[size] ;ecx = size
  672.   mov eax,ecx
  673.   dec eax
  674.   lea eax,[eax+eax*2] ;eax = (size-1)*3
  675.   mov ebx,eax ;ebx = size*3
  676.   add eax,dword[data_rgb] ;eax = pointer + size*3
  677.   add ebx,eax ;ebx = pointer + 2*size*3
  678.   @@:
  679.     mov edx,dword[eax] ;edx = pixel color
  680.     mov word[ebx],dx
  681.     mov word[ebx+3],dx
  682.     shr edx,16
  683.     mov byte[ebx+2],dl
  684.     mov byte[ebx+3+2],dl
  685.     sub eax,3
  686.     sub ebx,6
  687.     loop @b
  688.   pop edx ecx ebx eax
  689.   ret
  690. endp
  691.  
  692. ;äã­ªæ¨ï ¤«ï à áâ¢ ­¨ï ¨§®¡à ¦¥­¨ï ¯® ¢ëá®â¥ ¢ 2 à § 
  693. ;¢ 㪠§ â¥«¥ data_rgb ¯ ¬ï⨠¤®«¦­® ¡ëâì ¢ 2 à §  ¡®«ìè¥ ç¥¬ size*3
  694. ;¨­ ç¥ ¯à¨ à áâ¢ ­¨¨ ¡ã¤¥â ®è¨¡ª , ¢ë室  ­  çã¦ãî ¯ ¬ïâì
  695. ;input:
  696. ;data_rgb - pointer to rgb data
  697. ;size - count img pixels (size img data / 3(rgb) )
  698. ;size_w - width img in pixels
  699. align 4
  700. proc img_rgb_hmul2, data_rgb:dword, size:dword, size_w:dword
  701.   pushad
  702.  
  703.   mov esi,dword[size_w]
  704.   lea esi,[esi+esi*2] ;esi = width * 3(rgb)
  705.   mov eax,dword[size]
  706.   lea eax,[eax+eax*2]
  707.   mov edi,eax
  708.   shl edi,1
  709.   add eax,dword[data_rgb] ;eax = pointer to end pixel (old image) + 1
  710.   add edi,dword[data_rgb] ;edi = pointer to end pixel (new image) + 1
  711.   mov ebx,edi
  712.   sub ebx,esi
  713.  
  714.   .beg_line:
  715.   mov ecx,dword[size_w]
  716.   @@:
  717.     sub eax,3
  718.     sub ebx,3
  719.     sub edi,3
  720.  
  721.     mov edx,dword[eax] ;edx = pixel color
  722.     mov word[ebx],dx
  723.     mov word[edi],dx
  724.     shr edx,16
  725.     mov byte[ebx+2],dl
  726.     mov byte[edi+2],dl
  727.  
  728.     loop @b
  729.  
  730.   sub ebx,esi
  731.   sub edi,esi
  732.  
  733.   cmp eax,dword[data_rgb]
  734.   jg .beg_line
  735.  
  736.   popad
  737.   ret
  738. endp
  739.  
  740. ;input:
  741. ;data_rgb - pointer to rgb data
  742. ;size - count img pixels (size img data / 3(rgb) )
  743. ;size_w - width img in pixels
  744. align 4
  745. proc img_rgb_hoffs, data_rgb:dword, size:dword, size_w:dword, hoffs:dword
  746.   push eax ebx ecx edx esi
  747.  
  748.   mov esi,dword[size_w]
  749.   lea esi,[esi+esi*2] ;esi = width * 3(rgb)
  750.   imul esi,dword[hoffs]
  751.  
  752.   mov eax,dword[size]
  753.   lea eax,[eax+eax*2]
  754.   add eax,dword[data_rgb] ;eax = pointer to end pixel + 1
  755.   sub eax,3
  756.   mov ebx,eax
  757.   add ebx,esi
  758.  
  759.   mov ecx,dword[size]
  760.   dec ecx
  761.   @@:
  762.     mov edx,dword[eax] ;edx = pixel color
  763.     mov word[ebx],dx
  764.     shr edx,16
  765.     mov byte[ebx+2],dl
  766.  
  767.     sub eax,3
  768.     sub ebx,3
  769.     loop @b
  770.   pop esi edx ecx ebx eax
  771.   ret
  772. endp
  773.  
  774.  
  775. ;input:
  776. ;data_rgb - pointer to rgb data
  777. ;size_w_old - width img in pixels
  778. ;size_w_new - new width img in pixels
  779. ;size_h - height img in pixels
  780. align 4
  781. proc img_rgb_wcrop, data_rgb:dword, size_w_old:dword, size_w_new:dword, size_h:dword
  782.   pushad
  783.     mov eax, dword[size_w_old]
  784.     lea eax, dword[eax+eax*2] ;eax = width(old) * 3(rgb)
  785.     mov ebx, dword[size_w_new]
  786.     lea ebx, dword[ebx+ebx*2] ;ebx = width(new) * 3(rgb)
  787.     mov edx, dword[size_h]
  788.     ;dec edx
  789.     mov edi, dword[data_rgb] ;edi - ¯®«ã砥⠤ ­­ë¥
  790.     mov esi, edi
  791.     add edi, ebx
  792.     add esi, eax
  793.     cld
  794.   @@:
  795.     dec edx ;㬥­ìè ¥¬ áç¥â稪 ®áâ ¢è¨åáï áâப ­  1
  796.     cmp edx,0
  797.     jle @f
  798.  
  799.     mov ecx, ebx
  800.     rep movsb ;¯¥à¥­®á (ª®¯¨à®¢ ­¨¥) áâப¨ ¯¨ªá¥«¥©
  801. ;stdcall mem_copy,esi,edi,ebx
  802.  
  803.     add esi,eax ;¯¥à¥å®¤ ­  ­®¢ãî áâà®çªã ¨§®¡à ¦¥­¨ï
  804.     sub esi,ebx
  805. ;add esi,eax
  806. ;add edi,ebx
  807.     jmp @b
  808.   @@:
  809.  
  810.   popad
  811.   ret
  812. endp
  813.  
  814. align 4
  815. proc mem_copy, source:dword, destination:dword, len:dword
  816.   push ecx esi edi
  817.     cld
  818.     mov esi, dword[source]
  819.     mov edi, dword[destination]
  820.     mov ecx, dword[len]
  821.     rep movsb
  822.   pop edi esi ecx
  823.   ret
  824. endp
  825.  
  826. align 4
  827. proc mem_clear, mem:dword, len:dword
  828.   push eax ecx edi
  829.     cld
  830.     xor al,al
  831.     mov edi, dword[mem]
  832.     mov ecx, dword[len]
  833.     repne stosb
  834.   pop edi ecx eax
  835.   ret
  836. endp
  837.  
  838.   txt_met_up db 24,0
  839.   txt_met_dn db 25,0
  840.   txt_met_sh db '*',0
  841.   txt_zoom_m db '-',0
  842.   txt_zoom_p db '+',0
  843.   txt151 db '„®¡ ¢¨âì ¬¥âªã',0
  844.   txt152 db '‘®åà ­¨âì ¬¥âª¨',0
  845.   txt_but_refresh db 'Ž¡­®¢¨âì',0
  846.   txt_cache db 'Cache:',0
  847.   txt141 db '‚¨¤ ª àâë',0
  848.   txt142 db '‚ë¡®à ¬¥âª¨',0
  849.  
  850. ; check_boxes
  851. ch1 check_box 5,  5, 6, 12, 0xffffd0, 0x800000, 0, ch_text1, 12,ch_flag_en
  852. ch2 check_box 5, 20, 6, 12, 0xffffd0, 0x800000, 0, ch_text2, 11,ch_flag_en
  853. checkboxes_end:
  854.  
  855. ch_text1 db '¡à âì ᢥàåã'
  856. ch_text2 db '¡à âì á­¨§ã'
  857.  
  858. edit1 edit_box 190, 215,  10, 0xd0ffff, 0xff, 0x80ff, 0, 0xa000, 500, ed_buffer.1, mouse_dd, 0
  859. edit2 edit_box 100, 370, 240, 0xd0ffff, 0xff, 0x80ff, 0, 0xa000,  30, ed_buffer.2, mouse_dd, 0
  860. editboxes_end:
  861.  
  862. tree1 tree_list 10,10, tl_list_box_mode+tl_key_no_edit, 16,16,\
  863.     0x8080ff,0x0000ff,0xffffff, 265,45,90,85, 0,0,0,\
  864.     el_focus, 0,fun_new_map_type
  865. tree2 tree_list 32,300, tl_draw_par_line, 16,16,\
  866.     0x8080ff,0x0000ff,0xffffff, 265,145,190,85, 0,12,0,\
  867.     el_focus, wScrMetki,fun_goto_met
  868.  
  869. align 4
  870. wScrMetki:
  871. .x:
  872. .size_x     dw 16 ;+0
  873. .start_x    dw 0 ;+2
  874. .y:
  875. .size_y     dw 100 ;+4
  876. .start_y    dw 0 ;+6
  877. .btn_high   dd 15 ;+8
  878. .type       dd 1  ;+12
  879. .max_area   dd 100  ;+16
  880. .cur_area   dd 30  ;+20
  881. .position   dd 0  ;+24
  882. .bckg_col   dd 0xeeeeee ;+28
  883. .frnt_col   dd 0xbbddff ;+32
  884. .line_col   dd 0  ;+36
  885. .redraw     dd 0  ;+40
  886. .delta      dw 0  ;+44
  887. .delta2     dw 0  ;+46
  888. .run_x:
  889. .r_size_x   dw 0  ;+48
  890. .r_start_x  dw 0  ;+50
  891. .run_y:
  892. .r_size_y   dw 0 ;+52
  893. .r_start_y  dw 0 ;+54
  894. .m_pos      dd 0 ;+56
  895. .m_pos_2    dd 0 ;+60
  896. .m_keys     dd 0 ;+64
  897. .run_size   dd 0 ;+68
  898. .position2  dd 0 ;+72
  899. .work_size  dd 0 ;+76
  900. .all_redraw dd 0 ;+80
  901. .ar_offset  dd 1 ;+84
  902.  
  903. ed_buffer: ;òåêñò äëÿ edit
  904.   .1: rb 502
  905.   .2: rb 32
  906.  
  907. el_focus dd tree1
  908.  
  909. tree_sys_icon dd 0
  910. tree_nod_icon dd 0
  911.  
  912. bmp_icon   dd 0 ;¯ ¬ïâì ¤«ï § £à㧪¨ ¨§®¡à ¦¥­¨ï
  913. data_icon  dd 0 ;¯ ¬ïâì ¤«ï ¯à¥®¡à §®¢ ­¨ï ª à⨭ª¨ äã­ªæ¨ï¬¨ libimg
  914.  
  915. run_file_70 f70
  916.  
  917.  
  918. txt_tile_path db 'tile path',0
  919.   rb 300
  920. txt_tile_type dd txt_tile_type_0 ;óêàçàòåëü íà âûáðàííûé òèï ôàéëîâ
  921. txt_tile_type_0 db 0
  922.   rb 10
  923.  
  924. align 4
  925. map: ;êîîðäèíàòû êàðòû
  926.   .coord_x dd 0 ;êîîðäèíàòà x
  927.   .coord_y dd 0 ;êîîðäèíàòà y
  928.   .zoom    db 1 ;ìàñøòàá
  929.  
  930. align 4
  931. tile_00 rb size_tile_struc * max_tiles_count
  932.  
  933. ;ýòîò êîä íå ìîé, îí ïðåîáðàçóåò ÷èñëî â ñòðîêó
  934. ;input:
  935. ; eax = value
  936. ; edi = string buffer
  937. ;output:
  938. ; edi =
  939. align 4
  940. tl_convert_to_str:
  941.   pushad
  942.     mov dword[edi+1],0;0x20202020
  943.     call .str
  944.   popad
  945.   ret
  946.  
  947. align 4
  948. .str:
  949.   mov ecx,0x0a ;çàäàåòñÿ ñèñòåìà ñ÷èñëåíèÿ èçìåíÿþòñÿ ðåãèñòðû ebx,eax,ecx,edx âõîäíûå ïàðàìåòðû eax - ÷èñëî
  950.     ;ïðåðåâîä ÷èñëà â ASCII ñòðîêó âçîäíûå äàííûå ecx=ñèñòåìà ñ÷èñëåíÿ edi àäðåñ êóäà çàïèñûâàòü, áóäåì ñòðîêó, ïðè÷åì êîíåö ïåðåìåííîé
  951.   cmp eax,ecx  ;ñðàâíèòü åñëè â eax ìåíüøå ÷åì â ecx òî ïåðåéòè íà @@-1 ò.å. íà pop eax
  952.   jb @f
  953.   xor edx,edx  ;î÷èñòèòü edx
  954.   div ecx      ;ðàçäåëèòü - îñòàòîê â edx
  955.   push edx     ;ïîëîæèòü â ñòåê
  956.   ;dec edi             ;ñìåùåíèå íåîáõîäèìîå äëÿ çàïèñè ñ êîíöà ñòðîêè
  957.   call .str;ïåðåéòè íà ñàìó ñåáÿ ò.å. âûçâàòü ñàìó ñåáÿ è òàê äî òîãî ìîìåíòà ïîêà â eax íå ñòàíåò ìåíüøå ÷åì â ecx
  958.   pop eax
  959.   @@: ;cmp al,10 ;ïðîâåðèòü íå ìåíüøå ëè çíà÷åíèå â al ÷åì 10 (äëÿ ñèñòåìû ñ÷èñëåíÿ 10 äàííàÿ êîìàíäà - ëèøíàÿ))
  960.   or al,0x30  ;äàííàÿ êîìàíäà êîðî÷å  ÷åì äâå âûøå
  961.   stosb       ;çàïèñàòü ýëåìåíò èç ðåãèñòðà al â ÿ÷åêó ïàìÿòè es:edi
  962.   ret         ;âåðíóòüñÿ ÷åíü èíòåðåñíûé õîä ò.ê. ïîêà â ñòåêå õðàíèòüñÿ êîë-âî âûçîâîâ òî ñòîëüêî ðàç ìû è áóäåì âûçûâàòüñÿ
  963.  
  964.  
  965. hed db 'Planet viewer 09.02.10',0 ;¯®¤¯¨áì ®ª­ 
  966.  
  967. sc system_colors  ;á¨á⥬­ë¥ 梥â 
  968. mouse_dd dd 0 ;­ã¦­® ¤«ï Shift-  ¢ editbox
  969.   sys_path rb 4096
  970.   file_name:
  971.     rb 4096
  972. i_end:
  973.   procinfo process_information
  974.   rb 1024
  975. stacktop:
  976. mem:
  977.  
  978.