Logo 
Search:

Assembly Language Articles

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

An Assembly Language Program to check for Palindrome string

Posted By: Addie Fischer     Category: Assembly Language     Views: 30266

An Assembly Language Program to check for Palindrome string.

Code for An Assembly Language Program to check for Palindrome string in Assembly Language

Data Segment
  str1 db 'MADAM','$'  
  strlen1 dw $-str1
  strrev db 20 dup(' ')
  str_palin db 'String is Palindrome.','$'
  str_not_palin db 'String is not Palindrome.','$'
Data Ends

Code Segment
  Assume cs:code, ds:data

  Begin:
    mov ax, data
    mov ds, ax
    mov es, ax
    mov cx, strlen1
    add cx, -2

    lea si, str1
    lea di, strrev

    add si, strlen1
    add si, -2
    L1:
       mov al, [si]
       mov [di], al
       dec si
       inc di
       loop L1
       mov al, [si]
       mov [di], al
       inc di
       mov dl, '$'
       mov [di], dl
       mov cx, strlen1

    Palin_Check:
       lea si, str1
       lea di, strrev
       repe cmpsb
       jne Not_Palin

    Palin:
       mov ah, 09h
       lea dx, str_palin
       int 21h
       jmp Exit

    Not_Palin:
       mov ah, 09h
       lea dx, str_not_palin
       int 21h

    Exit:
       mov ax, 4c00h
       int 21h
Code Ends
End Begin

  
Share: 



Addie Fischer
Addie Fischer author of An Assembly Language Program to check for Palindrome string is from Frankfurt, Germany.
 
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].

 
Kondaparthy Gayatri from India Comment on: Apr 05
please provide me the armstrong number program in microprocessor 8086

Mikro Mikross from Canada Comment on: Dec 16
i have a problem with creating an aplication for finding how many palindrome words are in one sentence that is put in the data segment
please help me :)

View All Comments