Subversion Repositories Kolibri OS

Rev

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