mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-11-27 19:29:46 +03:00
630234432f
git-svn-id: svn://kolibrios.org@109 a494cfbc-eb01-0410-851d-a64ba20cac60
100 lines
2.3 KiB
PHP
100 lines
2.3 KiB
PHP
Color db 0
|
||
Counter db 0
|
||
LastColor db 0
|
||
SizeFile dd 0
|
||
;LitlCounter db 0
|
||
;LitlColor db 0
|
||
save_image:
|
||
;mov esi,addres_of_file_which_need_compress
|
||
;mov edi,addres_where_need_to_save_compressed_file
|
||
;mov ecx,size_of_file_which_need_compress
|
||
mov dl,byte [esi]
|
||
and dl,0xff
|
||
mov [LastColor],dl
|
||
mov [Counter],byte 1
|
||
mov [SizeFile],0
|
||
xor edx,edx
|
||
inc esi
|
||
NextColor:;ç¨â ¥¬ ®¢ë© 梥⠨§ â ¡«¨æë
|
||
mov dl,byte [esi]
|
||
and dl,0xf
|
||
mov [Color],dl
|
||
cmp dl,[LastColor]
|
||
jne Different
|
||
;㢥«¨ç¨¢ ¥¬ áç¥â稪 1 ¨ ᬮâਬ ¥£® § 票¥
|
||
inc [Counter]
|
||
cmp [Counter],16
|
||
jl total
|
||
;áç¥â稪 à ¢¥ 16,§ ç¨â 㦮 á®åà ¨âì ¯®á«¥¤®¢ ⥫ì®áâì
|
||
dec [Counter]
|
||
jmp Different
|
||
;’¥¯¥àì ⥪ã騩 梥â áâ « áâ àë¬,¯®í⮬ã á®åà ¨¬ ¥£® ª ª áâ àë©.
|
||
;Ž¡ã«¨¬ (ᤥ« ¥¬ à ¢ë¬ 1) áç¥â稪 ¯®¢â®à¥¨© 梥â (counter)
|
||
xor eax,eax
|
||
and [Counter],0
|
||
mov al,[Color]
|
||
mov [LastColor],al
|
||
xor eax,eax
|
||
jmp total
|
||
Different:;¯à®ç¨â ë© æ¢¥â ¥ ᮢ¯ ¤ ¥â á® áâ àë¬
|
||
;§ ç¨â 㦮 á®åà ¨âì áâ àë© ¨ ãáâ ®¢¨âì § ç¥¨ï ¤«ï ®¢®£®
|
||
;
|
||
;á®åà 塞 áâ àë© æ¢¥â
|
||
dec [Counter]
|
||
call SaveinByte
|
||
;add [SizeFile],1
|
||
inc edi
|
||
;ãáâ ¢«¨¢ ¥¬ § 票ï ⥪ã饣® 梥⠪ ª áâ ண®
|
||
mov dl,[Color]
|
||
mov [LastColor],dl
|
||
mov [Counter],1
|
||
total:
|
||
xor edx,edx
|
||
mov dl,[Color]
|
||
mov [LastColor],dl
|
||
inc esi
|
||
dec ecx
|
||
cmp ecx,0
|
||
jne NextColor
|
||
;áç¥â稪 ¬®¦¥â ¡ëâì ¥¯ãá⮩,¯®í⮬ã çâ®¡ë ¥ â¥àïâì ¡ ©â®¢
|
||
;á®åà ¨¬ § 票¥ áç¥â稪 ¨ ¯®¢â®à塞®¥ § 票¥
|
||
call SaveinByte
|
||
ret
|
||
SaveinByte:xor eax,eax
|
||
xor ebx,ebx
|
||
mov al,[Counter]
|
||
shl al,4
|
||
mov bl,[LastColor]
|
||
or al,bl
|
||
mov [edi],al
|
||
inc [SizeFile]
|
||
ret
|
||
;-----------------------------------------------------------------------
|
||
LitlCounter db 0
|
||
LitlColor db 0
|
||
unpakin:
|
||
xor edx,edx
|
||
NextLitlColor:xor edx,edx
|
||
mov dl,byte[esi]
|
||
xor eax,eax
|
||
xor ebx,ebx
|
||
mov al,dl
|
||
mov bl,al
|
||
shr al,4
|
||
and al,0xf
|
||
mov [LitlCounter],al
|
||
and bl,0xf
|
||
mov [LitlColor],bl
|
||
xor eax,eax
|
||
xor ebx,ebx
|
||
;-------------------------------
|
||
mov al,[LitlColor]
|
||
beg:mov [edi],al
|
||
add edi,1
|
||
dec [LitlCounter]
|
||
cmp [LitlCounter],-1
|
||
jne beg
|
||
inc esi
|
||
dec ecx
|
||
jnz NextLitlColor
|
||
ret |