Logo 
Search:

Assembly Language Articles

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

Program to check entered string is palindrome or not

Posted By: Adelino Fischer     Category: Assembly Language     Views: 7383

Write a Program to check entered string is palindrome or not.

Code for Program to check entered string is palindrome or not in Assembly Language

.MODEL SMALL
.DATA
        STR1 DB "BBC"
        LEN1 EQU $-STR1
        STR2 DB ?
.CODE
        MOV AX,@DATA
        MOV DS,AX

        LEA SI,STR1
        MOV CX,LEN1
        LEA DI,STR2

     L1:
        INC SI
        LOOP L1

     L2:
        MOV AL,[SI]
        MOV [DI],AL
        DEC SI
        INC DI
        INC CX
        CMP CX,LEN1
        JNE L2

        SUB DI,LEN1-1
        MOV CX,LEN1
        JMP L3

     L3:
        INC SI
        INC DI
        DEC CX

        CMP CX,0
        JE L5

        MOV AL,[SI-1]
        CMP AL,[DI-1]
        JE L3
        JNE L4

     L4:
        MOV AX,4C00H
        INT 21H

     L5:
        MOV CX,10H ; IF THE STRING IS PALINDROME THAN 10 WILL BE MOVED TO CX
        JMP L4 
END
  
Share: 


Didn't find what you were looking for? Find more on Program to check entered string is palindrome or not Or get search suggestion and latest updates.

Adelino Fischer
Adelino Fischer author of Program to check entered string is palindrome or not is from Frankfurt, Germany.
 
View All Articles

 
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!