Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

Program to copy one string into another

Posted By: Martha Hughes     Category: Assembly Language     Views: 1988

Write a Program to copy one string into another.

Code for Program to copy one string into another in Assembly Language

 data segment
        str1    db      'Assembler$'
        str2    db     10 dup(' ')
        str3    db     10 dup(' ')
 data ends

 stack segment
 stack ends

 prnt macro msg
      lea dx,msg
      mov ah,09h
      int 21h

 endm

 code segment

        assume cs:code,ds:data,ss:stack
start:
        mov ax,data
        mov ds,ax
        mov es,ax
 main proc near

        call moveabyte
        call moveaword

        prnt str3
        mov ax,4c00h
        int 21h

 main endp

  moveabyte proc
        cld                 
        mov cx,10           
        lea si,str1         
        lea di,str2
        rep movsb    
        prnt str2
        ret
   moveabyte endp

   moveaword proc
        cld
        mov cx,5
        lea si,str1
        lea di,str3
        rep movsw
        ret
   moveaword endp
code ends

  END start

  
Share: 


Didn't find what you were looking for? Find more on Program to copy one string into another Or get search suggestion and latest updates.

Martha Hughes
Martha Hughes author of Program to copy one string into another is from London, United Kingdom.
 
View All Articles

 

Other Interesting Articles in Assembly Language:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!