home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-387-Vol-3of3.iso
/
p
/
pchdemo.zip
/
SOURCEFA.ZIP
/
CONVERT.ASM
< prev
next >
Wrap
Assembly Source File
|
1992-10-28
|
2KB
|
160 lines
; Assemblerroutine CONVERT.ASM
;
; Mit dieser Routine werden Pixel von YUV in 15 Bit RGB konvertiert.
;
; Die Aufteilung ist 0RRRRRGGGGGBBBBB
;
; Folgende Parameter müssen übergeben werden:
;
; CX = Anzahl der Pixel
; DS:SI = Leseadresse der Pixel
; ES:DI = Schreibadresse der Pixel
;
.186
code segment public
assume cs:code
public convert
convert proc near
jmp start
mode db 0
y1 db 0
y2 db 0
y3 db 0
y4 db 0
ry dw 0
gy dw 0
by dw 0
start:
mov cs:mode,ah
push ax
push bx
push cx
push dx
push si
push di
push ds
push es
shr cx,1
shr cx,1
st1:
call conv
loop st1
pop es
pop ds
pop di
pop si
pop dx
pop cx
pop bx
pop ax
ret
conv:
push cx
lodsw
mov cs:y1,al
mov cs:y2,ah
lodsw
mov cs:y3,al
mov cs:y4,ah
xchg al,ah
ror al,1
ror al,1
ror al,1
rol ah,1
rol ah,1
and ax,0001110011100000b
add al,ah
not al
mov cs:ry,al ; R-Y
mov al,cs:y2
ror al,1
ror al,1
ror al,1
mov ah,cs:y1
rol ah,1
rol ah,1
and ax,0001110011100000b
add al,ah
not al
mov cs:by,al ; B-Y
mov ah,cs:ry
not ax
add al,ah
rcr al,1
mov cs:gy,al ; G-Y
mov cl,cs:y1
and cx,11111000b
call turn
mov cl,cs:y2
and cx,11111000b
call turn
mov cl,cs:y3
and cx,11111000b
call turn
mov cl,cs:y4
and cx,11111000b
call turn
pop cx
ret
turn:
mov ax,cx
add ax,cs:ry
sub ax,128
jnc sh21
mov ax,0
jmp sh22
sh21:
cmp ax,256
jb sh22
mov ax,255
sh22:
mov ah,al
shr ah,1
and ax,0111110000000000b
mov bx,cx
add bx,cs:gy
sub bx,128
jnc sh23
mov bx,0
jmp sh24
sh23:
cmp bx,256
jb sh24
mov bx,255
sh24:
shl bx,1
shl bx,1
and bx,0000001111100000b
add ax,bx
mov bx,cx
add bx,cs:by
sub bx,128
jnc sh25
mov bx,0
jmp sh26
sh25:
cmp bx,256
jb sh26
mov bx,255
sh26:
shr bl,1
shr bl,1
shr bl,1
and bx,0000000000011111b
add ax,bx
stosw
ret
convert endp
code ends
end