;copy string #2
;same as COPY STRING #1 except that the Method of copying is different
;we use REP MOVSB. ;REP repeats the proceding data-transfer instruction until a certain condition is meet. Here it depends on the cx not yet being zero.

segment stack stack
resb 100h

segment data
MSG db "Hello World!$"
blank_str db "????????????$"
CRLF db 0Dh,0Ah,'$'

segment code

..start:

mov ax, data
mov ds, ax

mov dx, blank_str
mov ah, 9
int 21h

mov dx, CRLF                 ;print the Carriage Return and Linefeed
mov ah, 9
int 21h

mov si, MSG
mov di, blank_str

mov ax, ds
mov es, ax

mov cx, 13                 ;strings we defined are 13 byte long

cld
rep movsb

mov dx, blank_str
mov ah, 9
int 21h

mov ah, 4Ch
mov al, 0
int 21h