Subversion Repositories Kolibri OS

Rev

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

  1. ;**************************************************************************
  2. ;**********************DECODING BMP FILE(1,4,8,24 bits)*********************
  3. ;***************************************************************************
  4. ; BMPTOIMG -Convert BMP format TO IMG format
  5. ;***************************************************************************
  6. bmptoimg:
  7.  
  8.     mov [bmp_load_area],esi
  9.     mov [img_dest_area],edi
  10.     xor eax,eax
  11.     mov ax,word[esi+28]
  12.     mov ebx,[esi+14]
  13.     mov ecx,[esi+18]
  14.     mov edx,[esi+22]
  15.     mov [bmp_bits_per_pixel],ax
  16.     mov [bmp_first_structure_size],ebx
  17.     mov [Bmp_SizeY],edx
  18.     mov [Bmp_SizeX],ecx
  19.  
  20.     xor eax,eax
  21.     mov ax,[esi+28]
  22.     mul  dword [esi+18]
  23.     add  eax,31
  24.     shr  eax,5
  25.     mov  dword [bmptoimg_data_area_dwps],eax  ;dwps-doublewords per string
  26.     shl  eax,2
  27.     mov  dword [bmptoimg_data_area_bps],eax   ;bps-bytes per string
  28.  
  29.     cmp dword [esi+34],0
  30.     jne  yespicsize  ;if picture size is defined
  31.     mul dword [esi+22]
  32.     mov dword [esi+34],eax
  33.  
  34.   yespicsize:
  35.  
  36.     mov  eax,[bmp_load_area]
  37.     add  eax, [esi+10]   ;how mach bytes to begin bitmap
  38.     add  eax, [esi+34]   ;size of bitmap in BMP file
  39.     mov  dword [bmptoimg_data_area_eop],eax   ;eop-end of picture in file
  40.     ;calculate bytes per string
  41.     mov  eax, [esi+18]
  42.     lea  eax,[eax+2*eax]   ;3x pixels in eax
  43.     mov [bmp_bytes_per_string],eax
  44.  
  45.     mov esi,dword [bmptoimg_data_area_eop]
  46.     sub esi,dword [bmptoimg_data_area_bps]
  47.  
  48.     mov ebp,[img_dest_area]
  49.     mov edi,[img_dest_area]
  50.     mov ebx,[bmp_load_area]
  51.     add ebx, [bmp_first_structure_size]
  52.     add ebx,14          ;in ebx start of color table
  53.  
  54.  
  55.     cmp [bmp_bits_per_pixel],24
  56.     je  convert_to_24bpp
  57.  
  58.     cmp [bmp_bits_per_pixel],8
  59.     je convert_to_8bpp
  60.  
  61.     cmp [bmp_bits_per_pixel],4
  62.     je convert_to_4bpp
  63.  
  64.     cmp [bmp_bits_per_pixel],1
  65.     je convert_to_1bpp
  66.  
  67.     jmp end_bmp
  68.  
  69. ;--------------------------------------------------
  70. ;-----------Decoding 24 bit BMP file---------------
  71. ;--------------------------------------------------
  72. convert_to_24bpp:
  73.  
  74.   mov ebx,[Bmp_SizeY]
  75.   loop_convert_to_24bpp_y:
  76.  
  77.     mov edi,ebp
  78.     mov  ecx,[bmptoimg_data_area_dwps]
  79.  
  80.      loop_convert_to_24bpp_x:
  81.  
  82.        mov edx,[esi]
  83.        mov [edi],edx
  84.        add esi,4
  85.        add edi,4
  86.  
  87.      dec ecx
  88.      jnz loop_convert_to_24bpp_x
  89.  
  90.     sub  esi,[bmptoimg_data_area_bps]
  91.     sub  esi,[bmptoimg_data_area_bps]
  92.  
  93.     add  ebp,eax
  94.     dec ebx
  95.     jnz loop_convert_to_24bpp_y
  96.  
  97.     jmp  end_bmp
  98. ;-----------------------------------------------------
  99. ;--------------Decoding 8 bits BMP file---------------
  100. ;-----------------------------------------------------
  101.  convert_to_8bpp:
  102.  
  103.     mov ebp,[Bmp_SizeY]
  104.     loop_convert_8bpp_y:
  105.  
  106.       mov ecx,[bmptoimg_data_area_bps]
  107.       push edi
  108.  
  109.       loop_convert_8bpp_x:
  110.  
  111.          xor eax,eax
  112.          mov al,byte [esi]
  113.          call converttable
  114.          inc esi
  115.          add edi,3
  116.  
  117.       dec ecx
  118.       jnz loop_convert_8bpp_x
  119.  
  120.       pop edi
  121.  
  122.     add edi,[bmp_bytes_per_string]
  123.     sub esi,[bmptoimg_data_area_bps]
  124.     sub esi,[bmptoimg_data_area_bps]
  125.  
  126.     dec ebp
  127.     jnz loop_convert_8bpp_y
  128.  
  129.     jmp end_bmp
  130. ;-----------------------------------------------------
  131. ;--------------Decoding 4 bits BMP file---------------
  132. ;-----------------------------------------------------
  133.  convert_to_4bpp:
  134.  
  135.     mov ebp,[Bmp_SizeY]
  136.     loop_convert_4bpp_y:
  137.  
  138.       mov ecx,[bmptoimg_data_area_bps]
  139.       push edi
  140.  
  141.       loop_convert_4bpp_x:
  142.  
  143.          mov [Bmp_save1],ecx
  144.          xor eax,eax
  145.          mov al,byte [esi]
  146.          xor ecx,ecx
  147.          mov cl,al
  148.          shr al,4   ;first pixel in byte
  149.          and cl,0xf ;second pixel in byte
  150.          call converttable   ;draw first pixel of byte
  151.          mov eax,ecx           ;move second pixel to register al and draw
  152.          add edi,3
  153.          call converttable   ;draw second pixel of byte
  154.          add edi,3
  155.          mov ecx,[Bmp_save1]
  156.          inc esi
  157.  
  158.       dec ecx
  159.       jnz loop_convert_4bpp_x
  160.  
  161.       pop edi
  162.  
  163.     add edi,[bmp_bytes_per_string]
  164.     sub esi,[bmptoimg_data_area_bps]
  165.     sub esi,[bmptoimg_data_area_bps]
  166.  
  167.     dec ebp
  168.     jnz loop_convert_4bpp_y
  169.  
  170.     jmp end_bmp
  171. ;-----------------------------------------------------
  172. ;---------------Decoding 1 bit BMP file---------------
  173. ;-----------------------------------------------------
  174.  convert_to_1bpp:
  175.  
  176.     mov ebp,[Bmp_SizeY]
  177.     loop_convert_1bpp_y:
  178.  
  179.       mov ecx,[bmptoimg_data_area_bps]
  180.       push edi
  181.  
  182.       loop_convert_1bpp_x:
  183.  
  184.          xor eax,eax
  185.          mov al,byte [esi]
  186.          mov [Bmp_save1],ecx
  187.          mov  ecx,eax
  188.          mov  edx,7
  189.          nextbit:
  190.             xor  eax,eax
  191.             bt   ecx,edx
  192.             jnc  noaddelem
  193.             inc  eax
  194.             noaddelem:
  195.  
  196.             push edx
  197.             call converttable
  198.             pop  edx
  199.  
  200.             add  edi,3
  201.             dec  edx
  202.          jns nextbit
  203.          mov ecx,[Bmp_save1]
  204.          inc esi
  205.       dec ecx
  206.       jnz loop_convert_1bpp_x
  207.  
  208.       pop edi
  209.  
  210.     add edi,[bmp_bytes_per_string]
  211.     sub esi,[bmptoimg_data_area_bps]
  212.     sub esi,[bmptoimg_data_area_bps]
  213.  
  214.     dec ebp
  215.     jnz loop_convert_1bpp_y
  216.  
  217.     jmp end_bmp
  218. ;-----------------------------------------------------
  219.   converttable:
  220.     shl  eax,2
  221.     add  eax,ebx
  222.     mov  edx, dword [eax]
  223.     mov [edi],edx
  224.     ret
  225. ;-----------------------------------------------------
  226. ; DATA AREA
  227. bmptoimg_data_area_bps      dd 0
  228. bmptoimg_data_area_dwps     dd 0
  229. bmptoimg_data_area_eop      dd 0
  230. bmp_load_area               dd 0
  231. img_dest_area               dd 0
  232. bmp_bits_per_pixel          dw 0
  233. bmp_first_structure_size    dd 0
  234. bmp_bytes_per_string        dd 0
  235.  
  236. end_bmp:
  237.  
  238. ret
  239.  
  240. ;***************************************************************************
  241. ;*******************CODING BMP FILE(1,4,8,24 bits)**************************
  242. ;***************************************************************************
  243.  
  244. ;-------------------------autor andrew_programmer---------------------------
  245.  
  246. coding_bmp:
  247.  
  248.          mov [PointerToImage],ebx
  249.          mov [WhereCodingBMP],ecx
  250.          mov [BmpPalette],edx
  251.          mov [Bmp_SizeX],esi
  252.          mov [Bmp_SizeY],edi
  253.          ;**********************************************
  254.          ;******************1 bit BMP*******************
  255.          ;**********************************************
  256.          cmp eax,2
  257.          ja no_monohrom_colors
  258.          mov esi,[BmpPalette]
  259.          mov edi,[WhereCodingBMP]
  260.          add edi,54
  261.          mov eax,[esi]   ;first color
  262.          mov ebx,[esi+4] ;second color
  263.          mov [edi],eax
  264.          mov [edi+4],ebx
  265.  
  266.          ;coding image to bmp 1 bit format
  267.          mov esi,[PointerToImage]
  268.          mov edx,[WhereCodingBMP]
  269.          mov ebx,[Bmp_SizeX]
  270.          add ebx,31                ;picture_size_x+31
  271.          shr ebx,5                 ;((picture_size_x)+31)/32
  272.          mov [Bmp_doublewords],ebx ;double words in string
  273.          shl ebx,2
  274.          mov [Bmp_bytes_per_string],ebx ;bytes per string
  275.          mov ecx,[Bmp_SizeY]
  276.          dec ecx
  277.          imul ebx,ecx
  278.          add edx,54+8
  279.          add edx,ebx                ;in edx pointer to area for coding
  280.  
  281.          mov ebp,[Bmp_bytes_per_string]
  282.  
  283.          mov ebx,[Bmp_SizeY]
  284.          mov esi,[PointerToImage]
  285.          mov edi,edx
  286.  
  287.          mov edx,[Bmp_SizeX]
  288.          lea edx,[edx+edx*2]
  289.  
  290.          mov [Bmp_Counter],7
  291.          and [Bmp_Counter2],0
  292.          copy_lines_1:
  293.  
  294.            push esi
  295.            mov ecx,[Bmp_bytes_per_string]
  296.            shl ecx,3          ;(Bmp_bytes_per_string)*8
  297.  
  298.            rep_movsb_1:
  299.  
  300.               mov eax,[esi]
  301.               and eax,0xffffff
  302.               push esi
  303.               push ecx
  304.               push ebx
  305.               mov esi,[BmpPalette]
  306.               xor ecx,ecx
  307.                 find_color_in_palette_1:
  308.                    mov ebx,[esi]
  309.                    and ebx,0xffffff
  310.                    cmp eax,ebx           ;color fined ?
  311.                    je color_fined_1
  312.                    add esi,4
  313.                    inc ecx
  314.                    cmp ecx,256
  315.                    jl find_color_in_palette_1
  316.                    color_fined_1:
  317.               mov [Bmp_Counter3],ecx     ;number color in palette
  318.               pop ebx
  319.               pop ecx
  320.               pop esi
  321.               mov eax,[Bmp_Counter3]
  322.  
  323.               test eax,eax
  324.               jz no_change_bit_in_byte
  325.  
  326.               push ecx
  327.               mov ecx,[Bmp_Counter]
  328.               bts [Bmp_Counter2],ecx
  329.               pop ecx
  330.  
  331.               no_change_bit_in_byte:
  332.  
  333.               dec [Bmp_Counter]
  334.               jns no_minus_in_counter
  335.  
  336.               push eax
  337.               mov eax,[Bmp_Counter2]
  338.               mov [edi],al
  339.               inc edi
  340.               mov [Bmp_Counter],7
  341.               and [Bmp_Counter2],0     ;obnulyaem byte
  342.               pop eax
  343.  
  344.               no_minus_in_counter:
  345.  
  346.               add esi,3
  347.            dec ecx
  348.            jnz rep_movsb_1
  349.            pop esi
  350.  
  351.          add esi,edx
  352.          sub edi,ebp
  353.          sub edi,ebp
  354.  
  355.          dec ebx
  356.          jnz copy_lines_1
  357.  
  358.          mov edi,[WhereCodingBMP]
  359.          mov ebx,[Bmp_bytes_per_string]
  360.          imul ebx,[Bmp_SizeY]
  361.          add ebx,(54+8)
  362.  
  363.          ;crate list of bmp description
  364.          mov [edi],word 'BM'
  365.          mov [edi+2],ebx
  366.          mov [edi+10],dword 54+8 ;where bigin bmp imige
  367.          mov [edi+14],dword 40
  368.          mov edx,[Bmp_SizeX]
  369.          mov ecx,[Bmp_SizeY]
  370.          mov [edi+18],edx    ;picture size x
  371.          mov [edi+22],ecx    ;picture size y
  372.          mov [edi+26],word 1
  373.          mov [edi+28],word 1 ;bits per pixel
  374.          mov [edi+30],dword 0
  375.          mov edx,[Bmp_bytes_per_string]
  376.          imul edx,ecx
  377.          mov [edi+34],edx
  378.          mov [edi+38],dword 0
  379.          mov [edi+42],dword 0
  380.          mov [edi+46],dword 0
  381.  
  382.          ret
  383.  
  384.          no_monohrom_colors:
  385.  
  386.          ;**********************************************
  387.          ;*****************4 bits BMP*******************
  388.          ;**********************************************
  389.          cmp eax,16
  390.          ja no_16_colors
  391.          ;copy 16 colors palette
  392.          mov esi,[BmpPalette]
  393.          mov edi,[WhereCodingBMP]
  394.          add edi,54
  395.          mov ecx,16
  396.          rep movsd
  397.  
  398.          ;coding image to bmp 4 bits format
  399.          mov esi,[PointerToImage]
  400.          mov edx,[WhereCodingBMP]
  401.          mov ebx,[Bmp_SizeX]
  402.          shl ebx,2             ;4*(picture_size_x)
  403.          add ebx,31            ;4*(picture_size_x)+31
  404.          shr ebx,5             ;(4*(picture_size_x)+31)/32
  405.          mov [Bmp_doublewords],ebx ;double words in string
  406.          shl ebx,2
  407.          mov [Bmp_bytes_per_string],ebx ;bytes per string
  408.          mov ecx,[Bmp_SizeY]
  409.          dec ecx
  410.          imul ebx,ecx
  411.          add edx,54+64
  412.          add edx,ebx
  413.  
  414.          mov ebp,[Bmp_bytes_per_string]
  415.  
  416.          mov ebx,[Bmp_SizeY]
  417.          mov [Bmp_Counter2],ebx
  418.  
  419.          mov edi,edx
  420.  
  421.          xor ebx,ebx
  422.          copy_lines_4:
  423.  
  424.          mov ecx,[Bmp_bytes_per_string]
  425.          shl ecx,1
  426.  
  427.          and [Bmp_Counter3],0
  428.          push esi
  429.  
  430.           rep_movsb_4:
  431.           mov eax,[esi]
  432.           and eax,0xffffff
  433.  
  434.             mov [Bmp_save1],esi
  435.             mov [Bmp_save2],ecx
  436.             mov [Bmp_save3],ebx
  437.             mov esi,[BmpPalette]
  438.             xor ecx,ecx
  439.              find_color_in_palette_:
  440.                mov ebx,[esi]
  441.                and ebx,0xffffff
  442.                cmp eax,ebx           ;color fined ?
  443.                je color_fined_
  444.                  add esi,4
  445.                  inc ecx
  446.                cmp ecx,16
  447.                jl find_color_in_palette_
  448.                color_fined_:
  449.               mov [Bmp_Counter],ecx     ;number color in palette
  450.             mov esi,[Bmp_save1]
  451.             mov ecx,[Bmp_save2]
  452.             mov ebx,[Bmp_save3]
  453.  
  454.           xor eax,eax
  455.           mov eax,[Bmp_Counter]
  456.           shl bl,4
  457.           add bl,al
  458.  
  459.            mov eax,[Bmp_Counter3]
  460.            and eax,1b
  461.            test eax,eax              ;next block ready ?
  462.            jz no_ready
  463.             mov [edi],bl              ;4 bit color
  464.             inc edi
  465.            no_ready:
  466.  
  467.           add esi,3
  468.           inc [Bmp_Counter3]
  469.  
  470.           dec ecx
  471.           jnz rep_movsb_4
  472.  
  473.          pop esi
  474.  
  475.          add esi,[Bmp_SizeX]
  476.          add esi,[Bmp_SizeX]
  477.          add esi,[Bmp_SizeX]
  478.  
  479.          sub edi,ebp
  480.          sub edi,ebp
  481.  
  482.          dec [Bmp_Counter2]
  483.          jnz copy_lines_4
  484.  
  485.          ;total size of bmp file
  486.          mov edi,[WhereCodingBMP]
  487.          mov ebx,[Bmp_bytes_per_string]
  488.          imul ebx,[Bmp_SizeY]
  489.          add ebx,(54+64)
  490.  
  491.          ;crate list of bmp description
  492.          mov [edi],word 'BM'
  493.          mov [edi+2],ebx
  494.          mov [edi+10],dword 54+64
  495.          mov [edi+14],dword 40
  496.          mov edx,[Bmp_SizeX]
  497.          mov ecx,[Bmp_SizeY]
  498.          mov [edi+18],edx
  499.          mov [edi+22],ecx
  500.          mov [edi+26],word 1
  501.          mov [edi+28],word 4
  502.          mov [edi+30],dword 0
  503.          mov edx,[Bmp_bytes_per_string]
  504.          imul edx,ecx
  505.          mov [edi+34],edx
  506.          mov [edi+38],dword 0
  507.          mov [edi+42],dword 0
  508.          mov [edi+46],dword 0
  509.  
  510.          ret
  511.          no_16_colors:
  512.  
  513.          ;**********************************************
  514.          ;******************8 bits BMP******************
  515.          ;**********************************************
  516.  
  517.          cmp eax,256
  518.          ja no_8_bits_per_pixel
  519.          ;copy palette
  520.          mov esi,[BmpPalette]
  521.          mov edi,[WhereCodingBMP]
  522.          add edi,54
  523.          mov ecx,256
  524.          rep movsd
  525.  
  526.          ;coding image to bmp 8 bits format
  527.          mov esi,[PointerToImage]
  528.          mov edx,[WhereCodingBMP]
  529.          mov ebx,[Bmp_SizeX]
  530.          shl ebx,3             ;8*(picture_size_x)
  531.          add ebx,31            ;8*(picture_size_x)+31
  532.          shr ebx,5             ;(8*(picture_size_x)+31)/32
  533.          mov [Bmp_doublewords],ebx ;double words in string
  534.          shl ebx,2
  535.          mov [Bmp_bytes_per_string],ebx ;bytes per string
  536.  
  537.          mov ecx,[Bmp_SizeY]
  538.          dec ecx
  539.          imul ebx,ecx
  540.          add edx,(1024+54)
  541.          add edx,ebx           ;in edx pointer to copy bitmap arrea
  542.  
  543.          mov ebp,[Bmp_bytes_per_string]
  544.          shl ebp,1
  545.  
  546.          mov ebx,[Bmp_SizeY]
  547.          mov edi,edx
  548.  
  549.          copy_lines_8:
  550.  
  551.          mov ecx,[Bmp_bytes_per_string]
  552.          mov [Bmp_save1],esi
  553.           rep_movsb_8:
  554.           mov eax,[esi]
  555.           and eax,0xffffff
  556.           push esi
  557.           push ecx
  558.           push ebx
  559.            mov esi,[BmpPalette]
  560.            xor ecx,ecx
  561.             find_color_in_palette:
  562.             mov ebx,[esi]
  563.             and ebx,0xffffff
  564.             cmp eax,ebx           ;color fined ?
  565.             je color_fined
  566.             add esi,4
  567.             inc ecx
  568.             cmp ecx,256
  569.             jl find_color_in_palette
  570.             color_fined:
  571.             mov [Bmp_Counter],ecx     ;number color in palette
  572.           pop ebx
  573.           pop ecx
  574.           pop esi
  575.           mov eax,[Bmp_Counter]
  576.           mov [edi],al            ;8 bit color
  577.           add esi,3
  578.           inc edi
  579.  
  580.           dec ecx
  581.           jnz rep_movsb_8
  582.  
  583.          mov esi,[Bmp_save1]
  584.  
  585.          add esi,[Bmp_SizeX]
  586.          add esi,[Bmp_SizeX]
  587.          add esi,[Bmp_SizeX]
  588.  
  589.          sub edi,ebp
  590.          dec ebx
  591.          jnz copy_lines_8
  592.  
  593.          ;total size of bmp file
  594.          mov edi,[WhereCodingBMP]
  595.          mov ebx,[Bmp_bytes_per_string]
  596.          imul ebx,[Bmp_SizeY]
  597.          add ebx,54+1024
  598.  
  599.          ;crate list of bmp description
  600.          mov [edi],word 'BM'
  601.          mov [edi+2],ebx
  602.          mov [edi+10],dword 54+1024
  603.          mov [edi+14],dword 40
  604.          mov edx,[Bmp_SizeX]
  605.          mov ecx,[Bmp_SizeY]
  606.          mov [edi+18],edx
  607.          mov [edi+22],ecx
  608.          mov [edi+26],word 1
  609.          mov [edi+28],word 8
  610.          mov [edi+30],dword 0
  611.          mov edx,[Bmp_bytes_per_string]
  612.          imul edx,ecx
  613.          mov [edi+34],edx
  614.          mov [edi+38],dword 0
  615.          mov [edi+42],dword 0
  616.          mov [edi+46],dword 0
  617.  
  618.          ret
  619.          no_8_bits_per_pixel:
  620.  
  621.          ;**********************************************
  622.          ;*******************24 bit BMP*****************
  623.          ;**********************************************
  624.  
  625.          cmp eax,256
  626.          jle no_32_bits_per_pixel
  627.          ;copy picture
  628.          mov esi,[PointerToImage]
  629.          mov edx,[WhereCodingBMP]
  630.          mov ebx,[Bmp_SizeX]
  631.          shl ebx,3             ;8*(picture_size_x)
  632.          lea ebx,[ebx+ebx*2]   ;3*8*(picture_size_x)
  633.          add ebx,31            ;3*8*(picture_size_x)+31
  634.          shr ebx,5             ;(3*8*(picture_size_x)+31)/32
  635.          mov [Bmp_doublewords],ebx ;double words in string
  636.          shl ebx,2
  637.          mov [Bmp_bytes_per_string],ebx ;bytes per string
  638.          mov ecx,[Bmp_SizeY]
  639.          dec ecx
  640.          imul ebx,ecx
  641.          add edx,54
  642.          add edx,ebx         ;in edx pointer to start of copy bit map
  643.  
  644.          mov ebp,[Bmp_bytes_per_string]
  645.          shl ebp,1
  646.  
  647.          mov ebx,[Bmp_SizeY]
  648.  
  649.          mov esi,[PointerToImage]
  650.          mov edi,edx
  651.  
  652.          mov edx,[Bmp_SizeX]
  653.          lea edx,[edx+edx*2]
  654.  
  655.          copy_lines_24:
  656.  
  657.            push esi
  658.            mov ecx,[Bmp_doublewords]
  659.            rep_movsb_24:
  660.               mov eax,[esi]
  661.               mov [edi],eax
  662.            add esi,4
  663.            add edi,4
  664.            dec ecx
  665.            jnz rep_movsb_24
  666.            pop esi
  667.  
  668.          add esi,edx
  669.          sub edi,ebp
  670.          dec ebx
  671.          jnz copy_lines_24
  672.  
  673.          ;total size of bmp fille
  674.          mov edi,[WhereCodingBMP]
  675.          mov ebx,[Bmp_bytes_per_string]
  676.          imul ebx,[Bmp_SizeY]
  677.          add ebx,54
  678.  
  679.          ;write info to structure of bmp file
  680.          mov [edi],word 'BM'
  681.          mov [edi+2],ebx
  682.          mov [edi+10],dword 54    ;where begin bmp imige
  683.          mov [edi+14],dword 40    ;total size of structure number two
  684.          mov edx,[Bmp_SizeX]
  685.          mov ecx,[Bmp_SizeY]
  686.          mov [edi+18],edx
  687.          mov [edi+22],ecx
  688.          mov [edi+26],word 1
  689.          mov [edi+28],word 24     ;bytes per pixel
  690.          mov [edi+30],dword 0
  691.          mov edx,[Bmp_bytes_per_string]
  692.          imul edx,ecx
  693.          mov [edi+34],edx         ;size of bmp image
  694.          mov [edi+38],dword 0
  695.          mov [edi+42],dword 0
  696.          mov [edi+46],dword 0
  697.          ret
  698.          no_32_bits_per_pixel:
  699.  
  700.  
  701.          ret
  702.  
  703. PointerToImage       dd 0
  704. WhereCodingBMP       dd 0
  705. BmpPalette           dd 0
  706. Bmp_SizeX            dd 0
  707. Bmp_SizeY            dd 0
  708. Bmp_Counter          dd 0
  709. Bmp_Counter2         dd 0
  710. Bmp_Counter3         dd 0
  711. Bmp_save1            dd 0
  712. Bmp_save2            dd 0
  713. Bmp_save3            dd 0
  714. Bmp_bytes_per_string dd 0
  715. Bmp_doublewords      dd 0