- Move source code from `trunk` into program root directory. - Fix build and ASM files. - Translated a few RU comments to en_US. - Note: Line endings standardised from `CRLF` > `LF`, so best to view diffs with whitespace changes hidden. (Work towards #75, point 3) Reviewed-on: #244 Reviewed-by: Gleb Zaharov <risdeveau@codrs.ru> Reviewed-by: Burer <burer@kolibrios.org> Co-authored-by: Andrew <dent.ace@gmail.com> Co-committed-by: Andrew <dent.ace@gmail.com>
54 lines
1.1 KiB
PHP
54 lines
1.1 KiB
PHP
;-----------------------------------------------------------
|
|
;-------analizing picture to palette------------------------
|
|
;-----------------------------------------------------------
|
|
analizing_picture_to_palette:
|
|
mov eax,[Picture_SizeX]
|
|
mov ebx,[Picture_SizeY]
|
|
imul eax,ebx
|
|
mov ecx,eax
|
|
mov edx,[PointerToPicture]
|
|
mov esi,1 ;counter colors in palette
|
|
|
|
;put firs color of picture how one color in palette
|
|
mov ebp,[PointerToPalette]
|
|
mov eax,[edx]
|
|
and eax,0xffffff
|
|
mov [ebp],eax
|
|
|
|
analizing_to_palette:
|
|
mov eax,[edx]
|
|
and eax,0xffffff
|
|
mov edi,esi
|
|
mov ebp,[PointerToPalette]
|
|
|
|
next_color_in_palette:
|
|
mov ebx,[ebp]
|
|
and ebx,0xffffff
|
|
cmp ebx,eax ;this is color have in palette
|
|
je exit_loop_palette
|
|
|
|
add ebp,4
|
|
dec edi
|
|
jnz next_color_in_palette
|
|
|
|
inc esi
|
|
cmp esi,256 ;256 colors
|
|
ja more_than_256_colors
|
|
|
|
mov ebp,[PointerToPalette]
|
|
mov ebx,esi
|
|
dec ebx
|
|
shl ebx,2
|
|
add ebp,ebx
|
|
mov [ebp],ax
|
|
shr eax,16
|
|
mov [ebp+2],al
|
|
|
|
exit_loop_palette:
|
|
add edx,3
|
|
dec ecx
|
|
jnz analizing_to_palette
|
|
|
|
more_than_256_colors:
|
|
mov eax,esi
|
|
ret |