        name    memcpyb ; copy a string of memory one byte at a time
ARGDO   equ     word ptr [bp+06h]
ARGDS   equ     word ptr [bp+08h]
ARGSO   equ     word ptr [bp+0ah]
ARGSS   equ     word ptr [bp+0ch]
ARGN    equ     word ptr [bp+0eh]
MEMB_TEXT       segment byte public 'CODE'
        public  _memcpyb
        assume  cs:MEMB_TEXT
_memcpyb      proc    far
        push    bp
        mov     bp,sp
        push    si
        push    di
        push    ds
        pushf

        cld     ; top to bottom move
        mov     ax,ARGDS
        mov     es,ax
        mov     ax,ARGSS
        mov     ds,ax
        mov     ax,ARGDO
        mov     di,ax
        mov     si,ARGSO
        mov     cx,ARGN
        rep movsb

        mov     dx,es
        popf
        pop     ds
        pop     di
        pop     si
        pop     bp
        ret     
_memcpyb      endp
        public  _memcpybr
        assume  cs:MEMB_TEXT
_memcpybr     proc    far
        push    bp
        mov     bp,sp
        push    si
        push    di
        push    ds
        pushf

        std     ; bottom to top move
        mov     ax,ARGDS
        mov     es,ax
        mov     ax,ARGSS
        mov     ds,ax
        mov     ax,ARGDO
        mov     di,ax
        mov     si,ARGSO
        mov     cx,ARGN
        rep movsb

        mov     dx,es
        popf
        pop     ds
        pop     di
        pop     si
        pop     bp
        ret     
_memcpybr      endp
MEMB_TEXT       ends
        end
