Subversion Repositories Kolibri OS

Rev

Rev 2501 | 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 '../../nu_pogodi/trunk/mem.inc'
  16. include '../../nu_pogodi/trunk/dll.inc'
  17.  
  18. @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
  19. hed db 'Life 20.02.12',0 ;¯®¤¯¨áì ®ª­ 
  20.  
  21. struct FileInfoBlock
  22.         Function dd ?
  23.         Position dd ?
  24.         Flags    dd ?
  25.         Count    dd ?
  26.         Buffer   dd ?
  27.                 db ?
  28.         FileName dd ?
  29. ends
  30.  
  31. run_file_70 FileInfoBlock
  32. image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
  33.  
  34. fn_toolbar db 'toolbar.png',0
  35. IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
  36. IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*9
  37. image_data_toolbar dd 0
  38.  
  39. macro load_image_file path,buf,size { ;¬ ªà®á ¤«ï § £à㧪¨ ¨§®¡à ¦¥­¨©
  40.         ;path - ¬®¦¥â ¡ëâì ¯¥à¥¬¥­­®© ¨«¨ áâப®¢ë¬ ¯ à ¬¥â஬
  41.         if path eqtype '' ;¯à®¢¥à塞 § ¤ ­ «¨ áâப®© ¯ à ¬¥âà path
  42.                 jmp @f
  43.                         local .path_str
  44.                         .path_str db path ;ä®à¬¨à㥬 «®ª «ì­ãî ¯¥à¥¬¥­­ãî
  45.                         db 0
  46.                 @@:
  47.                 ;32 - áâ ­¤ àâ­ë©  ¤à¥á ¯® ª®â®à®¬ã ¤®«¦¥­ ¡ëâì ¡ãä¥à á á¨á⥬­ë¬ ¯ã⥬
  48.                 copy_path .path_str,[32],file_name,0x0
  49.         else
  50.                 copy_path path,[32],file_name,0x0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
  51.         end if
  52.  
  53.         stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
  54.         mov [buf],eax
  55.  
  56.         mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
  57.         mov [run_file_70.Function], 0
  58.         mov [run_file_70.Position], 0
  59.         mov [run_file_70.Flags], 0
  60.         mov [run_file_70.Count], dword size
  61.         m2m [run_file_70.Buffer], [buf]
  62.         mov byte[run_file_70+20], 0
  63.         mov [run_file_70.FileName], file_name
  64.         mov ebx,run_file_70
  65.         int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
  66.         cmp ebx,0xffffffff
  67.         je @f
  68.                 ;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data
  69.                 stdcall dword[img_decode], dword[buf],ebx,0
  70.                 mov dword[image_data],eax
  71.                 ;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥­¨¥ ª ä®à¬ âã rgb
  72.                 stdcall dword[img_to_rgb2], dword[image_data],dword[buf]
  73.                 ;㤠«ï¥¬ ¢à¥¬¥­­ë© ¡ãä¥à image_data
  74.                 stdcall dword[img_destroy], dword[image_data]
  75.         @@:
  76. }
  77.  
  78. ;--------------------------------------
  79. struct Cell
  80.         x dd ? ;+0
  81.         y dd ? ;+4
  82.         tc dd ? ;+8
  83.         liv db ? ;+12
  84.         so db ? ;+13
  85. ends
  86.  
  87. MAX_CELL equ 90000
  88. COL_MEM equ 64 ;ç¨á«® 梥⮢
  89.  
  90. cell dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì á® áâàãªâãà ¬¨ ï祥ª
  91. memCell dd 0
  92. CellColors dd 0
  93.  
  94. macro get_cell_offset reg,ind
  95. {
  96.         mov reg,ind
  97.         imul reg,sizeof.Cell
  98.         add reg,dword[cell]
  99. }
  100.  
  101. capt rb 50
  102. er_oom db 0 ;­  á«ãç © ¨áç¥à¯ ­¨ï ¯ ¬ïâ¨
  103. tim_ch db 0 ; ¢â®¬ â¨ç¥áª¨ ¯à®áç¨â뢠âì ¯®ª®«¥­¨ï
  104. poc_stop dd 1 ;¯à®áç¥â ­  ç¨á«® ¯®ª®«¥­¨©
  105. Cor_x dd 0
  106. Cor_y dd 0
  107. tim dd 0 ;¢à¥¬ï (¯®ª®«¥­¨¥)
  108. b_sort dd 0 ;£à ­¨æ  ¤«ï á®àâ¨à®¢ ­­ëå ï祥ª
  109. osob dd 0 ;ç¨á«® ®á®¡¥©
  110. zoom db 3 ;¬ áèâ ¡ ¯®«ï
  111. txt_zoom db 'Œ áèâ ¡:',0
  112. txt_gen db '®ª®«¥­¨¥:',0
  113. txt_osob db 'Žá®¡¥©:',0
  114.  
  115. ;­ áâனª  ¬ áᨢ  á 梥⠬¨
  116. ; col_pole - 梥⠯®«ï
  117. ; col_cell_n - 梥⠭®¢®© ï祩ª¨
  118. ; col_cell_o - 梥â áâ à®© ï祩ª¨
  119. align 4
  120. proc pole_init_colors uses eax ebx ecx edx esi edi, col_pole:dword, col_cell_n:dword, col_cell_o:dword
  121.         mov esi,dword[CellColors]
  122.         mov ebx,dword[col_pole]
  123.         mov dword[esi],ebx
  124.  
  125.         add esi,4
  126.         mov edi,COL_MEM
  127.         dec edi
  128.         shl edi,2
  129.         add edi,esi
  130.         ; esi - 㪠§ â¥«ì ­  1-© £à ¤¨¥­â­ë© 梥â
  131.         ; edi - 㪠§ â¥«ì ­  ¯®á«¥¤­¨© £à ¤¨¥­â­ë© 梥â
  132.         mov eax,dword[col_cell_n]
  133.         mov ebx,dword[col_cell_o]
  134.  
  135.         mov dword[esi],eax
  136.         mov dword[edi],ebx
  137.         ;need save ecx edx
  138.         stdcall middle_colors, esi,edi
  139.  
  140.         ret
  141. endp
  142.  
  143. ;¢á¯®¬®£ â¥«ì­ ï äã­ªæ¨ï ¤«ï ­ å®¤¦¥­¨ï á।­¥£® æ¢¥â  ¨ § ¯¨á¨ ¥£® ¢ ¬ áᨢ
  144. ;input:
  145. ; eax - 梥⠭ ç «ì­ë©
  146. ; ebx - 梥⠪®­¥ç­ë©
  147. ;§ §àãè îâìáï: ecx, edx
  148. align 4
  149. proc middle_colors uses edi esi, i0:dword, i1:dword
  150.         mov esi,dword[i0]
  151.         mov edi,dword[i1]
  152.         ;¯¥à¥¤ ¢ë§®¢®¬ ä㭪樨
  153.         ;dword[esi]=eax
  154.         ;dword[edi]=ebx
  155.         sub edi,esi
  156.         shr edi,1
  157.         btr edi,1 ;®ªà㣫塞 ¤® 4-å, â. ª. ­ã¦­® ¯®«ãç¨âì  ¤à¥á (®ªà㣫¥­¨¥ å¨â஥ - 㡨ࠥ¬ ®¤¨­ ¡¨â ¢¬¥áâ® ¯à¥¤¯®« £ ¥¬ëå 2-å)
  158.         add edi,esi
  159.         cmp edi,esi
  160.         je @f
  161.                 push eax ebx
  162.  
  163.                 mov ecx,eax
  164.                 mov edx,ebx
  165.  
  166.                 ;­ å®¤¨¬ á।­¨© 梥⠬¥¦¤ã eax ¨ ebx
  167.                 and ebx,111111101111111011111110b ;㡨ࠥ¬ ¯®á«¥¤­¨¥ ¡¨âë ¢ 梥â å r, g, b
  168.                 and eax,111111101111111011111110b
  169.                 add eax,ebx ;á㬨à㥬 æ¢¥â  ¨§ r, g, b
  170.                 shr eax,1   ;¤¥«¨¬ ­  2
  171.                 mov dword[edi],eax
  172.  
  173.                 ;४ãàᨢ­ë© ¢ë§®¢ ¤«ï ¤à®¡«¥­¨ï ¢¥àå­¥© ¯®«®¢¨­ë
  174.                 mov ebx,eax
  175.                 mov eax,ecx
  176.                 stdcall middle_colors, [i0],edi
  177.  
  178.                 ;४ãàᨢ­ë© ¢ë§®¢ ¤«ï ¤à®¡«¥­¨ï ­¨¦­¥© ¯®«®¢¨­ë
  179.                 mov eax,ebx
  180.                 mov ebx,edx
  181.                 stdcall middle_colors, edi,[i1]
  182.  
  183.                 pop ebx eax
  184.         @@:
  185.         ret
  186. endp
  187.  
  188. align 4
  189. pole_clear:
  190.         push eax ecx edi
  191.         xor eax,eax
  192.         mov dword[tim],eax
  193.         mov dword[osob],eax
  194.         mov  byte[tim_ch],al
  195.         mov dword[Cor_x],eax
  196.         mov dword[Cor_y],eax
  197.         mov dword[b_sort],eax
  198.         mov  byte[er_oom],al
  199.         cld
  200.         mov ecx,MAX_CELL
  201.         imul ecx,sizeof.Cell
  202.         mov edi,dword[cell]
  203.         repne stosb ;memset(cell,0,sizeof(Cell)*MAX_CELL);
  204.         mov edi,dword[memCell]
  205.         mov ecx,MAX_CELL
  206.         @@:
  207.                 stosd ;for(i=0;i<MAX_CELL;i++) memCell[i]=i;
  208.                 ;mov dword[edi],eax
  209.                 ;add edi,4
  210.                 inc eax
  211.                 loop @b
  212.         pop edi ecx eax
  213.         ret
  214.  
  215. align 4
  216. proc pole_cell_creat, x:dword, y:dword, li:dword
  217.         pushad ;eax ebx ecx edx edi
  218.  
  219.         ; *** ¥á«¨ ª«¥âª  㦥 ¡ë«  ᮧ¤ ­ 
  220.         stdcall pole_cell_find, [x],[y]
  221.         cmp eax,0
  222.         je @f ;if(i){
  223.                 get_cell_offset ebx,eax
  224.                 cmp dword[li],0
  225.                 jne .else_if ;if(!li)
  226.                         ; ¥á«¨ ᮧ¤ ¥âáï ¯ãáâ ï ª«¥âª 
  227.                         inc byte[ebx+13] ;+13 = .so
  228.                         jmp .fun_e
  229.                 .else_if: ;else if(!(cell[i].liv&1) ){
  230.                 bt word[ebx+12],0 ;+12 = .liv
  231.                         ; ¥á«¨ ᮧ¤ ¥âáï ¦¨¢ ï ª«¥âª 
  232.                         ; ¨ à ­ìè¥ ª«¥âª  ¡ë«  ᮧ¤ ­  ­® ®ª § « áì ¯ãá⮩
  233.                         jae .creat_border_cells
  234.                 jmp .fun_e
  235.         @@:
  236.  
  237.         ; *** ᮧ¤ ­¨¥ ­®¢®© ï祩ª¨
  238.         ; ­ å®¤¨¬ ­®¬¥à ᢮¡®¤­®© ï祩ª¨ (i) ¤«ï ¤®¡ ¢«¥­¨ï ­®¢®©
  239.         mov edi,dword[memCell]
  240.         inc dword[edi]
  241.         cmp dword[edi],MAX_CELL
  242.         jne @f
  243.                 dec dword[edi]
  244.                 mov byte[tim_ch],0
  245.                 ;... need call message: "eror out of memory" ...
  246.                 ;... ¢ë¢®¤ á®®¡é¥­¨ï ¯¥à¥¯®«­¥­¨ï ­ ¤® ¤®¡ ¢¨âì  ...
  247.                 mov byte[er_oom],0
  248.                 jmp .fun_e ;return;
  249.         @@:
  250.         mov eax,dword[edi]
  251.         shl eax,2
  252.         add eax,dword[memCell] ;eax -> memCell[firstC]
  253.         get_cell_offset ebx,dword[eax]
  254.  
  255.         mov ecx,dword[x]
  256.         mov dword[ebx],ecx ;+0 = .x
  257.         mov edx,dword[y]
  258.         mov dword[ebx+4],edx ;+4 = .y
  259.         mov eax,dword[tim]
  260.         mov dword[ebx+8],eax ;+8 = .tc
  261.         mov byte[ebx+12],0 ;+12 = .liv
  262.  
  263.         cmp dword[li],0
  264.         jne @f
  265.                 mov byte[ebx+13],1 ;+13 = .so
  266.                 jmp .fun_e
  267.         @@:
  268.         mov byte[ebx+13],0 ;+13 = .so
  269.  
  270.         .creat_border_cells:
  271.                 inc dword[osob]
  272.                 or byte[ebx+12],1 ;+12 = .liv
  273.                 mov ecx,dword[x]
  274.                 dec ecx
  275.                 mov edx,dword[y]
  276.                 dec edx
  277.                 stdcall pole_cell_creat,ecx,edx,0
  278.                 inc edx
  279.                 stdcall pole_cell_creat,ecx,edx,0
  280.                 inc edx
  281.                 stdcall pole_cell_creat,ecx,edx,0
  282.                 inc ecx
  283.                 stdcall pole_cell_creat,ecx,edx,0
  284.                 sub edx,2
  285.                 stdcall pole_cell_creat,ecx,edx,0
  286.                 inc ecx
  287.                 stdcall pole_cell_creat,ecx,edx,0
  288.                 inc edx
  289.                 stdcall pole_cell_creat,ecx,edx,0
  290.                 inc edx
  291.                 stdcall pole_cell_creat,ecx,edx,0
  292.         .fun_e:
  293.         popad ;edi edx ecx ebx eax
  294.         ret
  295. endp
  296.  
  297. ;output:
  298. ; eax - index
  299. align 4
  300. proc pole_cell_find, x:dword, y:dword
  301.         mov eax,dword[memCell]
  302.         cmp dword[eax],0
  303.         jne @f
  304.                 xor eax,eax ;if(!fristC) return 0;
  305.                 jmp .fun_e
  306.         @@:
  307.  
  308.         xor eax,eax ;fnd=0;
  309.         cmp dword[b_sort],0
  310.         je @f
  311.                 stdcall pole_bin_find, [memCell], [x],[y], [b_sort] ;i=BinFind(memCell, x,y, b_sort);
  312.                 cmp eax,0
  313.                 je @f
  314.                         shl eax,2
  315.                         add eax,dword[memCell]
  316.                         mov eax,dword[eax] ;if(i) fnd=memCell[i];
  317.                         jmp .fun_e
  318.         @@:
  319.  
  320.         cmp eax,0
  321.         jne @f ;if(!fnd){ // ¯®¨áª ï祩ª¨ §  ¡¨­ à­ë¬ ¤¥à¥¢®¬
  322.                 push ebx ecx edx edi esi
  323.                 ;ebx -> i
  324.                 ;ecx -> firstC
  325.                 ;edx -> &memCell[i]
  326.                 ;edi -> cell[memCell[i]]
  327.                 mov ecx,dword[memCell]
  328.                 mov ebx,dword[b_sort]
  329.                 mov edx,ebx
  330.                 shl edx,2
  331.                 add edx,ecx
  332.                 inc ebx
  333.                 mov ecx,dword[ecx]
  334.                 .cycle_b: ;for(i=b_sort+1;i<=fristC;i++)
  335.                         add edx,4
  336.                         get_cell_offset edi,dword[edx]
  337.                         mov esi,dword[x]
  338.                         cmp dword[edi],esi ;+0 = .x
  339.                         jne .if_e
  340.                         mov esi,dword[y]
  341.                         cmp dword[edi+4],esi ;+4 = .y
  342.                         jne .if_e
  343.                                 ;if(cell[memCell[i]].x==x && cell[memCell[i]].y==y){
  344.                                 mov eax,dword[edx] ;fnd=memCell[i];
  345.                                 jmp .cycle_e ;break;
  346.                         .if_e:
  347.                         inc ebx
  348.                         cmp ebx,ecx
  349.                         jle .cycle_b
  350.                 .cycle_e:
  351.                 pop esi edi edx ecx ebx
  352.         @@:
  353.         .fun_e:
  354.         ret
  355. endp
  356.  
  357. ;output:
  358. ; eax - index
  359. align 4
  360. proc pole_bin_find, mas:dword, fx:dword, fy:dword, k:dword
  361.         push ebx ecx edx edi
  362.         xor eax,eax
  363.         mov ebx,1 ;ebx - ¬ ªá¨¬ «ì­ë© ¯®à冷ª ¤«ï ¤¥à¥¢ 
  364.         @@:
  365.         cmp dword[k],ebx
  366.         jle @f ;while(k>por)
  367.                 shl ebx,1 ;por<<=1;
  368.                 jmp @b
  369.         @@:
  370.         cmp dword[k],ebx
  371.         jge @f ;if(k<por)
  372.                 shr ebx,1 ;por>>=1;
  373.         @@:
  374.         mov ecx,ebx ;i=por;
  375.  
  376.         ;ecx -> i
  377.         ;edi -> mas[i]
  378.         .cycle_b: ;do{
  379.                 shr ebx,1 ;por>>=1;
  380.  
  381.                 mov edi,ecx
  382.                 shl edi,2
  383.                 add edi,dword[mas]
  384.                 ;if(compare_cells_mb(mas[i],fx,fy)){
  385.                 stdcall pole_compare_cells_mb_coords, dword[edi],[fx],[fy]
  386.                 cmp dl,0
  387.                 je .if_u0_e
  388.                         @@: ;while(i+por>k)
  389.                         mov edx,ecx
  390.                         add edx,ebx
  391.                         cmp edx,dword[k] ;i+por>k
  392.                         jle @f
  393.                                 shr ebx,1 ;por>>=1;
  394.                                 jmp @b
  395.                         @@:
  396.                         add ecx,ebx ;i+=por;
  397.                         jmp .if_e
  398.                 .if_u0_e:
  399.                 ;else if(compare_cells_bm(mas[i],fx,fy))i-=por;
  400.                 stdcall pole_compare_cells_bm_coords, dword[edi],[fx],[fy]
  401.                 cmp dl,0
  402.                 je .if_u1_e
  403.                         sub ecx,ebx
  404.                         jmp .if_e
  405.                 .if_u1_e:
  406.                 ;else { m=i; por=0; }
  407.                         mov eax,ecx
  408.                         xor ebx,ebx
  409.                 .if_e:
  410.         cmp ebx,0
  411.         jne .cycle_b ;}while(por);
  412.  
  413.         pop edi edx ecx ebx
  414.         ret
  415. endp
  416.  
  417. ;output:
  418. ; dl
  419. align 4
  420. proc pole_compare_cells_bm_coords, i0:dword, fx:dword, fy:dword
  421.         push eax ebx ecx
  422.         get_cell_offset eax,[i0]
  423.         ;eax -> cell[i0]
  424.         mov ebx,dword[fx]
  425.         cmp dword[eax],ebx
  426.         jle @f
  427.                 mov dl,1
  428.                 jmp .fun_e
  429.         @@:
  430.         mov ecx,dword[fy]
  431.         cmp dword[eax+4],ecx
  432.         jle @f
  433.         cmp dword[eax],ebx
  434.         jne @f
  435.                 mov dl,1
  436.                 jmp .fun_e
  437.         @@:
  438.         xor dl,dl
  439.         .fun_e:
  440.         pop ecx ebx eax
  441.         ret
  442. endp
  443.  
  444. ;output:
  445. ; dl
  446. align 4
  447. proc pole_compare_cells_mb_coords, i0:dword, fx:dword, fy:dword
  448.         push eax ebx ecx
  449.         get_cell_offset eax,[i0]
  450.         ;eax -> cell[i0]
  451.         mov ebx,dword[fx]
  452.         cmp dword[eax],ebx
  453.         jge @f
  454.                 mov dl,1
  455.                 jmp .fun_e
  456.         @@:
  457.         mov ecx,dword[fy]
  458.         cmp dword[eax+4],ecx
  459.         jge @f
  460.         cmp dword[eax],ebx
  461.         jne @f
  462.                 mov dl,1
  463.                 jmp .fun_e
  464.         @@:
  465.         xor dl,dl
  466.         .fun_e:
  467.         pop ecx ebx eax
  468.         ret
  469. endp
  470.  
  471. ;output:
  472. ; dl
  473. align 4
  474. proc pole_compare_cells_bm, i0:dword, i1:dword
  475.         push eax ebx ecx
  476.         get_cell_offset eax,[i0] ;eax -> cell[i0]
  477.         get_cell_offset ebx,[i1] ;ebx -> cell[i1]
  478.         mov ecx,dword[ebx] ;+0 = .x
  479.         cmp dword[eax],ecx
  480.         jle @f ;x0>x1
  481.                 mov dl,1
  482.                 jmp .fun_e
  483.         @@:
  484.         jne @f ;x0==x1
  485.         mov ecx,dword[ebx+4] ;+4 = .y
  486.         cmp dword[eax+4],ecx
  487.         jle @f ;y0>y1
  488.                 mov dl,1
  489.                 jmp .fun_e
  490.         @@:
  491.         xor dl,dl
  492.         .fun_e:
  493.         pop ecx ebx eax
  494.         ret
  495. endp
  496.  
  497. align 4
  498. pole_paint:
  499.         pushad
  500.         ;eax -> firstC
  501.         ;ebx -> i
  502.         ;ecx -> cell[memCell[i]]
  503.         ;edx -> color
  504.         ;edi -> coord_x
  505.         ;esi -> coord_y
  506.         mov eax,dword[memCell]
  507.         cmp dword[eax],0
  508.         je .no_draw
  509.  
  510.         mov eax,dword[eax]
  511.         mov ebx,1
  512.  
  513. ;---
  514.         @@: ;while(i<b_sort && Cor_x+cell[memCell[i]].x<0)
  515.                 cmp ebx,dword[b_sort]
  516.                 jge @f ;¯¥à¥å®¤¨¬ ­  ­ ç «® ­¨¦­¥£® 横« 
  517.                 mov ecx,ebx
  518.                 shl ecx,2
  519.                 add ecx,dword[memCell]
  520.                 get_cell_offset ecx,dword[ecx]
  521.                 mov edx,dword[ecx] ;+0 = .x
  522.                 add edx,dword[Cor_x]
  523.                 cmp edx,0
  524.                 jge @f ;¯¥à¥å®¤¨¬ ­  ­ ç «® ­¨¦­¥£® 横« 
  525.                         inc ebx ;i++; // ¤«ï ¯à®¯ã᪠ ï祥ª §  ®ª­®¬ á«¥¢ 
  526.                 jmp @b
  527.         @@:
  528.  
  529.         cmp byte[zoom],2
  530.         jge .zoom2
  531.         @@: ;for(;i<=fristC;i++){
  532.                 mov ecx,ebx
  533.                 shl ecx,2
  534.                 add ecx,dword[memCell]
  535.                 get_cell_offset ecx,dword[ecx]
  536. ;...
  537.                 mov edi,dword[Cor_x]
  538.                 add edi,dword[ecx] ;+0 = .x
  539.                 mov esi,dword[Cor_y]
  540.                 add esi,dword[ecx+4] ;+4 = .y
  541.                 bt word[ecx+12],0 ;+12 = .liv
  542.                 jc .cell_1
  543.                         ;­¥ ¦¨¢ ï ï祩ª 
  544.                         mov edx,dword[CellColors]
  545.                         mov edx,dword[edx]
  546.                         jmp .cell_0
  547.                 .cell_1:
  548.                         ;¦¨¢ ï ï祩ª 
  549.                         mov edx,dword[tim]
  550.                         inc edx
  551.                         sub edx,dword[ecx+8] ;+8 = .tc
  552.                         cmp edx,COL_MEM
  553.                         jle .in_color
  554.                                 mov edx,COL_MEM
  555.                         .in_color:
  556.                         shl edx,2
  557.                         add edx,dword[CellColors]
  558.                         mov edx,dword[edx]
  559.                 .cell_0:
  560.                 stdcall [buf2d_set_pixel], buf_0, edi, esi, edx
  561. ;...
  562.                 inc ebx
  563.                 cmp ebx,eax
  564.                 jle @b
  565.  
  566.         jmp .no_draw
  567.         .zoom2:
  568.  
  569.         @@: ;for(;i<=fristC;i++){
  570.                 mov ecx,ebx
  571.                 shl ecx,2
  572.                 add ecx,dword[memCell]
  573.                 get_cell_offset ecx,dword[ecx]
  574.  
  575.                 xor edx,edx
  576.                 mov dl,byte[zoom] ;edx ¨á¯®«ì§ã¥âáï ¤«ï ¢­¥á¥­¨ï zoom ¢ 4 ¡ ©â­®¥ ç¨á«®
  577.                 mov edi,dword[ecx] ;+0 = .x
  578.                 add edi,dword[Cor_x]
  579.                 imul edi,edx
  580.                 mov esi,dword[ecx+4] ;+4 = .y
  581.                 add esi,dword[Cor_y]
  582.                 imul esi,edx
  583.                 bt word[ecx+12],0 ;+12 = .liv
  584.                 jc .z2_cell_1
  585.                         ;­¥ ¦¨¢ ï ï祩ª 
  586.                         mov edx,dword[CellColors]
  587.                         mov edx,dword[edx]
  588.                         jmp .z2_cell_0
  589.                 .z2_cell_1:
  590.                         ;¦¨¢ ï ï祩ª 
  591.                         mov edx,dword[tim]
  592.                         inc edx
  593.                         sub edx,dword[ecx+8] ;+8 = .tc
  594.                         cmp edx,COL_MEM
  595.                         jle .z2_in_color
  596.                                 mov edx,COL_MEM
  597.                         .z2_in_color:
  598.                         shl edx,2
  599.                         add edx,dword[CellColors]
  600.                         mov edx,dword[edx]
  601.                 .z2_cell_0:
  602.                 xor ecx,ecx
  603.                 mov cl,byte[zoom] ;ecx ¨á¯®«ì§ã¥âáï ¤«ï ¢­¥á¥­¨ï zoom ¢ 4 ¡ ©â­®¥ ç¨á«®
  604.                 ;;;dec ecx
  605.                 stdcall [buf2d_filled_rect_by_size], buf_0, edi, esi, ecx, ecx, edx
  606.                 inc ebx
  607.                 cmp ebx,eax
  608.                 jle @b
  609.  
  610.         .no_draw:
  611.         popad
  612.         ret
  613.  
  614. align 4
  615. pole_next_gen:
  616.         pushad
  617.         ;eax -> firstC
  618.         ;ebx -> i
  619.         ;ecx -> &memCell[i]
  620.         ;edx -> cell[memCell[i]]
  621.  
  622.         mov eax,dword[memCell]
  623.         mov ecx,eax
  624.         mov eax,dword[eax]
  625.         cmp eax,1
  626.         jl .fun_e
  627.         inc dword[tim]
  628.         mov ebx,1
  629.         @@: ;for(i=1;i<=firstC;i++)
  630.                 add ecx,4
  631.                 get_cell_offset edx,dword[ecx]
  632.                 bt word[edx+12],0 ;+12 = .liv
  633.                 jae .if_0_e
  634.                         ; á®åà ­¥­¨¥ ï祩ª¨ (á®á¥¤¥© 2 ¨«¨ 3)
  635.                         cmp byte[edx+13],2 ;+13 = .so
  636.                         je .if_2_e
  637.                         cmp byte[edx+13],3 ;+13 = .so
  638.                         je .if_2_e
  639.                         jmp .change
  640.                 .if_0_e:
  641.                         ; ᮧ¤ ­¨¥ ï祩ª¨ (á®á¥¤¥© 3)
  642.                         cmp byte[edx+13],3 ;+13 = .so
  643.                         jne .if_1_e
  644.                         .change:
  645.                                 or byte[edx+12],2 ;+12 = .liv
  646.                                 jmp .if_2_e
  647.                 .if_1_e:
  648.                         ; 㤠«¥­¨¥ ¯ãá⮩ ï祩ª¨ ¤«ï ®á¢®¡®¦¤¥­¨ï ¯ ¬ïâ¨
  649.                         cmp byte[edx+13],0 ;+13 = .so
  650.                         jne .if_2_e
  651.                         mov edi,dword[edx+8] ;+8 = .tc
  652.                         add edi,5 ; 5 - ¢à¥¬ï á®åà ­¥­¨ï ¯ãá⮩ ï祩ª¨, ¤® ¥ñ 㤠«¥­¨ï
  653.                         cmp edi,dword[tim]
  654.                         jge .if_2_e
  655.                                 mov edi,eax
  656.                                 shl edi,2
  657.                                 add edi,dword[memCell] ;edi -> &memCell[fristC]
  658.                                 mov esi,dword[edi] ;swp=memCell[fristC];
  659.                                 mov edx,dword[ecx] ;edx - 㦥 ­¥ ¨á¯®«ì§ã¥¬, ¯®â®¬ã ¬®¦¥¬ ¯®àâ¨âì
  660.                                 mov dword[edi],edx ;memCell[fristC]=memCell[i];
  661.                                 mov dword[ecx],esi ;memCell[i]=swp;
  662.                                 dec eax
  663.                                 dec ebx
  664.                                 sub ecx,4
  665.                 .if_2_e:
  666.  
  667.                 inc ebx
  668.                 cmp ebx,eax
  669.                 jle @b
  670.         mov ebx,dword[memCell]
  671.         mov dword[ebx],eax ;firstC <- eax
  672.  
  673.         mov dword[b_sort],eax
  674.         stdcall pole_fl_sort, dword[memCell],eax
  675.  
  676.         mov ecx,dword[memCell]
  677.         mov ebx,1
  678.         @@: ;for(i=1;i<=firstC;i++)
  679.                 add ecx,4
  680.                 get_cell_offset edx,dword[ecx]
  681.                 bt word[edx+12],1 ;+12 = .liv
  682.                 jae .no_change
  683.                         xor byte[edx+12],3 ;+12 = .liv
  684.                         mov edi,dword[tim]
  685.                         mov dword[edx+8],edi ;+8 = .tc
  686.                         bt word[edx+12],0 ;+12 = .liv
  687.                         jc .new_cell
  688.                                 push eax
  689.                                 mov edi,dword[edx]
  690.                                 dec edi
  691.                                 mov esi,dword[edx+4]
  692.                                 dec esi
  693.                                 dec dword[osob]
  694.                                 ;¤ «ìè¥ §­ ç¥­¨¥ edx ¯®àâ¨âáï
  695.                                 stdcall pole_cell_find,edi,esi
  696.                                 get_cell_offset edx,eax
  697.                                 dec byte[edx+13] ;+13 = .so
  698.                                 inc esi
  699.                                 stdcall pole_cell_find,edi,esi
  700.                                 get_cell_offset edx,eax
  701.                                 dec byte[edx+13] ;+13 = .so
  702.                                 inc esi
  703.                                 stdcall pole_cell_find,edi,esi
  704.                                 get_cell_offset edx,eax
  705.                                 dec byte[edx+13] ;+13 = .so
  706.                                 inc edi
  707.                                 stdcall pole_cell_find,edi,esi
  708.                                 get_cell_offset edx,eax
  709.                                 dec byte[edx+13] ;+13 = .so
  710.                                 sub esi,2
  711.                                 stdcall pole_cell_find,edi,esi
  712.                                 get_cell_offset edx,eax
  713.                                 dec byte[edx+13] ;+13 = .so
  714.                                 inc edi
  715.                                 stdcall pole_cell_find,edi,esi
  716.                                 get_cell_offset edx,eax
  717.                                 dec byte[edx+13] ;+13 = .so
  718.                                 inc esi
  719.                                 stdcall pole_cell_find,edi,esi
  720.                                 get_cell_offset edx,eax
  721.                                 dec byte[edx+13] ;+13 = .so
  722.                                 inc esi
  723.                                 stdcall pole_cell_find,edi,esi
  724.                                 get_cell_offset edx,eax
  725.                                 dec byte[edx+13] ;+13 = .so
  726.                                 pop eax
  727.                                 jmp .no_change
  728.                         .new_cell: ; ¯®ï¢¨« áì ­®¢ ï ï祩ª 
  729.                                 inc dword[osob]
  730.                                 mov edi,dword[edx]
  731.                                 dec edi
  732.                                 mov esi,dword[edx+4]
  733.                                 dec esi
  734.                                 stdcall pole_cell_creat,edi,esi,0
  735.                                 inc esi
  736.                                 stdcall pole_cell_creat,edi,esi,0
  737.                                 inc esi
  738.                                 stdcall pole_cell_creat,edi,esi,0
  739.                                 inc edi
  740.                                 stdcall pole_cell_creat,edi,esi,0
  741.                                 sub esi,2
  742.                                 stdcall pole_cell_creat,edi,esi,0
  743.                                 inc edi
  744.                                 stdcall pole_cell_creat,edi,esi,0
  745.                                 inc esi
  746.                                 stdcall pole_cell_creat,edi,esi,0
  747.                                 inc esi
  748.                                 stdcall pole_cell_creat,edi,esi,0
  749.                 .no_change:
  750.                 inc ebx
  751.                 cmp ebx,eax
  752.                 jle @b
  753.         .fun_e:
  754.         popad
  755.         ret
  756.  
  757. ;‘®àâ¨à®¢ª  ¢¥ªâ®à  a[1..n] ¬¥â®¤®¬ ”«®©¤ 
  758. align 4
  759. proc pole_fl_sort, a:dword, n:dword
  760.         pushad
  761.         mov ecx,dword[a]
  762.         ;”®à¬¨à®¢ âì ¨á室­®¥ ç áâ¨ç­® 㯮à冷祭­®¥ ¤¥à¥¢®
  763.         mov eax,dword[n]
  764.         shr eax,1
  765.         @@: ;for(i=n>>1; i>=2; i--)
  766.                 stdcall pole_fl_surface, ecx,eax,[n] ;(a,i,n)
  767.                 dec eax
  768.                 cmp eax,2
  769.                 jge @b
  770.         ;‚믮«­¨âì ¯à®æ¥¤ãà㠢ᯫëâ¨ï ”«®©¤  ¤«ï ª ¦¤®£® ¯®¤¤¥à¥¢ 
  771.         mov eax,dword[n]
  772.         @@: ;for(i=n; i>=2; i--){
  773.                 stdcall pole_fl_surface, ecx,1,eax ;(a,1,i)
  774.                 ;®¬¥áâ¨âì ­ ©¤¥­­ë© ¬ ªá¨¬ «ì­ë© í«¥¬¥­â ¢ ª®­¥æ ᯨ᪠
  775.                 mov edi,eax
  776.                 shl edi,2
  777.                 add edi,ecx ;edi -> &a[i]
  778.                 mov esi,dword[edi] ;w=a[i];
  779.                 mov edx,dword[ecx+4]
  780.                 mov dword[edi],edx ;a[i]=a[1];
  781.                 mov dword[ecx+4],esi ;a[1]=w;
  782.  
  783.                 dec eax
  784.                 cmp eax,2
  785.                 jge @b
  786.         popad
  787.         ret
  788. endp
  789.  
  790. ;à®æ¥¤ãà  ¢á¯«ëâ¨ï ”«®©¤  ¯® ¤¥à¥¢ã a[1..k]
  791. align 4
  792. proc pole_fl_surface, a:dword, i:dword, k:dword
  793. locals
  794.         copy dd ?
  795. endl
  796.         pushad
  797.         ;edx -> ...
  798.         ;edi -> m
  799.         ;esi -> j
  800.         mov eax,dword[a]
  801.         mov ebx,dword[i]
  802.         mov ecx,dword[k]
  803.  
  804.         mov edx,ebx
  805.         shl edx,2
  806.         add edx,eax
  807.         mov edx,dword[edx]
  808.         mov dword[copy],edx ;copy=a[i];
  809.         mov edi,ebx
  810.         shl edi,1 ;m=i<<1;
  811.         .cycle_b: ;while (m<=k) {
  812.                 cmp edi,ecx
  813.                 jg .cycle_e
  814.                 jne @f ;if (m==k) j=m;
  815.                         mov esi,edi
  816.                         jmp .else_e
  817.                 @@: ;else if (pole_compare_cells_bm(a[m],a[m+1])) j=m;
  818.                 mov edx,edi
  819.                 shl edx,2
  820.                 add edx,eax
  821.                 stdcall pole_compare_cells_bm, dword[edx],dword[edx+4]
  822.                 cmp dl,0
  823.                 je @f
  824.                         mov esi,edi
  825.                         jmp .else_e
  826.                 @@: ;else j=m+1;
  827.                         mov esi,edi
  828.                         inc esi
  829.                 .else_e:
  830.  
  831.                 ;if (pole_compare_cells_bm(a[j],copy)) {
  832.                 mov edx,esi
  833.                 shl edx,2
  834.                 add edx,eax
  835.                 stdcall pole_compare_cells_bm, dword[edx],dword[copy]
  836.                 cmp dl,0
  837.                 je .cycle_e ;} else break; //¢ë室 ¨§ 横« 
  838.  
  839.                 mov edx,esi
  840.                 shl edx,2
  841.                 add edx,eax
  842.                 push dword[edx] ;push a[j];
  843.                 mov edx,ebx
  844.                 shl edx,2
  845.                 add edx,eax
  846.                 pop dword[edx] ;a[i]=a[j];
  847.                 mov ebx,esi ;i=j;
  848.                 mov edi,ebx
  849.                 shl edi,1 ;m=i<<1;
  850.  
  851.                 jmp .cycle_b
  852.         .cycle_e:
  853.  
  854.         ;§­ ç¥­¨ï ¬­®£¨å ॣ¨áâ஢ 㦥 ­¥ ¢ ¦­ë â. ª. ª®­¥æ ä㭪樨
  855.         shl ebx,2
  856.         add eax,ebx
  857.         mov edx,dword[copy]
  858.         mov dword[eax],edx ;a[i]=copy;
  859.  
  860.         popad
  861.         ret
  862. endp
  863. ;--------------------------------------
  864.  
  865.  
  866. align 4
  867. start:
  868.         load_libraries l_libs_start,l_libs_end
  869.         ;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ­ è  «¨¡ 
  870.         mov     ebp,lib_7
  871.         cmp     dword [ebp+ll_struc_size-4],0
  872.         jz      @f
  873.                 mcall -1 ;exit not correct
  874.         @@:
  875.         mcall 48,3,sc,sizeof.system_colors
  876.         mcall 40,0x27
  877.         stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
  878.  
  879.         stdcall [buf2d_create], buf_0 ;ᮧ¤ ­¨¥ ¡ãä¥à 
  880.  
  881.         stdcall mem.Alloc,MAX_CELL*sizeof.Cell
  882.         mov [cell],eax
  883.         stdcall mem.Alloc,MAX_CELL*4
  884.         mov [memCell],eax
  885.         stdcall mem.Alloc,(COL_MEM+1)*4
  886.         mov [CellColors],eax
  887.         load_image_file fn_toolbar, image_data_toolbar,IMAGE_TOOLBAR_SIZE
  888.  
  889.         stdcall pole_init_colors, 0xffffff,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.