Copy using Movsb : Assembly Code

include irvine32.inc

.data
source byte "    my name is usman",0
dest   byte "    I am not a khan.",0
msg3 byte "After Copy: Copy source in dest String:  ",0
msg1 byte "String Named Source: ",0
msg2 byte "String Named Dest: ",0

.code
Main proc
call clrscr
call crlf
mov edx,offset msg1
call writestring
call crlf

call crlf
mov edx,offset source
call writestring
call crlf

call crlf
mov edx,offset msg2
call writestring
call crlf

call crlf
mov edx,offset dest
call writestring
call crlf
;-------------------------------
cld
mov esi,offset source
mov edi,offset dest
mov ecx,lengthof dest
rep movsb
;--------------------------------
call crlf
call crlf
mov edx,offset msg3
call writestring
call crlf

call crlf
mov edx,offset source
call writestring
call crlf

call crlf
mov edx,offset msg2
call writestring
call crlf

call crlf
mov edx,offset dest
call writestring
call crlf

exit
main endp
end main

0 comments:

Post a Comment

My Instagram