Subversion Repositories Kolibri OS

Rev

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

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