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

;SUB RELPCOPYTRANS(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 RELPCOPYTRANS
RELPCOPYTRANS 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

LBL_PLOT_PIXEL:
        MOV CL,DS:[SI]          ;CHECK SOURCE PIXEL
        CMP CL,0                ;IS IT ZERO?
        JZ LBL_SKIP_PIXEL       ;YES THEN SKIP
        MOV ES:[DI],CL          ;PLOT IF NOT ZERO
LBL_SKIP_PIXEL:
        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

RELPCOPYTRANS ENDP

END

