Subversion Repositories Kolibri OS

Rev

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