Subversion Repositories Kolibri OS

Rev

Rev 2501 | Rev 7514 | 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. include '../../../macros.inc'
  13. include '../../../proc32.inc'
  14. include '../../../develop/libraries/box_lib/load_lib.mac'
  15. include '../../../dll.inc'
  16.  
  17. @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
  18. hed db 'Life 05.09.14',0 ;¯®¤¯¨áì ®ª­ 
  19.  
  20. struct FileInfoBlock
  21.         Function dd ?
  22.         Position dd ?
  23.         Flags    dd ?
  24.         Count    dd ?
  25.         Buffer   dd ?
  26.                 db ?
  27.         FileName dd ?
  28. ends
  29.  
  30. run_file_70 FileInfoBlock
  31. image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
  32.  
  33. fn_toolbar db 'toolbar.png',0
  34. IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
  35. IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*9
  36. image_data_toolbar dd 0
  37.  
  38. macro load_image_file path,buf,size { ;¬ ªà®á ¤«ï § £à㧪¨ ¨§®¡à ¦¥­¨©
  39.         ;path - ¬®¦¥â ¡ëâì ¯¥à¥¬¥­­®© ¨«¨ áâப®¢ë¬ ¯ à ¬¥â஬
  40.         if path eqtype '' ;¯à®¢¥à塞 § ¤ ­ «¨ áâப®© ¯ à ¬¥âà path
  41.                 jmp @f
  42.                         local .path_str
  43.                         .path_str db path ;ä®à¬¨à㥬 «®ª «ì­ãî ¯¥à¥¬¥­­ãî
  44.                         db 0
  45.                 @@:
  46.                 ;32 - áâ ­¤ àâ­ë©  ¤à¥á ¯® ª®â®à®¬ã ¤®«¦¥­ ¡ëâì ¡ãä¥à á á¨á⥬­ë¬ ¯ã⥬
  47.                 copy_path .path_str,[32],file_name,0x0
  48.         else
  49.                 copy_path path,[32],file_name,0x0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
  50.         end if
  51.  
  52.         stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
  53.         mov [buf],eax
  54.  
  55.         mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
  56.         mov [run_file_70.Function], 0
  57.         mov [run_file_70.Position], 0
  58.         mov [run_file_70.Flags], 0
  59.         mov [run_file_70.Count], dword size
  60.         m2m [run_file_70.Buffer], [buf]
  61.         mov byte[run_file_70+20], 0
  62.         mov [run_file_70.FileName], file_name
  63.         mov ebx,run_file_70
  64.         int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
  65.         cmp ebx,0xffffffff
  66.         je @f
  67.                 ;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data
  68.                 stdcall dword[img_decode], dword[buf],ebx,0
  69.                 mov dword[image_data],eax
  70.                 ;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥­¨¥ ª ä®à¬ âã rgb
  71.                 stdcall dword[img_to_rgb2], dword[image_data],dword[buf]
  72.                 ;㤠«ï¥¬ ¢à¥¬¥­­ë© ¡ãä¥à image_data
  73.                 stdcall dword[img_destroy], dword[image_data]
  74.         @@:
  75. }
  76.  
  77. ;--------------------------------------
  78. struct Cell
  79.         x dd ? ;+0
  80.         y dd ? ;+4
  81.         tc dd ? ;+8
  82.         liv db ? ;+12
  83.         so db ? ;+13
  84. ends
  85.  
  86. MAX_CELL equ 90000
  87. COL_MEM equ 64 ;ç¨á«® 梥⮢
  88.  
  89. cell dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì á® áâàãªâãà ¬¨ ï祥ª
  90. memCell dd 0
  91. CellColors dd 0
  92.  
  93. macro get_cell_offset reg,ind
  94. {
  95.         mov reg,ind
  96.         imul reg,sizeof.Cell
  97.         add reg,dword[cell]
  98. }
  99.  
  100. capt rb 50
  101. er_oom db 0 ;­  á«ãç © ¨áç¥à¯ ­¨ï ¯ ¬ïâ¨
  102. tim_ch db 0 ; ¢â®¬ â¨ç¥áª¨ ¯à®áç¨â뢠âì ¯®ª®«¥­¨ï
  103. poc_stop dd 1 ;¯à®áç¥â ­  ç¨á«® ¯®ª®«¥­¨©
  104. Cor_x dd 0
  105. Cor_y dd 0
  106. tim dd 0 ;¢à¥¬ï (¯®ª®«¥­¨¥)
  107. b_sort dd 0 ;£à ­¨æ  ¤«ï á®àâ¨à®¢ ­­ëå ï祥ª
  108. osob dd 0 ;ç¨á«® ®á®¡¥©
  109. zoom db 3 ;¬ áèâ ¡ ¯®«ï
  110. txt_zoom db 'Œ áèâ ¡:',0
  111. txt_gen db '®ª®«¥­¨¥:',0
  112. txt_osob db 'Žá®¡¥©:',0
  113.  
  114. ;­ áâனª  ¬ áᨢ  á 梥⠬¨
  115. ; col_pole - 梥⠯®«ï
  116. ; col_cell_n - 梥⠭®¢®© ï祩ª¨
  117. ; col_cell_o - 梥â áâ à®© ï祩ª¨
  118. align 4
  119. proc pole_init_colors uses eax ebx ecx edx esi edi, col_pole:dword, col_cell_n:dword, col_cell_o:dword
  120.         mov esi,dword[CellColors]
  121.         mov ebx,dword[col_pole]
  122.         mov dword[esi],ebx
  123.  
  124.         add esi,4
  125.         mov edi,COL_MEM
  126.         dec edi
  127.         shl edi,2
  128.         add edi,esi
  129.         ; esi - 㪠§ â¥«ì ­  1-© £à ¤¨¥­â­ë© 梥â
  130.         ; edi - 㪠§ â¥«ì ­  ¯®á«¥¤­¨© £à ¤¨¥­â­ë© 梥â
  131.         mov eax,dword[col_cell_n]
  132.         mov ebx,dword[col_cell_o]
  133.  
  134.         mov dword[esi],eax
  135.         mov dword[edi],ebx
  136.         ;need save ecx edx
  137.         stdcall middle_colors, esi,edi
  138.  
  139.         ret
  140. endp
  141.  
  142. ;¢á¯®¬®£ â¥«ì­ ï äã­ªæ¨ï ¤«ï ­ å®¤¦¥­¨ï á।­¥£® æ¢¥â  ¨ § ¯¨á¨ ¥£® ¢ ¬ áᨢ
  143. ;input:
  144. ; eax - 梥⠭ ç «ì­ë©
  145. ; ebx - 梥⠪®­¥ç­ë©
  146. ;§ §àãè îâìáï: ecx, edx
  147. align 4
  148. proc middle_colors uses edi esi, i0:dword, i1:dword
  149.         mov esi,dword[i0]
  150.         mov edi,dword[i1]
  151.         ;¯¥à¥¤ ¢ë§®¢®¬ ä㭪樨
  152.         ;dword[esi]=eax
  153.         ;dword[edi]=ebx
  154.         sub edi,esi
  155.         shr edi,1
  156.         btr edi,1 ;®ªà㣫塞 ¤® 4-å, â. ª. ­ã¦­® ¯®«ãç¨âì  ¤à¥á (®ªà㣫¥­¨¥ å¨â஥ - 㡨ࠥ¬ ®¤¨­ ¡¨â ¢¬¥áâ® ¯à¥¤¯®« £ ¥¬ëå 2-å)
  157.         add edi,esi
  158.         cmp edi,esi
  159.         je @f
  160.                 push eax ebx
  161.  
  162.                 mov ecx,eax
  163.                 mov edx,ebx
  164.  
  165.                 ;­ å®¤¨¬ á।­¨© 梥⠬¥¦¤ã eax ¨ ebx
  166.                 and ebx,111111101111111011111110b ;㡨ࠥ¬ ¯®á«¥¤­¨¥ ¡¨âë ¢ 梥â å r, g, b
  167.                 and eax,111111101111111011111110b
  168.                 add eax,ebx ;á㬨à㥬 æ¢¥â  ¨§ r, g, b
  169.                 shr eax,1   ;¤¥«¨¬ ­  2
  170.                 mov dword[edi],eax
  171.  
  172.                 ;४ãàᨢ­ë© ¢ë§®¢ ¤«ï ¤à®¡«¥­¨ï ¢¥àå­¥© ¯®«®¢¨­ë
  173.                 mov ebx,eax
  174.                 mov eax,ecx
  175.                 stdcall middle_colors, [i0],edi
  176.  
  177.                 ;४ãàᨢ­ë© ¢ë§®¢ ¤«ï ¤à®¡«¥­¨ï ­¨¦­¥© ¯®«®¢¨­ë
  178.                 mov eax,ebx
  179.                 mov ebx,edx
  180.                 stdcall middle_colors, edi,[i1]
  181.  
  182.                 pop ebx eax
  183.         @@:
  184.         ret
  185. endp
  186.  
  187. align 4
  188. pole_clear:
  189.         push eax ecx edi
  190.         xor eax,eax
  191.         mov dword[tim],eax
  192.         mov dword[osob],eax
  193.         mov  byte[tim_ch],al
  194.         mov dword[Cor_x],eax
  195.         mov dword[Cor_y],eax
  196.         mov dword[b_sort],eax
  197.         mov  byte[er_oom],al
  198.         cld
  199.         mov ecx,MAX_CELL
  200.         imul ecx,sizeof.Cell
  201.         mov edi,dword[cell]
  202.         repne stosb ;memset(cell,0,sizeof(Cell)*MAX_CELL);
  203.         mov edi,dword[memCell]
  204.         mov ecx,MAX_CELL
  205.         @@:
  206.                 stosd ;for(i=0;i<MAX_CELL;i++) memCell[i]=i;
  207.                 ;mov dword[edi],eax
  208.                 ;add edi,4
  209.                 inc eax
  210.                 loop @b
  211.         pop edi ecx eax
  212.         ret
  213.  
  214. align 4
  215. proc pole_cell_creat, x:dword, y:dword, li:dword
  216.         pushad ;eax ebx ecx edx edi
  217.  
  218.         ; *** ¥á«¨ ª«¥âª  㦥 ¡ë«  ᮧ¤ ­ 
  219.         stdcall pole_cell_find, [x],[y]
  220.         cmp eax,0
  221.         je @f ;if(i){
  222.                 get_cell_offset ebx,eax
  223.                 cmp dword[li],0
  224.                 jne .else_if ;if(!li)
  225.                         ; ¥á«¨ ᮧ¤ ¥âáï ¯ãáâ ï ª«¥âª 
  226.                         inc byte[ebx+13] ;+13 = .so
  227.                         jmp .fun_e
  228.                 .else_if: ;else if(!(cell[i].liv&1) ){
  229.                 bt word[ebx+12],0 ;+12 = .liv
  230.                         ; ¥á«¨ ᮧ¤ ¥âáï ¦¨¢ ï ª«¥âª 
  231.                         ; ¨ à ­ìè¥ ª«¥âª  ¡ë«  ᮧ¤ ­  ­® ®ª § « áì ¯ãá⮩
  232.                         jae .creat_border_cells
  233.                 jmp .fun_e
  234.         @@:
  235.  
  236.         ; *** ᮧ¤ ­¨¥ ­®¢®© ï祩ª¨
  237.         ; ­ å®¤¨¬ ­®¬¥à ᢮¡®¤­®© ï祩ª¨ (i) ¤«ï ¤®¡ ¢«¥­¨ï ­®¢®©
  238.         mov edi,dword[memCell]
  239.         inc dword[edi]
  240.         cmp dword[edi],MAX_CELL
  241.         jne @f
  242.                 dec dword[edi]
  243.                 mov byte[tim_ch],0
  244.                 ;... need call message: "eror out of memory" ...
  245.                 ;... ¢ë¢®¤ á®®¡é¥­¨ï ¯¥à¥¯®«­¥­¨ï ­ ¤® ¤®¡ ¢¨âì  ...
  246.                 mov byte[er_oom],0
  247.                 jmp .fun_e ;return;
  248.         @@:
  249.         mov eax,dword[edi]
  250.         shl eax,2
  251.         add eax,dword[memCell] ;eax -> memCell[firstC]
  252.         get_cell_offset ebx,dword[eax]
  253.  
  254.         mov ecx,dword[x]
  255.         mov dword[ebx],ecx ;+0 = .x
  256.         mov edx,dword[y]
  257.         mov dword[ebx+4],edx ;+4 = .y
  258.         mov eax,dword[tim]
  259.         mov dword[ebx+8],eax ;+8 = .tc
  260.         mov byte[ebx+12],0 ;+12 = .liv
  261.  
  262.         cmp dword[li],0
  263.         jne @f
  264.                 mov byte[ebx+13],1 ;+13 = .so
  265.                 jmp .fun_e
  266.         @@:
  267.         mov byte[ebx+13],0 ;+13 = .so
  268.  
  269.         .creat_border_cells:
  270.                 inc dword[osob]
  271.                 or byte[ebx+12],1 ;+12 = .liv
  272.                 mov ecx,dword[x]
  273.                 dec ecx
  274.                 mov edx,dword[y]
  275.                 dec edx
  276.                 stdcall pole_cell_creat,ecx,edx,0
  277.                 inc edx
  278.                 stdcall pole_cell_creat,ecx,edx,0
  279.                 inc edx
  280.                 stdcall pole_cell_creat,ecx,edx,0
  281.                 inc ecx
  282.                 stdcall pole_cell_creat,ecx,edx,0
  283.                 sub edx,2
  284.                 stdcall pole_cell_creat,ecx,edx,0
  285.                 inc ecx
  286.                 stdcall pole_cell_creat,ecx,edx,0
  287.                 inc edx
  288.                 stdcall pole_cell_creat,ecx,edx,0
  289.                 inc edx
  290.                 stdcall pole_cell_creat,ecx,edx,0
  291.         .fun_e:
  292.         popad ;edi edx ecx ebx eax
  293.         ret
  294. endp
  295.  
  296. ;output:
  297. ; eax - index
  298. align 4
  299. proc pole_cell_find, x:dword, y:dword
  300.         mov eax,dword[memCell]
  301.         cmp dword[eax],0
  302.         jne @f
  303.                 xor eax,eax ;if(!fristC) return 0;
  304.                 jmp .fun_e
  305.         @@:
  306.  
  307.         xor eax,eax ;fnd=0;
  308.         cmp dword[b_sort],0
  309.         je @f
  310.                 stdcall pole_bin_find, [memCell], [x],[y], [b_sort] ;i=BinFind(memCell, x,y, b_sort);
  311.                 cmp eax,0
  312.                 je @f
  313.                         shl eax,2
  314.                         add eax,dword[memCell]
  315.                         mov eax,dword[eax] ;if(i) fnd=memCell[i];
  316.                         jmp .fun_e
  317.         @@:
  318.  
  319.         cmp eax,0
  320.         jne @f ;if(!fnd){ // ¯®¨áª ï祩ª¨ §  ¡¨­ à­ë¬ ¤¥à¥¢®¬
  321.                 push ebx ecx edx edi esi
  322.                 ;ebx -> i
  323.                 ;ecx -> firstC
  324.                 ;edx -> &memCell[i]
  325.                 ;edi -> cell[memCell[i]]
  326.                 mov ecx,dword[memCell]
  327.                 mov ebx,dword[b_sort]
  328.                 mov edx,ebx
  329.                 shl edx,2
  330.                 add edx,ecx
  331.                 mov ecx,dword[ecx]
  332.                 .cycle_b: ;for(i=b_sort+1;i<=fristC;i++)
  333.                         inc ebx
  334.                         cmp ebx,ecx
  335.                         jg .cycle_e
  336.                         add edx,4
  337.                         get_cell_offset edi,dword[edx]
  338.                         mov esi,dword[x]
  339.                         cmp dword[edi],esi ;+0 = .x
  340.                         jne .if_e
  341.                         mov esi,dword[y]
  342.                         cmp dword[edi+4],esi ;+4 = .y
  343.                         jne .if_e
  344.                                 ;if(cell[memCell[i]].x==x && cell[memCell[i]].y==y){
  345.                                 mov eax,dword[edx] ;fnd=memCell[i];
  346.                                 jmp .cycle_e ;break;
  347.                         .if_e:
  348.                         jmp .cycle_b
  349.                 .cycle_e:
  350.                 pop esi edi edx ecx ebx
  351.         @@:
  352.         .fun_e:
  353.         ret
  354. endp
  355.  
  356. ;output:
  357. ; eax - index
  358. align 4
  359. proc pole_bin_find, mas:dword, fx:dword, fy:dword, k:dword
  360.         push ebx ecx edx edi
  361.         xor eax,eax
  362.         mov ebx,1 ;ebx - ¬ ªá¨¬ «ì­ë© ¯®à冷ª ¤«ï ¤¥à¥¢ 
  363.         @@:
  364.         cmp dword[k],ebx
  365.         jle @f ;while(k>por)
  366.                 shl ebx,1 ;por<<=1;
  367.                 jmp @b
  368.         @@:
  369.         cmp dword[k],ebx
  370.         jge @f ;if(k<por)
  371.                 shr ebx,1 ;por>>=1;
  372.         @@:
  373.         mov ecx,ebx ;i=por;
  374.  
  375.         ;ecx -> i
  376.         ;edi -> mas[i]
  377.         .cycle_b: ;do{
  378.                 shr ebx,1 ;por>>=1;
  379.  
  380.                 mov edi,ecx
  381.                 shl edi,2
  382.                 add edi,dword[mas]
  383.                 ;if(compare_cells_mb(mas[i],fx,fy)){
  384.                 stdcall pole_compare_cells_mb_coords, dword[edi],[fx],[fy]
  385.                 cmp dl,0
  386.                 je .if_u0_e
  387.                         @@: ;while(i+por>k)
  388.                         mov edx,ecx
  389.                         add edx,ebx
  390.                         cmp edx,dword[k] ;i+por>k
  391.                         jle @f
  392.                                 shr ebx,1 ;por>>=1;
  393.                                 jmp @b
  394.                         @@:
  395.                         add ecx,ebx ;i+=por;
  396.                         jmp .if_e
  397.                 .if_u0_e:
  398.                 ;else if(compare_cells_bm(mas[i],fx,fy))i-=por;
  399.                 stdcall pole_compare_cells_bm_coords, dword[edi],[fx],[fy]
  400.                 cmp dl,0
  401.                 je .if_u1_e
  402.                         sub ecx,ebx
  403.                         jmp .if_e
  404.                 .if_u1_e:
  405.                 ;else { m=i; por=0; }
  406.                         mov eax,ecx
  407.                         xor ebx,ebx
  408.                 .if_e:
  409.         cmp ebx,0
  410.         jne .cycle_b ;}while(por);
  411.  
  412.         pop edi edx ecx ebx
  413.         ret
  414. endp
  415.  
  416. ;output:
  417. ; dl
  418. align 4
  419. proc pole_compare_cells_bm_coords, i0:dword, fx:dword, fy:dword
  420.         push eax ebx ecx
  421.         get_cell_offset eax,[i0]
  422.         ;eax -> cell[i0]
  423.         mov ebx,dword[fx]
  424.         cmp dword[eax],ebx
  425.         jle @f
  426.                 mov dl,1
  427.                 jmp .fun_e
  428.         @@:
  429.         mov ecx,dword[fy]
  430.         cmp dword[eax+4],ecx
  431.         jle @f
  432.         cmp dword[eax],ebx
  433.         jne @f
  434.                 mov dl,1
  435.                 jmp .fun_e
  436.         @@:
  437.         xor dl,dl
  438.         .fun_e:
  439.         pop ecx ebx eax
  440.         ret
  441. endp
  442.  
  443. ;output:
  444. ; dl
  445. align 4
  446. proc pole_compare_cells_mb_coords, i0:dword, fx:dword, fy:dword
  447.         push eax ebx ecx
  448.         get_cell_offset eax,[i0]
  449.         ;eax -> cell[i0]
  450.         mov ebx,dword[fx]
  451.         cmp dword[eax],ebx
  452.         jge @f
  453.                 mov dl,1
  454.                 jmp .fun_e
  455.         @@:
  456.         mov ecx,dword[fy]
  457.         cmp dword[eax+4],ecx
  458.         jge @f
  459.         cmp dword[eax],ebx
  460.         jne @f
  461.                 mov dl,1
  462.                 jmp .fun_e
  463.         @@:
  464.         xor dl,dl
  465.         .fun_e:
  466.         pop ecx ebx eax
  467.         ret
  468. endp
  469.  
  470. ;output:
  471. ; dl
  472. align 4
  473. proc pole_compare_cells_bm, i0:dword, i1:dword
  474.         push eax ebx ecx
  475.         get_cell_offset eax,[i0] ;eax -> cell[i0]
  476.         get_cell_offset ebx,[i1] ;ebx -> cell[i1]
  477.         mov ecx,dword[ebx] ;+0 = .x
  478.         cmp dword[eax],ecx
  479.         jle @f ;x0>x1
  480.                 mov dl,1
  481.                 jmp .fun_e
  482.         @@:
  483.         jne @f ;x0==x1
  484.         mov ecx,dword[ebx+4] ;+4 = .y
  485.         cmp dword[eax+4],ecx
  486.         jle @f ;y0>y1
  487.                 mov dl,1
  488.                 jmp .fun_e
  489.         @@:
  490.         xor dl,dl
  491.         .fun_e:
  492.         pop ecx ebx eax
  493.         ret
  494. endp
  495.  
  496. align 4
  497. pole_paint:
  498.         pushad
  499.         ;eax -> firstC
  500.         ;ebx -> i
  501.         ;ecx -> cell[memCell[i]]
  502.         ;edx -> color
  503.         ;edi -> coord_x
  504.         ;esi -> coord_y
  505.         mov eax,dword[memCell]
  506.         cmp dword[eax],0
  507.         je .no_draw
  508.  
  509.         mov eax,dword[eax]
  510.         mov ebx,1
  511.  
  512. ;---
  513.         @@: ;while(i<b_sort && Cor_x+cell[memCell[i]].x<0)
  514.                 cmp ebx,dword[b_sort]
  515.                 jge @f ;¯¥à¥å®¤¨¬ ­  ­ ç «® ­¨¦­¥£® 横« 
  516.                 mov ecx,ebx
  517.                 shl ecx,2
  518.                 add ecx,dword[memCell]
  519.                 get_cell_offset ecx,dword[ecx]
  520.                 mov edx,dword[ecx] ;+0 = .x
  521.                 add edx,dword[Cor_x]
  522.                 cmp edx,0
  523.                 jge @f ;¯¥à¥å®¤¨¬ ­  ­ ç «® ­¨¦­¥£® 横« 
  524.                         inc ebx ;i++; // ¤«ï ¯à®¯ã᪠ ï祥ª §  ®ª­®¬ á«¥¢ 
  525.                 jmp @b
  526.         @@:
  527.  
  528.         cmp byte[zoom],2
  529.         jge .zoom2
  530.         @@: ;for(;i<=fristC;i++){
  531.                 mov ecx,ebx
  532.                 shl ecx,2
  533.                 add ecx,dword[memCell]
  534.                 get_cell_offset ecx,dword[ecx]
  535. ;...
  536.                 mov edi,dword[Cor_x]
  537.                 add edi,dword[ecx] ;+0 = .x
  538.                 mov esi,dword[Cor_y]
  539.                 add esi,dword[ecx+4] ;+4 = .y
  540.                 bt word[ecx+12],0 ;+12 = .liv
  541.                 jc .cell_1
  542.                         ;­¥ ¦¨¢ ï ï祩ª 
  543.                         mov edx,dword[CellColors]
  544.                         mov edx,dword[edx]
  545.                         jmp .cell_0
  546.                 .cell_1:
  547.                         ;¦¨¢ ï ï祩ª 
  548.                         mov edx,dword[tim]
  549.                         inc edx
  550.                         sub edx,dword[ecx+8] ;+8 = .tc
  551.                         cmp edx,COL_MEM
  552.                         jle .in_color
  553.                                 mov edx,COL_MEM
  554.                         .in_color:
  555.                         shl edx,2
  556.                         add edx,dword[CellColors]
  557.                         mov edx,dword[edx]
  558.                 .cell_0:
  559.                 stdcall [buf2d_set_pixel], buf_0, edi, esi, edx
  560. ;...
  561.                 inc ebx
  562.                 cmp ebx,eax
  563.                 jle @b
  564.  
  565.         jmp .no_draw
  566.         .zoom2:
  567.  
  568.         @@: ;for(;i<=fristC;i++){
  569.                 mov ecx,ebx
  570.                 shl ecx,2
  571.                 add ecx,dword[memCell]
  572.                 get_cell_offset ecx,dword[ecx]
  573.  
  574.                 xor edx,edx
  575.                 mov dl,byte[zoom] ;edx ¨á¯®«ì§ã¥âáï ¤«ï ¢­¥á¥­¨ï zoom ¢ 4 ¡ ©â­®¥ ç¨á«®
  576.                 mov edi,dword[ecx] ;+0 = .x
  577.                 add edi,dword[Cor_x]
  578.                 imul edi,edx
  579.                 mov esi,dword[ecx+4] ;+4 = .y
  580.                 add esi,dword[Cor_y]
  581.                 imul esi,edx
  582.                 bt word[ecx+12],0 ;+12 = .liv
  583.                 jc .z2_cell_1
  584.                         ;­¥ ¦¨¢ ï ï祩ª 
  585.                         mov edx,dword[CellColors]
  586.                         mov edx,dword[edx]
  587.                         jmp .z2_cell_0
  588.                 .z2_cell_1:
  589.                         ;¦¨¢ ï ï祩ª 
  590.                         mov edx,dword[tim]
  591.                         inc edx
  592.                         sub edx,dword[ecx+8] ;+8 = .tc
  593.                         cmp edx,COL_MEM
  594.                         jle .z2_in_color
  595.                                 mov edx,COL_MEM
  596.                         .z2_in_color:
  597.                         shl edx,2
  598.                         add edx,dword[CellColors]
  599.                         mov edx,dword[edx]
  600.                 .z2_cell_0:
  601.                 xor ecx,ecx
  602.                 mov cl,byte[zoom] ;ecx ¨á¯®«ì§ã¥âáï ¤«ï ¢­¥á¥­¨ï zoom ¢ 4 ¡ ©â­®¥ ç¨á«®
  603.                 ;;;dec ecx
  604.                 stdcall [buf2d_filled_rect_by_size], buf_0, edi, esi, ecx, ecx, edx
  605.                 inc ebx
  606.                 cmp ebx,eax
  607.                 jle @b
  608.  
  609.         .no_draw:
  610.         popad
  611.         ret
  612.  
  613. align 4
  614. pole_next_gen:
  615.         pushad
  616.         ;eax -> firstC
  617.         ;ebx -> i
  618.         ;ecx -> &memCell[i]
  619.         ;edx -> cell[memCell[i]]
  620.  
  621.         mov eax,dword[memCell]
  622.         mov ecx,eax
  623.         mov eax,dword[eax]
  624.         cmp eax,1
  625.         jl .fun_e
  626.         inc dword[tim]
  627.         mov ebx,1
  628.         @@: ;for(i=1;i<=firstC;i++)
  629.                 add ecx,4
  630.                 get_cell_offset edx,dword[ecx]
  631.                 bt word[edx+12],0 ;+12 = .liv
  632.                 jae .if_0_e
  633.                         ; á®åà ­¥­¨¥ ï祩ª¨ (á®á¥¤¥© 2 ¨«¨ 3)
  634.                         cmp byte[edx+13],2 ;+13 = .so
  635.                         je .if_2_e
  636.                         cmp byte[edx+13],3 ;+13 = .so
  637.                         je .if_2_e
  638.                         jmp .change
  639.                 .if_0_e:
  640.                         ; ᮧ¤ ­¨¥ ï祩ª¨ (á®á¥¤¥© 3)
  641.                         cmp byte[edx+13],3 ;+13 = .so
  642.                         jne .if_1_e
  643.                         .change:
  644.                                 or byte[edx+12],2 ;+12 = .liv
  645.                                 jmp .if_2_e
  646.                 .if_1_e:
  647.                         ; 㤠«¥­¨¥ ¯ãá⮩ ï祩ª¨ ¤«ï ®á¢®¡®¦¤¥­¨ï ¯ ¬ïâ¨
  648.                         cmp byte[edx+13],0 ;+13 = .so
  649.                         jne .if_2_e
  650.                         mov edi,dword[edx+8] ;+8 = .tc
  651.                         add edi,5 ; 5 - ¢à¥¬ï á®åà ­¥­¨ï ¯ãá⮩ ï祩ª¨, ¤® ¥ñ 㤠«¥­¨ï
  652.                         cmp edi,dword[tim]
  653.                         jge .if_2_e
  654.                                 mov edi,eax
  655.                                 shl edi,2
  656.                                 add edi,dword[memCell] ;edi -> &memCell[fristC]
  657.                                 mov esi,dword[edi] ;swp=memCell[fristC];
  658.                                 mov edx,dword[ecx] ;edx - 㦥 ­¥ ¨á¯®«ì§ã¥¬, ¯®â®¬ã ¬®¦¥¬ ¯®àâ¨âì
  659.                                 mov dword[edi],edx ;memCell[fristC]=memCell[i];
  660.                                 mov dword[ecx],esi ;memCell[i]=swp;
  661.                                 dec eax
  662.                                 dec ebx
  663.                                 sub ecx,4
  664.                 .if_2_e:
  665.  
  666.                 inc ebx
  667.                 cmp ebx,eax
  668.                 jle @b
  669.         mov ebx,dword[memCell]
  670.         mov dword[ebx],eax ;firstC <- eax
  671.  
  672.         mov dword[b_sort],eax
  673.         stdcall pole_fl_sort, dword[memCell],eax
  674.  
  675.         mov ecx,dword[memCell]
  676.         mov ebx,1
  677.         @@: ;for(i=1;i<=firstC;i++)
  678.                 add ecx,4
  679.                 get_cell_offset edx,dword[ecx]
  680.                 bt word[edx+12],1 ;+12 = .liv
  681.                 jae .no_change
  682.                         xor byte[edx+12],3 ;+12 = .liv
  683.                         mov edi,dword[tim]
  684.                         mov dword[edx+8],edi ;+8 = .tc
  685.                         bt word[edx+12],0 ;+12 = .liv
  686.                         jc .new_cell
  687.                                 push eax
  688.                                 mov edi,dword[edx]
  689.                                 dec edi
  690.                                 mov esi,dword[edx+4]
  691.                                 dec esi
  692.                                 dec dword[osob]
  693.                                 ;¤ «ìè¥ §­ ç¥­¨¥ edx ¯®àâ¨âáï
  694.                                 stdcall pole_cell_find,edi,esi
  695.                                 get_cell_offset edx,eax
  696.                                 dec byte[edx+13] ;+13 = .so
  697.                                 inc esi
  698.                                 stdcall pole_cell_find,edi,esi
  699.                                 get_cell_offset edx,eax
  700.                                 dec byte[edx+13] ;+13 = .so
  701.                                 inc esi
  702.                                 stdcall pole_cell_find,edi,esi
  703.                                 get_cell_offset edx,eax
  704.                                 dec byte[edx+13] ;+13 = .so
  705.                                 inc edi
  706.                                 stdcall pole_cell_find,edi,esi
  707.                                 get_cell_offset edx,eax
  708.                                 dec byte[edx+13] ;+13 = .so
  709.                                 sub esi,2
  710.                                 stdcall pole_cell_find,edi,esi
  711.                                 get_cell_offset edx,eax
  712.                                 dec byte[edx+13] ;+13 = .so
  713.                                 inc edi
  714.                                 stdcall pole_cell_find,edi,esi
  715.                                 get_cell_offset edx,eax
  716.                                 dec byte[edx+13] ;+13 = .so
  717.                                 inc esi
  718.                                 stdcall pole_cell_find,edi,esi
  719.                                 get_cell_offset edx,eax
  720.                                 dec byte[edx+13] ;+13 = .so
  721.                                 inc esi
  722.                                 stdcall pole_cell_find,edi,esi
  723.                                 get_cell_offset edx,eax
  724.                                 dec byte[edx+13] ;+13 = .so
  725.                                 pop eax
  726.                                 jmp .no_change
  727.                         .new_cell: ; ¯®ï¢¨« áì ­®¢ ï ï祩ª 
  728.                                 inc dword[osob]
  729.                                 mov edi,dword[edx]
  730.                                 dec edi
  731.                                 mov esi,dword[edx+4]
  732.                                 dec esi
  733.                                 stdcall pole_cell_creat,edi,esi,0
  734.                                 inc esi
  735.                                 stdcall pole_cell_creat,edi,esi,0
  736.                                 inc esi
  737.                                 stdcall pole_cell_creat,edi,esi,0
  738.                                 inc edi
  739.                                 stdcall pole_cell_creat,edi,esi,0
  740.                                 sub esi,2
  741.                                 stdcall pole_cell_creat,edi,esi,0
  742.                                 inc edi
  743.                                 stdcall pole_cell_creat,edi,esi,0
  744.                                 inc esi
  745.                                 stdcall pole_cell_creat,edi,esi,0
  746.                                 inc esi
  747.                                 stdcall pole_cell_creat,edi,esi,0
  748.                 .no_change:
  749.                 inc ebx
  750.                 cmp ebx,eax
  751.                 jle @b
  752.         .fun_e:
  753.         popad
  754.         ret
  755.  
  756. ;‘®àâ¨à®¢ª  ¢¥ªâ®à  a[1..n] ¬¥â®¤®¬ ”«®©¤ 
  757. align 4
  758. proc pole_fl_sort, a:dword, n:dword
  759.         pushad
  760.         mov ecx,dword[a]
  761.         ;”®à¬¨à®¢ âì ¨á室­®¥ ç áâ¨ç­® 㯮à冷祭­®¥ ¤¥à¥¢®
  762.         mov eax,dword[n]
  763.         shr eax,1
  764.         @@: ;for(i=n>>1; i>=2; i--)
  765.                 stdcall pole_fl_surface, ecx,eax,[n] ;(a,i,n)
  766.                 dec eax
  767.                 cmp eax,2
  768.                 jge @b
  769.         ;‚믮«­¨âì ¯à®æ¥¤ãà㠢ᯫëâ¨ï ”«®©¤  ¤«ï ª ¦¤®£® ¯®¤¤¥à¥¢ 
  770.         mov eax,dword[n]
  771.         @@: ;for(i=n; i>=2; i--){
  772.                 stdcall pole_fl_surface, ecx,1,eax ;(a,1,i)
  773.                 ;®¬¥áâ¨âì ­ ©¤¥­­ë© ¬ ªá¨¬ «ì­ë© í«¥¬¥­â ¢ ª®­¥æ ᯨ᪠
  774.                 mov edi,eax
  775.                 shl edi,2
  776.                 add edi,ecx ;edi -> &a[i]
  777.                 mov esi,dword[edi] ;w=a[i];
  778.                 mov edx,dword[ecx+4]
  779.                 mov dword[edi],edx ;a[i]=a[1];
  780.                 mov dword[ecx+4],esi ;a[1]=w;
  781.  
  782.                 dec eax
  783.                 cmp eax,2
  784.                 jge @b
  785.         popad
  786.         ret
  787. endp
  788.  
  789. ;à®æ¥¤ãà  ¢á¯«ëâ¨ï ”«®©¤  ¯® ¤¥à¥¢ã a[1..k]
  790. align 4
  791. proc pole_fl_surface, a:dword, i:dword, k:dword
  792. locals
  793.         copy dd ?
  794. endl
  795.         pushad
  796.         ;edx -> ...
  797.         ;edi -> m
  798.         ;esi -> j
  799.         mov eax,dword[a]
  800.         mov ebx,dword[i]
  801.         mov ecx,dword[k]
  802.  
  803.         mov edx,ebx
  804.         shl edx,2
  805.         add edx,eax
  806.         mov edx,dword[edx]
  807.         mov dword[copy],edx ;copy=a[i];
  808.         mov edi,ebx
  809.         shl edi,1 ;m=i<<1;
  810.         .cycle_b: ;while (m<=k) {
  811.                 cmp edi,ecx
  812.                 jg .cycle_e
  813.                 jne @f ;if (m==k) j=m;
  814.                         mov esi,edi
  815.                         jmp .else_e
  816.                 @@: ;else if (pole_compare_cells_bm(a[m],a[m+1])) j=m;
  817.                 mov edx,edi
  818.                 shl edx,2
  819.                 add edx,eax
  820.                 stdcall pole_compare_cells_bm, dword[edx],dword[edx+4]
  821.                 cmp dl,0
  822.                 je @f
  823.                         mov esi,edi
  824.                         jmp .else_e
  825.                 @@: ;else j=m+1;
  826.                         mov esi,edi
  827.                         inc esi
  828.                 .else_e:
  829.  
  830.                 ;if (pole_compare_cells_bm(a[j],copy)) {
  831.                 mov edx,esi
  832.                 shl edx,2
  833.                 add edx,eax
  834.                 stdcall pole_compare_cells_bm, dword[edx],dword[copy]
  835.                 cmp dl,0
  836.                 je .cycle_e ;} else break; //¢ë室 ¨§ 横« 
  837.  
  838.                 mov edx,esi
  839.                 shl edx,2
  840.                 add edx,eax
  841.                 push dword[edx] ;push a[j];
  842.                 mov edx,ebx
  843.                 shl edx,2
  844.                 add edx,eax
  845.                 pop dword[edx] ;a[i]=a[j];
  846.                 mov ebx,esi ;i=j;
  847.                 mov edi,ebx
  848.                 shl edi,1 ;m=i<<1;
  849.  
  850.                 jmp .cycle_b
  851.         .cycle_e:
  852.  
  853.         ;§­ ç¥­¨ï ¬­®£¨å ॣ¨áâ஢ 㦥 ­¥ ¢ ¦­ë â. ª. ª®­¥æ ä㭪樨
  854.         shl ebx,2
  855.         add eax,ebx
  856.         mov edx,dword[copy]
  857.         mov dword[eax],edx ;a[i]=copy;
  858.  
  859.         popad
  860.         ret
  861. endp
  862. ;--------------------------------------
  863.  
  864.  
  865. align 4
  866. start:
  867.         load_libraries l_libs_start,l_libs_end
  868.         ;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ­ è  «¨¡ 
  869.         mov     ebp,lib_7
  870.         cmp     dword [ebp+ll_struc_size-4],0
  871.         jz      @f
  872.                 mcall -1 ;exit not correct
  873.         @@:
  874.         mcall 48,3,sc,sizeof.system_colors
  875.         mcall 40,0x27
  876.         stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
  877.  
  878.         stdcall [buf2d_create], buf_0 ;ᮧ¤ ­¨¥ ¡ãä¥à 
  879.  
  880.         stdcall mem.Alloc,MAX_CELL*sizeof.Cell
  881.         mov [cell],eax
  882.         stdcall mem.Alloc,MAX_CELL*4
  883.         mov [memCell],eax
  884.         stdcall mem.Alloc,(COL_MEM+1)*4
  885.         mov [CellColors],eax
  886.         load_image_file fn_toolbar, image_data_toolbar,IMAGE_TOOLBAR_SIZE
  887.  
  888.         ;­ áâனª  梥⮢ ï祥ª
  889.         stdcall pole_init_colors, 0xffffd0,0xff0000,0x0000ff
  890.         call pole_clear
  891.         call pole_paint ;à¨á®¢ ­¨¥ ¯®«ï ¢ ¡ãä¥à¥ (­¥ ­  íªà ­¥)
  892.  
  893.         ;xor eax,eax
  894.         ;mov edi,txt_zoom.zi
  895.         ;mov al,byte[zoom]
  896.         ;call tl_convert_to_str
  897.  
  898.         mcall 26,9
  899.         mov [last_time],eax
  900.  
  901. align 4
  902. red_win:
  903.         call draw_window
  904.  
  905. align 4
  906. still:
  907.         mcall 26,9
  908.         mov ebx,[last_time]
  909.         add ebx,10 ;§ ¤¥à¦ª 
  910.         cmp ebx,eax
  911.         jge @f
  912.                 mov ebx,eax
  913.         @@:
  914.         sub ebx,eax
  915.         ;cmp ebx,10 ;§ ¤¥à¦ª 
  916.         ;ja timer_funct
  917.         ;test ebx,ebx
  918.         ;jz timer_funct
  919.         mcall 23
  920.         cmp eax,0
  921.         je timer_funct
  922.  
  923.         cmp al,1
  924.         jz red_win
  925.         cmp al,2
  926.         jz key
  927.         cmp al,3
  928.         jz button
  929.  
  930.         jmp still
  931.  
  932. align 4
  933. timer_funct:
  934.         pushad
  935.         mcall 26,9
  936.         mov [last_time],eax
  937.  
  938.         cmp byte[tim_ch],0
  939.         je @f
  940.                 ;call but_next_gen
  941.                 cld
  942.                 mov ecx,dword[poc_stop]
  943.                 cmp ecx,1
  944.                 jg .clear
  945.                         mov ecx,1 ;¨á¯à ¢«¥­¨¥ ecx ­  á«ãç © ç¨á¥« ¬¥­ìè¨å 1
  946.                         jmp .cycle
  947.                 .clear: ;ç¨á⨬ ¯®«¥ ¥á«¨ ¥áâì ¯à®áç¥â ­  ­¥áª®«ìª® ¯®ª®«¥­¨© §  1 â ªâ â ©¬¥à 
  948.                         stdcall [buf2d_clear], buf_0, [buf_0.color]
  949.                 .cycle:
  950.                         call pole_next_gen
  951.                         loop .cycle
  952.                 call pole_paint
  953.                 stdcall [buf2d_draw], buf_0
  954.                 call draw_pok
  955.         @@:
  956.         popad
  957.         jmp still
  958.  
  959. align 4
  960. draw_window:
  961. pushad
  962.         mcall 12,1
  963.         xor eax,eax
  964.         mov ebx,(20 shl 16)+485
  965.         mov ecx,(20 shl 16)+415
  966.         mov edx,[sc.work]
  967.         or  edx,(3 shl 24)+0x10000000+0x20000000
  968.         mov edi,hed
  969.         int 0x40
  970.  
  971.         mov eax,8
  972.         mov ebx,(5 shl 16)+20
  973.         mov ecx,(5 shl 16)+20
  974.         mov edx,3
  975.         mov esi,[sc.work_button]
  976.         int 0x40
  977.  
  978.         mov ebx,(30 shl 16)+20
  979.         mov ecx,(5 shl 16)+20
  980.         mov edx,4
  981.         int 0x40
  982.  
  983.         mov ebx,(55 shl 16)+20
  984.         mov ecx,(5 shl 16)+20
  985.         mov edx,5
  986.         int 0x40
  987.  
  988.         mov ebx,(85 shl 16)+20
  989.         mov ecx,(5 shl 16)+20
  990.         mov edx,6
  991.         int 0x40
  992.  
  993.         mov ebx,(110 shl 16)+20
  994.         mov ecx,(5 shl 16)+20
  995.         mov edx,7
  996.         int 0x40
  997.  
  998.         mov ebx,(135 shl 16)+20
  999.         mov ecx,(5 shl 16)+20
  1000.         mov edx,8
  1001.         int 0x40
  1002.  
  1003.         mov ebx,(165 shl 16)+20
  1004.         mov ecx,(5 shl 16)+20
  1005.         mov edx,9
  1006.         int 0x40
  1007.  
  1008.         mov ebx,(190 shl 16)+20
  1009.         mov ecx,(5 shl 16)+20
  1010.         mov edx,10
  1011.         int 0x40
  1012.  
  1013.         mov ebx,(220 shl 16)+20
  1014.         mov ecx,(5 shl 16)+20
  1015.         mov edx,11
  1016.         int 0x40
  1017.  
  1018.         mov ebx,(245 shl 16)+20
  1019.         mov ecx,(5 shl 16)+20
  1020.         mov edx,12
  1021.         int 0x40
  1022.  
  1023.         mov ebx,(270 shl 16)+20
  1024.         mov ecx,(5 shl 16)+20
  1025.         mov edx,13
  1026.         int 0x40
  1027.  
  1028.         mov ebx,(295 shl 16)+20
  1029.         mov ecx,(5 shl 16)+20
  1030.         mov edx,14
  1031.         int 0x40
  1032.  
  1033.         mov eax,7
  1034.         mov ebx,[image_data_toolbar]
  1035.         mov ecx,(16 shl 16)+16
  1036.         mov edx,(32 shl 16)+7
  1037.         int 0x40
  1038.  
  1039.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  1040.         mov edx,(87 shl 16)+7 ;run once
  1041.         int 0x40
  1042.  
  1043.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  1044.         mov edx,(112 shl 16)+7 ;run auto
  1045.         int 0x40
  1046.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  1047.         mov edx,(137 shl 16)+7 ;stop
  1048.         int 0x40
  1049.  
  1050.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  1051.         mov edx,(167 shl 16)+7 ;-
  1052.         int 0x40
  1053.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  1054.         mov edx,(192 shl 16)+7 ;+
  1055.         int 0x40
  1056.  
  1057.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  1058.         mov edx,(222 shl 16)+7 ;move up
  1059.         int 0x40
  1060.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  1061.         mov edx,(247 shl 16)+7 ;move doun
  1062.         int 0x40
  1063.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  1064.         mov edx,(272 shl 16)+7 ;move left
  1065.         int 0x40
  1066.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  1067.         mov edx,(297 shl 16)+7 ;move up
  1068.         int 0x40
  1069.  
  1070.         call draw_pok
  1071.  
  1072.         stdcall [buf2d_draw], buf_0
  1073.  
  1074.         mcall 12,2
  1075. popad
  1076.         ret
  1077.  
  1078. align 4
  1079. draw_pok:
  1080.         mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
  1081.         mov ebx,325*65536+5
  1082.         mov ecx,[sc.work_text]
  1083.         or  ecx,0x80000000 ;or (1 shl 30)
  1084.         mov edx,txt_zoom
  1085.         ;mov edi,[sc.work]
  1086.         int 0x40
  1087.         add bx,9
  1088.         mov edx,txt_gen
  1089.         int 0x40
  1090.         add bx,9
  1091.         mov edx,txt_osob
  1092.         int 0x40
  1093.  
  1094.         mov eax,47
  1095.         xor ecx,ecx
  1096.         mov cl,byte[zoom]
  1097.         mov ebx,(2 shl 16)
  1098.         mov edx,(325+6*9)*65536+5
  1099.         mov esi,[sc.work_button_text]
  1100.         or  esi,(1 shl 30)
  1101.         mov edi,[sc.work_button]
  1102.         int 0x40 ;¬ áèâ ¡
  1103.         mov ebx,(5 shl 16)
  1104.         mov ecx,[tim]
  1105.         add edx,(6*2)*65536+9
  1106.         int 0x40 ;¢à¥¬ï
  1107.         mov ebx,(5 shl 16)
  1108.         mov ecx,[osob]
  1109.         add edx,(6*0)*65536+9
  1110.         int 0x40 ;¯®¯ã«ïæ¨ï
  1111.         ret
  1112.  
  1113. align 4
  1114. key:
  1115.         mcall 2
  1116.         jmp still
  1117.  
  1118.  
  1119. align 4
  1120. button:
  1121.         mcall 17
  1122.         cmp ah,3
  1123.         jne @f
  1124.                 call but_new_file
  1125.         @@:
  1126.         cmp ah,4
  1127.         jne @f
  1128.                 call but_open_file
  1129.         @@:
  1130.         cmp ah,5
  1131.         jne @f
  1132.                 call but_save_file
  1133.         @@:
  1134.         cmp ah,6
  1135.         jne @f
  1136.                 call but_next_gen
  1137.         @@:
  1138.         cmp ah,7
  1139.         jne @f
  1140.                 call but_run
  1141.         @@:
  1142.         cmp ah,8
  1143.         jne @f
  1144.                 call but_stop
  1145.         @@:
  1146.         cmp ah,9
  1147.         jne @f
  1148.                 call but_zoom_p
  1149.         @@:
  1150.         cmp ah,10
  1151.         jne @f
  1152.                 call but_zoom_m
  1153.         @@:
  1154.         cmp ah,11
  1155.         jne @f
  1156.                 call but_pole_up
  1157.         @@:
  1158.         cmp ah,12
  1159.         jne @f
  1160.                 call but_pole_dn
  1161.         @@:
  1162.         cmp ah,13
  1163.         jne @f
  1164.                 call but_pole_left
  1165.         @@:
  1166.         cmp ah,14
  1167.         jne @f
  1168.                 call but_pole_right
  1169.         @@:
  1170.         cmp ah,1
  1171.         jne still
  1172. .exit:
  1173.         stdcall [buf2d_delete],buf_0
  1174.         stdcall mem.Free,[cell]
  1175.         stdcall mem.Free,[memCell]
  1176.         stdcall mem.Free,[CellColors]
  1177.         stdcall mem.Free,[image_data_toolbar]
  1178.         mcall -1
  1179.  
  1180.  
  1181. align 4
  1182. but_new_file:
  1183.         ret
  1184.  
  1185. align 4
  1186. open_file_lif:
  1187.         rb 4096 ;®¡« áâì ¤«ï ®âªàëâ¨ï ä ©«®¢
  1188. .end:
  1189.  
  1190. align 4
  1191. but_open_file:
  1192.         pushad
  1193.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  1194.         mov [OpenDialog_data.type],0
  1195.         stdcall [OpenDialog_Start],OpenDialog_data
  1196.         cmp [OpenDialog_data.status],2
  1197.         je .end_open_file
  1198.         ;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
  1199.  
  1200.         mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
  1201.         mov [run_file_70.Function], 0
  1202.         mov [run_file_70.Position], 0
  1203.         mov [run_file_70.Flags], 0
  1204.         mov dword[run_file_70.Count], open_file_lif.end-open_file_lif
  1205.         m2m [run_file_70.Buffer], open_file_lif
  1206.         mov byte[run_file_70+20], 0
  1207.         mov dword[run_file_70.FileName], openfile_path
  1208.         mov ebx,run_file_70
  1209.         int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
  1210.         cmp ebx,0xffffffff
  1211.         je .end_open_file
  1212.  
  1213.         add ebx,open_file_lif
  1214.         mov byte[ebx],0 ;­  á«ãç © ¥á«¨ à ­¥¥ ¡ë« ®âªàëâ ä ©« ¡®«ì襣® à §¬¥à  ç¨á⨬ ª®­¥æ ¡ãä¥à  á ä ©«®¬
  1215.         mcall 71,1,openfile_path
  1216.  
  1217.         call pole_clear
  1218.         mov eax,dword[buf_0.w]
  1219.         shr eax,1
  1220.         xor ecx,ecx
  1221.         mov cl,byte[zoom]
  1222.         cmp cx,2
  1223.         jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
  1224.                 xor edx,edx
  1225.                 div ecx
  1226.         @@:
  1227.         add dword[Cor_x],eax
  1228.         mov eax,dword[buf_0.h]
  1229.         shr eax,1
  1230.         cmp cx,2
  1231.         jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
  1232.                 xor edx,edx
  1233.                 div ecx
  1234.         @@:
  1235.         add dword[Cor_y],eax
  1236.  
  1237.         ;eax - first x position
  1238.         ;ebx - x position
  1239.         ;ecx - y position
  1240.         mov edi,open_file_lif
  1241.         xor ebx,ebx
  1242.         xor ecx,ecx
  1243.         mov eax,ebx
  1244.         @@:
  1245.                 cmp byte[edi],'*'
  1246.                 jne .no_cell
  1247.                         stdcall pole_cell_creat, ebx,ecx,1
  1248.                         inc ebx
  1249.                 .no_cell:
  1250.                 cmp byte[edi],'.'
  1251.                 jne .cell_move
  1252.                         inc ebx
  1253.                 .cell_move:
  1254.                 cmp byte[edi],13
  1255.                 jne .cell_nl
  1256.                         mov ebx,eax
  1257.                         inc ecx
  1258.                 .cell_nl:
  1259.                 cmp word[edi],'#P' ;ᬥ­  ¯®§¨æ¨¨
  1260.                 jne .pos
  1261.                         inc edi ;¯à®¯ã᪠'#'
  1262.                         .space:
  1263.                                 inc edi ;¯à®¯ã᪠'P' ¨ ' '
  1264.                                 cmp byte[edi],' '
  1265.                                 je .space
  1266.                         stdcall conv_str_to_int,edi
  1267.                         mov ebx,eax
  1268.                         cmp byte[edi],'-'
  1269.                         jne .digit
  1270.                                 inc edi
  1271.                         .digit:
  1272.                                 cmp byte[edi],'0'
  1273.                                 jl .digit_no
  1274.                                 cmp byte[edi],'9'
  1275.                                 jg .digit_no
  1276.                                 inc edi
  1277.                                 jmp .digit
  1278.                         .digit_no:
  1279.                         ;.space_1:
  1280.                                 inc edi ;¯à®¯ã᪠'P' ¨ ' '
  1281.                                 cmp byte[edi],' '
  1282.                                 je .digit_no ;.space_1
  1283.                         stdcall conv_str_to_int,edi
  1284.                         mov ecx,eax
  1285.                         mov eax,ebx ;¢®ááâ ­®¢«¥­¨¥ «¥¢®£® ®âáâ㯠 ¢ eax
  1286.                 .pos:
  1287.                 inc edi
  1288.                 cmp byte[edi],0
  1289.                 jne @b
  1290.         ;---
  1291.         stdcall [buf2d_clear], buf_0, [buf_0.color] ;ç¨á⨬ ¡ãä¥à
  1292.         call pole_paint ;à¨á㥬 ¯®«¥ (­  á«ãç © ¥á«¨ ¥áâì á¥âª  ¨«¨ ⥪áâ®¢ë¥ ¯®¤¯¨á¨)
  1293.         stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
  1294.         .end_open_file:
  1295.         popad
  1296.         ret
  1297.  
  1298. align 4
  1299. but_save_file:
  1300.         ret
  1301.  
  1302. align 4
  1303. but_next_gen:
  1304.         call pole_next_gen
  1305.         call pole_paint
  1306.         stdcall [buf2d_draw], buf_0
  1307.         pushad
  1308.                 call draw_pok
  1309.         popad
  1310.         ret
  1311.  
  1312. align 4
  1313. but_run:
  1314.         mov byte[tim_ch],1
  1315.         ret
  1316.  
  1317. align 4
  1318. but_stop:
  1319.         mov byte[tim_ch],0
  1320.         ;cld
  1321.         ;mov ecx,100
  1322.         ;@@:
  1323.         ;       call pole_next_gen
  1324.         ;loop @b
  1325.         ;stdcall [buf2d_clear], buf_0, [buf_0.color]
  1326.         ;call pole_paint
  1327.         ;stdcall [buf2d_draw], buf_0
  1328.         ret
  1329.  
  1330. align 4
  1331. but_zoom_p:
  1332.         cmp byte[zoom],16
  1333.         jge @f
  1334.                 pushad
  1335.                 ;¢ëç¨á«¥­¨¥ ᤢ¨£®¢ ¤«ï ¯®«ï, ª®â®àë¥ ®¡¥á¯¥ç â 業â஢ªã ¯®«ï ¯à¨ 㢥«¨ç¥­¨¨ ¬ áèâ ¡ 
  1336.                 xor ecx,ecx
  1337.                 mov cl,byte[zoom]
  1338.                 xor edx,edx
  1339.                 mov eax,dword[buf_0.w]
  1340.                 shr eax,1 ;¢ eax ¯®«®¢¨­  è¨à¨­ë ¯®«ï
  1341.                 mov ebx,eax ;¤¥« ¥¬ १¥à¢­ãî ª®¯¨î eax
  1342.                 div ecx ;¤¥«¨¬ eax ­  ⥪ã騩 ¬ áèâ ¡
  1343.                 xchg eax,ebx
  1344.                 xor edx,edx
  1345.                 inc ecx
  1346.                 div ecx ;¤¥«¨¬ eax ­  ­®¢ë© ¬ áèâ ¡
  1347.                 sub ebx,eax ;¢ëç¨á«ï¥âáï ᤢ¨£ ¯®«ï ª®â®àë© ®¡¥á¯¥ç¨â 業â஢ªã ¯®«ï
  1348.                 sub dword[Cor_x],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ x
  1349.                 xor ecx,ecx
  1350.                 mov cl,byte[zoom]
  1351.                 xor edx,edx
  1352.                 mov eax,dword[buf_0.h]
  1353.                 shr eax,1
  1354.                 mov ebx,eax
  1355.                 div ecx
  1356.                 xchg eax,ebx
  1357.                 xor edx,edx
  1358.                 inc ecx
  1359.                 div ecx
  1360.                 sub ebx,eax
  1361.                 sub dword[Cor_y],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ y
  1362.  
  1363.                 inc byte[zoom]
  1364.                 ;xor eax,eax
  1365.                 ;mov edi,txt_zoom.zi
  1366.                 ;mov al,byte[zoom]
  1367.                 ;call tl_convert_to_str
  1368.                 call draw_pok
  1369.                 popad
  1370.  
  1371.                 cmp dword[poc_stop],1
  1372.                 jle .buf_clear
  1373.                 cmp byte[tim_ch],0
  1374.                 jne @f
  1375.                         .buf_clear:
  1376.                         stdcall [buf2d_clear], buf_0, [buf_0.color]
  1377.                         call pole_paint
  1378.                         stdcall [buf2d_draw], buf_0
  1379.         @@:
  1380.         ret
  1381.  
  1382. align 4
  1383. but_zoom_m:
  1384.         cmp byte[zoom],1
  1385.         jle @f
  1386.                 pushad
  1387.                 ;¢ëç¨á«¥­¨¥ ᤢ¨£®¢ ¤«ï ¯®«ï, ª®â®àë¥ ®¡¥á¯¥ç â 業â஢ªã ¯®«ï ¯à¨ 㬥­ì襭¨¨ ¬ áèâ ¡ 
  1388.                 xor ecx,ecx
  1389.                 mov cl,byte[zoom]
  1390.                 xor edx,edx
  1391.                 mov eax,dword[buf_0.w]
  1392.                 shr eax,1 ;¢ eax ¯®«®¢¨­  è¨à¨­ë ¯®«ï
  1393.                 mov ebx,eax ;¤¥« ¥¬ १¥à¢­ãî ª®¯¨î eax
  1394.                 div ecx ;¤¥«¨¬ eax ­  ⥪ã騩 ¬ áèâ ¡
  1395.                 xchg eax,ebx
  1396.                 xor edx,edx
  1397.                 dec ecx
  1398.                 div ecx ;¤¥«¨¬ eax ­  ­®¢ë© ¬ áèâ ¡
  1399.                 sub ebx,eax ;¢ëç¨á«ï¥âáï ᤢ¨£ ¯®«ï ª®â®àë© ®¡¥á¯¥ç¨â 業â஢ªã ¯®«ï
  1400.                 sub dword[Cor_x],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ x
  1401.                 xor ecx,ecx
  1402.                 mov cl,byte[zoom]
  1403.                 xor edx,edx
  1404.                 mov eax,dword[buf_0.h]
  1405.                 shr eax,1
  1406.                 mov ebx,eax
  1407.                 div ecx
  1408.                 xchg eax,ebx
  1409.                 xor edx,edx
  1410.                 dec ecx
  1411.                 div ecx
  1412.                 sub ebx,eax
  1413.                 sub dword[Cor_y],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ y
  1414.  
  1415.                 dec byte[zoom]
  1416.                 ;xor eax,eax
  1417.                 ;mov edi,txt_zoom.zi
  1418.                 ;mov al,byte[zoom]
  1419.                 ;call tl_convert_to_str
  1420.                 call draw_pok
  1421.                 popad
  1422.  
  1423.                 cmp dword[poc_stop],1
  1424.                 jle .buf_clear
  1425.                 cmp byte[tim_ch],0
  1426.                 jne @f
  1427.                         .buf_clear:
  1428.                         stdcall [buf2d_clear], buf_0, [buf_0.color]
  1429.                         call pole_paint
  1430.                         stdcall [buf2d_draw], buf_0
  1431.         @@:
  1432.         ret
  1433.  
  1434. align 4
  1435. but_pole_up:
  1436.         push eax ecx edx
  1437.         mov eax,dword[buf_0.h]
  1438.         shr eax,2
  1439.         xor ecx,ecx
  1440.         mov cl,byte[zoom]
  1441.         cmp cx,2
  1442.         jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
  1443.                 xor edx,edx
  1444.                 div ecx
  1445.         @@:
  1446.         add dword[Cor_y],eax
  1447.         pop edx ecx eax
  1448.         stdcall [buf2d_clear], buf_0, [buf_0.color]
  1449.         call pole_paint
  1450.         stdcall [buf2d_draw], buf_0
  1451.         ret
  1452.  
  1453. align 4
  1454. but_pole_dn:
  1455.         push eax ecx edx
  1456.         mov eax,dword[buf_0.h]
  1457.         shr eax,2
  1458.         xor ecx,ecx
  1459.         mov cl,byte[zoom]
  1460.         cmp cx,2
  1461.         jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
  1462.                 xor edx,edx
  1463.                 div ecx
  1464.         @@:
  1465.         sub dword[Cor_y],eax
  1466.         pop edx ecx eax
  1467.         stdcall [buf2d_clear], buf_0, [buf_0.color]
  1468.         call pole_paint
  1469.         stdcall [buf2d_draw], buf_0
  1470.         ret
  1471.  
  1472. align 4
  1473. but_pole_left:
  1474.         push eax ecx edx
  1475.         mov eax,dword[buf_0.w]
  1476.         shr eax,2
  1477.         xor ecx,ecx
  1478.         mov cl,byte[zoom]
  1479.         cmp cx,2
  1480.         jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
  1481.                 xor edx,edx
  1482.                 div ecx
  1483.         @@:
  1484.         add dword[Cor_x],eax
  1485.         pop edx ecx eax
  1486.         stdcall [buf2d_clear], buf_0, [buf_0.color]
  1487.         call pole_paint
  1488.         stdcall [buf2d_draw], buf_0
  1489.         ret
  1490.  
  1491. align 4
  1492. but_pole_right:
  1493.         push eax ecx edx
  1494.         mov eax,dword[buf_0.w]
  1495.         shr eax,2
  1496.         xor ecx,ecx
  1497.         mov cl,byte[zoom]
  1498.         cmp cx,2
  1499.         jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
  1500.                 xor edx,edx
  1501.                 div ecx
  1502.         @@:
  1503.         sub dword[Cor_x],eax
  1504.         pop edx ecx eax
  1505.         stdcall [buf2d_clear], buf_0, [buf_0.color]
  1506.         call pole_paint
  1507.         stdcall [buf2d_draw], buf_0
  1508.         ret
  1509.  
  1510. ;align 4
  1511. ;but_bru_clear:
  1512. ;        ret
  1513.  
  1514. ;input:
  1515. ; buf - 㪠§ â¥«ì ­  áâபã, ç¨á«® ¤®«¦­® ¡ëâì ¢ 10 ¨«¨ 16 à¨ç­®¬ ¢¨¤¥
  1516. ;output:
  1517. ; eax - ç¨á«®
  1518. align 4
  1519. proc conv_str_to_int, buf:dword
  1520.         xor eax,eax
  1521.         push ebx ecx esi
  1522.         xor ebx,ebx
  1523.         mov esi,[buf]
  1524.         ;®¯à¥¤¥«¥­¨¥ ®âà¨æ â¥«ì­ëå ç¨á¥«
  1525.         xor ecx,ecx
  1526.         inc ecx
  1527.         cmp byte[esi],'-'
  1528.         jne @f
  1529.                 dec ecx
  1530.                 inc esi
  1531.         @@:
  1532.  
  1533.         cmp word[esi],'0x'
  1534.         je .load_digit_16
  1535.  
  1536.         .load_digit_10: ;áç¨â뢠­¨¥ 10-â¨ç­ëå æ¨äà
  1537.                 mov bl,byte[esi]
  1538.                 cmp bl,'0'
  1539.                 jl @f
  1540.                 cmp bl,'9'
  1541.                 jg @f
  1542.                         sub bl,'0'
  1543.                         imul eax,10
  1544.                         add eax,ebx
  1545.                         inc esi
  1546.                         jmp .load_digit_10
  1547.         jmp @f
  1548.  
  1549.         .load_digit_16: ;áç¨â뢠­¨¥ 16-à¨ç­ëå æ¨äà
  1550.                 add esi,2
  1551.         .cycle_16:
  1552.                 mov bl,byte[esi]
  1553.                 cmp bl,'0'
  1554.                 jl @f
  1555.                 cmp bl,'f'
  1556.                 jg @f
  1557.                 cmp bl,'9'
  1558.                 jle .us1
  1559.                         cmp bl,'A'
  1560.                         jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'9' ¨ <'A'
  1561.                 .us1: ;á®áâ ¢­®¥ ãá«®¢¨¥
  1562.                 cmp bl,'F'
  1563.                 jle .us2
  1564.                         cmp bl,'a'
  1565.                         jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'F' ¨ <'a'
  1566.                         sub bl,32 ;¯¥à¥¢®¤¨¬ ᨬ¢®«ë ¢ ¢¥àå­¨© ॣ¨áâà, ¤«ï ã¯à®é¥­¨ï ¨å ¯®á«¥¤ã饩 ®¡à ¡®âª¨
  1567.                 .us2: ;á®áâ ¢­®¥ ãá«®¢¨¥
  1568.                         sub bl,'0'
  1569.                         cmp bl,9
  1570.                         jle .cor1
  1571.                                 sub bl,7 ;convert 'A' to '10'
  1572.                         .cor1:
  1573.                         shl eax,4
  1574.                         add eax,ebx
  1575.                         inc esi
  1576.                         jmp .cycle_16
  1577.         @@:
  1578.         cmp ecx,0 ;¥á«¨ ç¨á«® ®âà¨æ â¥«ì­®¥
  1579.         jne @f
  1580.                 sub ecx,eax
  1581.                 mov eax,ecx
  1582.         @@:
  1583.         pop esi ecx ebx
  1584.         ret
  1585. endp
  1586.  
  1587. ;¤ ­­ë¥ ¤«ï ¤¨ «®£  ®âªàëâ¨ï ä ©«®¢
  1588. align 4
  1589. OpenDialog_data:
  1590. .type                   dd 0 ;0 - ®âªàëâì, 1 - á®åà ­¨âì, 2 - ¢ë¡à âì ¤â४â®à¨î
  1591. .procinfo               dd procinfo     ;+4
  1592. .com_area_name          dd communication_area_name      ;+8
  1593. .com_area               dd 0    ;+12
  1594. .opendir_path           dd plugin_path  ;+16
  1595. .dir_default_path       dd default_dir ;+20
  1596. .start_path             dd file_name ;+24 ¯ãâì ª ¤¨ «®£ã ®âªàëâ¨ï ä ©«®¢
  1597. .draw_window            dd draw_window  ;+28
  1598. .status                 dd 0    ;+32
  1599. .openfile_path          dd openfile_path        ;+36 ¯ãâì ª ®âªà뢠¥¬®¬ã ä ©«ã
  1600. .filename_area          dd filename_area        ;+40
  1601. .filter_area            dd Filter
  1602. .x:
  1603. .x_size                 dw 420 ;+48 ; Window X size
  1604. .x_start                dw 10 ;+50 ; Window X position
  1605. .y:
  1606. .y_size                 dw 320 ;+52 ; Window y size
  1607. .y_start                dw 10 ;+54 ; Window Y position
  1608.  
  1609. default_dir db '/rd/1',0
  1610.  
  1611. communication_area_name:
  1612.         db 'FFFFFFFF_open_dialog',0
  1613. open_dialog_name:
  1614.         db 'opendial',0
  1615. communication_area_default_path:
  1616.         db '/rd/1/File managers/',0
  1617.  
  1618. Filter:
  1619. dd Filter.end - Filter ;.1
  1620. .1:
  1621. db 'LIF',0
  1622. db 'RLE',0
  1623. .end:
  1624. db 0
  1625.  
  1626.  
  1627.  
  1628. head_f_i:
  1629. head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0
  1630.  
  1631. system_dir_0 db '/sys/lib/'
  1632. lib_name_0 db 'proc_lib.obj',0
  1633. err_message_found_lib_0 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,0
  1634. err_message_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,0
  1635.  
  1636. system_dir_1 db '/sys/lib/'
  1637. lib_name_1 db 'libimg.obj',0
  1638. err_message_found_lib_1 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,0
  1639. err_message_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,0
  1640.  
  1641. system_dir_7 db '/sys/lib/'
  1642. lib_name_7 db 'buf2d.obj',0
  1643. err_msg_found_lib_7 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,0
  1644. err_msg_import_7 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,0
  1645.  
  1646. l_libs_start:
  1647.         lib0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\
  1648.                 err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i
  1649.         lib1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\
  1650.                 err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i
  1651.         lib_7 l_libs lib_name_7, sys_path, library_path, system_dir_7,\
  1652.                 err_msg_found_lib_7,head_f_l,import_buf2d,err_msg_import_7,head_f_i
  1653. l_libs_end:
  1654.  
  1655. align 4
  1656. import_libimg:
  1657.         dd alib_init1
  1658.         img_is_img  dd aimg_is_img
  1659.         img_info    dd aimg_info
  1660.         img_from_file dd aimg_from_file
  1661.         img_to_file dd aimg_to_file
  1662.         img_from_rgb dd aimg_from_rgb
  1663.         img_to_rgb  dd aimg_to_rgb
  1664.         img_to_rgb2 dd aimg_to_rgb2
  1665.         img_decode  dd aimg_decode
  1666.         img_encode  dd aimg_encode
  1667.         img_create  dd aimg_create
  1668.         img_destroy dd aimg_destroy
  1669.         img_destroy_layer dd aimg_destroy_layer
  1670.         img_count   dd aimg_count
  1671.         img_lock_bits dd aimg_lock_bits
  1672.         img_unlock_bits dd aimg_unlock_bits
  1673.         img_flip    dd aimg_flip
  1674.         img_flip_layer dd aimg_flip_layer
  1675.         img_rotate  dd aimg_rotate
  1676.         img_rotate_layer dd aimg_rotate_layer
  1677.         img_draw    dd aimg_draw
  1678.  
  1679.         dd 0,0
  1680.         alib_init1   db 'lib_init',0
  1681.         aimg_is_img  db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
  1682.         aimg_info    db 'img_info',0
  1683.         aimg_from_file db 'img_from_file',0
  1684.         aimg_to_file db 'img_to_file',0
  1685.         aimg_from_rgb db 'img_from_rgb',0
  1686.         aimg_to_rgb  db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
  1687.         aimg_to_rgb2 db 'img_to_rgb2',0
  1688.         aimg_decode  db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
  1689.         aimg_encode  db 'img_encode',0
  1690.         aimg_create  db 'img_create',0
  1691.         aimg_destroy db 'img_destroy',0
  1692.         aimg_destroy_layer db 'img_destroy_layer',0
  1693.         aimg_count   db 'img_count',0
  1694.         aimg_lock_bits db 'img_lock_bits',0
  1695.         aimg_unlock_bits db 'img_unlock_bits',0
  1696.         aimg_flip    db 'img_flip',0
  1697.         aimg_flip_layer db 'img_flip_layer',0
  1698.         aimg_rotate  db 'img_rotate',0
  1699.         aimg_rotate_layer db 'img_rotate_layer',0
  1700.         aimg_draw    db 'img_draw',0
  1701.  
  1702. align 4
  1703. proclib_import: ;®¯¨á ­¨¥ íªá¯®àâ¨à㥬ëå ä㭪権
  1704.         OpenDialog_Init dd aOpenDialog_Init
  1705.         OpenDialog_Start dd aOpenDialog_Start
  1706. dd 0,0
  1707.         aOpenDialog_Init db 'OpenDialog_init',0
  1708.         aOpenDialog_Start db 'OpenDialog_start',0
  1709.  
  1710. align 4
  1711. import_buf2d:
  1712.         init dd sz_init
  1713.         buf2d_create dd sz_buf2d_create
  1714.         buf2d_create_f_img dd sz_buf2d_create_f_img
  1715.         buf2d_clear dd sz_buf2d_clear
  1716.         buf2d_draw dd sz_buf2d_draw
  1717.         buf2d_delete dd sz_buf2d_delete
  1718.         buf2d_line dd sz_buf2d_line
  1719.         buf2d_rect_by_size dd sz_buf2d_rect_by_size
  1720.         buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
  1721.         buf2d_circle dd sz_buf2d_circle
  1722.         buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
  1723.         buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
  1724.         buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
  1725.         buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
  1726.         buf2d_bit_blt dd sz_buf2d_bit_blt
  1727.         buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
  1728.         buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
  1729.         buf2d_curve_bezier dd sz_buf2d_curve_bezier
  1730.         buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
  1731.         buf2d_draw_text dd sz_buf2d_draw_text
  1732.         buf2d_crop_color dd sz_buf2d_crop_color
  1733.         buf2d_offset_h dd sz_buf2d_offset_h
  1734.         buf2d_flood_fill dd sz_buf2d_flood_fill
  1735.         buf2d_set_pixel dd sz_buf2d_set_pixel
  1736.         dd 0,0
  1737.         sz_init db 'lib_init',0
  1738.         sz_buf2d_create db 'buf2d_create',0
  1739.         sz_buf2d_create_f_img db 'buf2d_create_f_img',0
  1740.         sz_buf2d_clear db 'buf2d_clear',0
  1741.         sz_buf2d_draw db 'buf2d_draw',0
  1742.         sz_buf2d_delete db 'buf2d_delete',0
  1743.         sz_buf2d_line db 'buf2d_line',0
  1744.         sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
  1745.         sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
  1746.         sz_buf2d_circle db 'buf2d_circle',0
  1747.         sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
  1748.         sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
  1749.         sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
  1750.         sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
  1751.         sz_buf2d_bit_blt db 'buf2d_bit_blt',0
  1752.         sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
  1753.         sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
  1754.         sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
  1755.         sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
  1756.         sz_buf2d_draw_text db 'buf2d_draw_text',0
  1757.         sz_buf2d_crop_color db 'buf2d_crop_color',0
  1758.         sz_buf2d_offset_h db 'buf2d_offset_h',0
  1759.         sz_buf2d_flood_fill db 'buf2d_flood_fill',0
  1760.         sz_buf2d_set_pixel db 'buf2d_set_pixel',0
  1761.  
  1762. mouse_dd dd 0x0
  1763. sc system_colors
  1764. last_time dd 0
  1765.  
  1766. align 16
  1767. procinfo process_information
  1768.  
  1769. align 4
  1770. buf_0: dd 0 ;a? § a?«i ­  ?aa?a ?§®?a ¦?­?i
  1771.         dw 5 ;+4 left
  1772.         dw 35 ;+6 top
  1773. .w: dd 460 ;+8 w
  1774. .h: dd 340 ;+12 h
  1775. .color: dd 0xffffd0 ;+16 color
  1776.         db 24 ;+20 bit in pixel
  1777.  
  1778. ;íâ®â ª®¤ ­¥ ¬®©, ®­ ¯à¥®¡à §ã¥â ç¨á«® ¢ áâபã
  1779. ;input:
  1780. ; eax = value
  1781. ; edi = string buffer
  1782. ;output:
  1783. align 4
  1784. tl_convert_to_str:
  1785.         pushad
  1786.                 mov dword[edi+1],0
  1787.                 call .str
  1788.         popad
  1789.         ret
  1790.  
  1791. align 4
  1792. .str:
  1793.         mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
  1794.     ;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢§®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®©
  1795.         cmp eax,ecx  ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
  1796.         jb @f
  1797.                 xor edx,edx  ;®ç¨áâ¨âì edx
  1798.                 div ecx      ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
  1799.                 push edx     ;¯®«®¦¨âì ¢ á⥪
  1800.                 ;dec edi             ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
  1801.                 call .str ;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
  1802.                 pop eax
  1803.         @@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
  1804.         or al,0x30  ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥  ç¥¬ ¤¢¥ ¢ëè¥
  1805.         stosb       ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
  1806.         ret           ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
  1807.  
  1808. i_end:
  1809.         rb 1024
  1810. stacktop:
  1811.         sys_path rb 1024
  1812.         file_name:
  1813.                 rb 1024 ;4096
  1814.         library_path rb 1024
  1815.         plugin_path rb 4096
  1816.         openfile_path rb 4096
  1817.         filename_area rb 256
  1818. mem:
  1819.