MODEL MEDIUM,BASIC
.STACK 20H
.386
.CODE

;SUB RELPCOPYTRANSB(BYVAL DESTSEG,BYVAL SRCSEG)
;STACK
;DEST SEG	=6
;SOURCE SEG	=4
;QB RETURN SEG	=2
;QB RETURN OFF	=0
;DS:SI		=SRC SEG:SRC OFF
;ES:DI		=DEST SEG:DEST OFF

PUBLIC RELPCOPYTRANSB
RELPCOPYTRANSB PROC

MOV AX,DS	;SAVE DS
MOV BX,BP	;SAVE BP
MOV BP,SP	;POINT STACK POINTER TO BP
MOV ES,[BP+6]	;POINT ADDRESS OF DEST TO ES
MOV DS,[BP+4]	;POINT ADDRESS OF SRC TO DS
XOR DI,DI	;ZERO OUT DEST OFFSET
XOR SI,SI	;ZERO OUT SRC OFFSET

;REGS FREE
;CX,DX

LBL_PLOT_PIXEL:
        MOV CL,DS:[SI]          ;CHECK SOURCE PIXEL
        CMP CL,0
        JE LBL_SKIP_0
        MOV CH,ES:[DI]          ;GET DEST PIXEL
        MOV DL,CL               ;SAVE ORIG COLOR TO DL
        AND CH,15               ;16 COLOR GRAD
        AND CL,15
        ADD CH,CL               ;ADD DEM 2GETHER
        SHR CH,1                ;DIV BY 2
        SUB DL,CL               ;GET THE BASE COLOR
        ADD DL,CH               ;ADD BLENDED PIX TO BASE COLOR
        MOV ES:[DI],DL          ;PLOT IT
LBL_SKIP_0:
        INC SI                  ;INCREMENT SOURCE OFFSET
        INC DI                  ;INCREMENT DEST OFFSET
        CMP DI,64000            ;IS DEST OFF < 64000 ?
JNE  LBL_PLOT_PIXEL

MOV DS,AX	;RESTORE DS
MOV BP,BX	;RESTORE BP
RET 4

RELPCOPYTRANSB ENDP

END

