kolibrios/programs/games/tanks/trunk/pixengin.inc
heavyiron 630234432f Changed structure of svn repository
git-svn-id: svn://kolibrios.org@109 a494cfbc-eb01-0410-851d-a64ba20cac60
2006-07-28 13:39:16 +00:00

100 lines
2.3 KiB
PHP
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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