18,7 → 18,7 |
;;================================================================================================;; |
|
include 'pcx.inc' |
;include '../../../../system/board/trunk/debug.inc' |
include '../../../../system/board/trunk/debug.inc' |
|
;;================================================================================================;; |
proc img.is.pcx _data, _length ;//////////////////////////////////////////////////////////////////;; |
42,8 → 42,8 |
jne .is_not_pcx |
cmp [edi+pcx_header.encoding], 1 |
jne .is_not_pcx |
; cmp [esi+pcx_header.reserved], 1 |
; jne .is_not_pcx |
cmp [esi+pcx_header.reserved], 0 |
jne .is_not_pcx |
|
add edi, pcx_header.filler |
xor al, al |
54,19 → 54,9 |
jnz .is_not_pcx |
|
.is_pcx: |
;pusha |
;dps 'is_pcx' |
;newline |
;popa |
inc eax |
pop edi ecx |
ret |
|
.is_not_pcx: |
;pusha |
;dps 'is_not_pcx' |
;newline |
;popa |
pop edi ecx |
ret |
|
93,6 → 83,7 |
stxsize rw 1 |
stysize rw 1 |
total_bpl rd 1 |
total_bpl_tmp rd 1 |
line_begin rd 1 |
retvalue rd 1 |
|
102,6 → 93,14 |
|
mov esi, [_data] |
|
cmp [esi+pcx_header.bpp], 1 |
jz monochrome |
cmp byte[esi+pcx_header.nplanes], 3 |
jnz indexed |
|
|
|
_24bit: |
xor eax, eax |
mov al, byte[esi+pcx_header.nplanes] |
mov [nplanes], eax |
196,8 → 195,234 |
popa |
mov eax, [retvalue] |
ret |
|
indexed: |
|
xor eax, eax |
mov al, byte[esi+pcx_header.nplanes] |
mov [nplanes], eax |
mul word[esi+pcx_header.bpl] |
mov [total_bpl], eax |
|
movzx eax, word[esi+pcx_header.xmax] |
inc ax |
sub ax, word[esi+pcx_header.xmin] |
mov [xsize], ax |
|
movzx ebx, word[esi+pcx_header.ymax] |
inc bx |
sub bx, word[esi+pcx_header.ymin] |
mov [ysize], bx |
|
stdcall img.create, eax, ebx, Image.bpp8 |
mov [retvalue], eax |
test eax, eax |
jz .quit |
|
mov esi, [_data] |
add esi, [_length] |
sub esi, 768 |
mov edi, [eax+Image.Palette] |
mov ecx, 256 |
@@: |
mov ebx, [esi] |
and ebx, 0x00ffffff |
bswap ebx |
shr ebx, 8 |
mov [edi], ebx |
add edi, 4 |
add esi, 3 |
dec ecx |
jnz @b |
|
movzx ebx, [xsize] |
movzx ecx, [ysize] |
mov edx, [eax+Image.Data] |
|
rol ebx, 16 |
or ebx, ecx |
xor ebx, [edx] |
mov [eax+Image.Checksum], ebx |
|
|
mov esi, [_data] |
add esi, 128 |
mov edi, [retvalue] |
mov edi, [edi+Image.Data] |
|
.begin: |
mov eax, [_data] |
mov ax, word[eax+pcx_header.bpl] |
.decode: |
mov dl, byte[esi] |
inc esi |
mov [buf], dl |
and dl, 0xC0 |
cmp dl, 0xC0 |
jne @f |
mov dl, [buf] |
and dl, 0x3F |
mov dh, [esi] |
inc esi |
|
.write_sequence: |
mov [edi], dh |
inc edi |
dec ax |
dec dl |
jnz .write_sequence |
|
test ax, ax |
jz .end_line |
jmp .decode |
@@: |
mov dl, byte[buf] |
mov [edi], dl |
inc edi |
dec ax |
jz .end_line |
jmp .decode |
|
.end_line: |
dec word[ysize] |
jz .quit |
jmp .begin |
|
.quit: |
popa |
mov eax, [retvalue] |
ret |
|
|
monochrome: |
|
xor eax, eax |
mov ax, word[esi+pcx_header.bpl] |
mov [total_bpl], eax |
|
movzx eax, word[esi+pcx_header.xmax] |
inc ax |
sub ax, word[esi+pcx_header.xmin] |
mov [xsize], ax |
|
movzx ebx, word[esi+pcx_header.ymax] |
inc bx |
sub bx, word[esi+pcx_header.ymin] |
mov [ysize], bx |
|
stdcall img.create, eax, ebx, Image.bpp8 |
mov [retvalue], eax |
test eax, eax |
jz .quit |
|
mov edi, [eax+Image.Palette] |
mov [edi], dword 0x00000000 |
mov [edi+4], dword 0x00ffffff |
|
movzx ebx, [xsize] |
movzx ecx, [ysize] |
mov edx, [eax+Image.Data] |
|
rol ebx, 16 |
or ebx, ecx |
xor ebx, [edx] |
mov [eax+Image.Checksum], ebx |
|
|
mov esi, [_data] |
add esi, 128 |
mov edi, [retvalue] |
mov edi, [edi+Image.Data] |
|
.begin: |
mov eax, [total_bpl] |
mov [total_bpl_tmp], eax |
mov ax, [xsize] |
|
.decode: |
|
mov dh, byte[esi] |
inc esi |
mov [buf], dh |
and dh, 0xC0 |
cmp dh, 0xC0 |
je .cycle1 |
mov dh, 1 |
mov dl, [buf] |
jmp .exit1 |
.cycle1: |
mov dh, [buf] |
and dh, 0x3F |
mov dl, byte[esi] |
inc esi |
.exit1: |
push eax |
xor eax, eax |
mov al, dh |
sub [total_bpl_tmp], eax |
pop eax |
|
|
.write_sequence: |
mov ecx, 7 |
.go: |
bt edx, ecx |
jnc @f |
mov [edi], byte 0x01 |
jmp .later |
@@: |
mov [edi], byte 0x00 |
.later: |
inc edi |
dec ax |
jnz .lol |
@@: |
cmp [total_bpl_tmp], 0 |
jng @f |
|
mov dh, byte[esi] |
inc esi |
mov [buf], dh |
and dh, 0xC0 |
cmp dh, 0xC0 |
je .cycle2 |
mov dh, 1 |
mov dl, [buf] |
jmp .exit2 |
.cycle2: |
mov dh, [buf] |
and dh, 0x3F |
mov dl, byte[esi] |
inc esi |
.exit2: |
push eax |
xor eax, eax |
mov al, dh |
sub [total_bpl_tmp], eax |
pop eax |
|
jmp @b |
@@: |
dec word[ysize] |
jnz .begin |
jmp .quit |
.lol: |
dec ecx |
cmp ecx, -1 |
jne .go |
dec dh |
jnz .write_sequence |
jmp .decode |
|
.quit: |
popa |
mov eax, [retvalue] |
ret |
|
endp |
|
|
|
;;================================================================================================;; |
proc img.encode.pcx _img, _p_length, _options ;///////////////////////////////////////////////////;; |
;;------------------------------------------------------------------------------------------------;; |