;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.
.model small
.stack 100h
.data
MSG db "Hello World!$"
blank_str db "????????????$"
CRLF db 0Dh,0Ah,'$'
.code
main proc
mov ax, @data
mov ds, ax
mov dx, offset blank_str
mov ah, 9
int 21h
mov dx, offset CRLF ;print the Carriage Return and Linefeed
mov ah, 9
int 21h
mov si, offset MSG
mov di, offset blank_str
mov ax, ds
mov es, ax
mov cx, 13 ;strings we defined are 13 byte long
cld
rep movsb
mov dx, offset blank_str
mov ah, 9
int 21h
mov ah, 4Ch
mov al, 0
int 21h
main endp
end main