Subversion Repositories Kolibri OS

Rev

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

  1. ;loading file from parameters if parametrs <> 0
  2. ;IN
  3. ; eax- pointer to parameters
  4. ; ebx- pointer to path of file
  5. ;OUT
  6. ;value not returned
  7.  
  8. check_loading_from_parameters:
  9.  
  10.      cmp [eax],byte 0
  11.      jz no_parameters
  12.  
  13.      ;copy file name
  14.      mov esi,eax
  15.      mov edi,ebx
  16.      mov ecx,256
  17.      rep movsb
  18.  
  19.      ;load file in memory
  20.      
  21.      call load_picture
  22.  
  23.      no_parameters:
  24.      
  25.      ret
  26.  
  27.  
  28. ; load picture from file to memory
  29.  
  30. load_picture:
  31.  
  32.          mov eax,file_path
  33.          mov ebx,[ScreenPointer]
  34.          add ebx,0x10000
  35.  
  36.          call load_heading_of_file
  37.  
  38.          mov esi,[ScreenPointer]
  39.          add esi,0x10000
  40.          ;-------------is this BMP file ?----------------
  41.          xor eax,eax
  42.          mov ax,[esi]
  43.          mov [type],ax
  44.  
  45.          cmp [type],word 'BM'
  46.          jne no_bmp_file_1
  47.  
  48.          xor eax,eax
  49.          xor ebx,ebx
  50.          mov eax,[esi+18]
  51.          mov ebx,[esi+22]
  52.          mov [Picture_SizeX],eax
  53.          mov [Picture_SizeY],ebx
  54.  
  55.          jmp exit_type_1
  56.  
  57.          no_bmp_file_1:
  58.  
  59.          ;-------------is this GIF file ?----------------
  60.          xor eax,eax
  61.          mov ax,[esi]
  62.          mov [type],ax
  63.  
  64.          cmp [type],'GI'
  65.          jne no_gif_file_1
  66.  
  67.          add esi,6
  68.          xor eax,eax
  69.          xor ebx,ebx
  70.          mov ax,word[esi]
  71.          mov bx,word[esi+2]
  72.          mov [Picture_SizeX],eax
  73.          mov [Picture_SizeY],ebx
  74.  
  75.          jmp exit_type_1
  76.  
  77.          no_gif_file_1:
  78.  
  79.          jmp no_unpakcing_file_1
  80.  
  81.          exit_type_1:
  82.  
  83.          ;----------------------------------------------------------
  84.          ;Get momory for unpacking picture and for picture's bufers
  85.          ;----------------------------------------------------------
  86.          mov eax,[Picture_SizeX]
  87.          mov ebx,[Picture_SizeY]
  88.  
  89.          imul eax,ebx
  90.          lea eax,[eax+eax*2]
  91.  
  92.          mov ebx,[ScreenPointer]
  93.          add ebx,(1200*1000*3)+50*(20*20*3)+500000
  94.  
  95.          mov [PointerToPicture],ebx
  96.          mov [PointerToCopyPicture],ebx
  97.          mov [PointerToCopyPicture2],ebx
  98.          mov [PointerToEditBufer],ebx
  99.          mov [PointerToSpriteBufer],ebx
  100.  
  101.          add [PointerToCopyPicture],eax
  102.  
  103.          add [PointerToCopyPicture2],eax
  104.          add [PointerToCopyPicture2],eax
  105.  
  106.          add [PointerToEditBufer],eax
  107.          add [PointerToEditBufer],eax
  108.          add [PointerToEditBufer],eax
  109.  
  110.          add [PointerToSpriteBufer],eax
  111.          add [PointerToSpriteBufer],eax
  112.          add [PointerToSpriteBufer],eax
  113.          add [PointerToSpriteBufer],eax
  114.  
  115.          call GetMemory
  116.          ;----------------------------------------------------------
  117.          ;--------------------Load file in memory-------------------
  118.          ;----------------------------------------------------------
  119.  
  120.          mov eax,file_path
  121.          mov ebx,[PointerToCopyPicture]
  122.          add ebx,1000
  123.  
  124.          call load_file
  125.  
  126.          ;----------------------------------------------------------
  127.          ;-------------------Unpacking picture----------------------
  128.          ;----------------------------------------------------------
  129.          mov esi,[PointerToCopyPicture]
  130.          add esi,1000
  131.          mov edi,[PointerToPicture]
  132.          mov eax,[ScreenPointer]
  133.  
  134.          cmp [type],'BM'
  135.          jne no_unpakcing_bmp_file_1
  136.             ;BMP DECODER
  137.             call bmptoimg
  138.             mov [save_flag],1
  139.          no_unpakcing_bmp_file_1:
  140.  
  141.  
  142.          cmp [type],'GI'
  143.          jne no_unpakcing_file_1
  144.            ;GIF DECODER
  145.            sub edi,8
  146.            call ReadGIF
  147.            mov [save_flag],1
  148.          no_unpakcing_file_1:
  149.  
  150.          call MovePictureToWorkScreen
  151.  
  152.          mov [Scroll1CoordinatX],9
  153.          mov [Scroll2CoordinatY],89    
  154.      ret
  155.