Logo 
Search:

Assembly Language Articles

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

A Program to copy one string to another

Posted By: Thomas Evans     Category: Assembly Language     Views: 5123

A Program to copy one string to another.

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

.MODEL SMALL
.DATA
        STR1    DB      5   DUP(' '),'$'
        STR2    DB      5   DUP(' '),'$'
        NL      DB      0DH,0AH,'$'
.CODE

MAIN    PROC

        MOV AX,@DATA
        MOV DS,AX

        LEA SI,STR1
        LEA DI,STR2

        MOV AH,01H

AGAIN:
        INT 21H

        CMP AL,0DH
        JE  BAK
        MOV [SI],AL
        INC SI
        JMP AGAIN
      
BAK:
        MOV AL,'$'
        MOV [SI],AL

        MOV AH,09H

        LEA DX,NL
        INT 21H
        LEA SI,STR1
        MOV CX,LENGTH STR1
        ADD CX,1
DOTHIS:
        
        MOV AL,[SI]
        MOV [DI],AL

        INC DI
        INC SI
        LOOP DOTHIS

        MOV AL,'$'
        MOV [DI],AL

        MOV AH,09H
        LEA DX,NL
        INT 21H

        LEA DX,STR2
        INT 21H

        MOV AH,4CH
        INT 21H

MAIN    ENDP
END   MAIN



OUTPUT
***********

Z:\SYSTEM~1\AS1>ex8
hello

hello
  
Share: 


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

Thomas Evans
Thomas Evans author of A Program to copy one string to 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!