home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Underground
/
UNDERGROUND.ISO
/
graphic
/
fade.asm
< prev
next >
Wrap
Assembly Source File
|
1995-07-28
|
2KB
|
75 lines
data segment public
extrn colors:word
data ends
code segment public
assume cs:code,ds:data
public fade_set,fade_ResetPic
col db 0 ;code segment pendant to colors
fade_set proc pascal near source:dword, start:word, y:word, height:word
mov ax,colors ;colors entered in code segment variable col
mov col,al
push ds
mov ax,word ptr source + 2 ;source pointer to ds:si
mov ds,ax
mov si,word ptr source
mov ax,320 ;start address within the source image
mul start
add si,ax
mov ax,0a000h ;destination pointer 0a000:0 to es:di
mov es,ax
mov ax,320 ;start address within the destination image
mul y
mov di,ax
mov ax,320 ;convert height to number bytes
imul height
mov cx,ax
lp: ;main loop
lodsb ;destination value in al
mul col ;calculate new color value
add al,es:[di] ;add current value
add al,col
stosb ;and write back
dec cx ;all pixels copied ?
jne lp
pop ds
ret
fade_set endp
fade_ResetPic proc pascal far y:word, height:word
mov ax,0a000h ;VGA address 0a000:0 to es:di
mov es,ax
mov ax,320 ;take row y into consideration
mul y
mov di,ax
mov ax,320 ;calculate number bytes to be processed
mul height
mov cx,ax
res_lp:
mov al,es:[di] ;get value
xor ah,ah ;clear ah during division !
div byte ptr colors ;calculate block number
dec al ;remove reset block
stosb ;write back
dec cx ;all pixels finished ?
jne res_lp ;no, then continue
ret
fade_ResetPic endp
code ends
end