VOOZH about

URL: https://www.geeksforgeeks.org/computer-organization-architecture/8086-program-to-check-whether-a-string-is-palindrome-or-not/

⇱ 8086 program to check whether a string is palindrome or not - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

8086 program to check whether a string is palindrome or not

Last Updated : 3 Aug, 2021

Problem: Write an 8086 program to check whether a given string is palindrome or not.
Examples: 
 

Input String: "abba"
Output: String is palindrome

Input String: "abbca"
Output: String is not palindrome 


Explanation: 
 

  1. Create a string
  2. Traverse to the end of the string
  3. Get the address of the end of the string, DI
  4. Load the starting address of the string, SI
  5. Compare the value stored at the address
  6. Increment the pointer, SI
  7. Decrements the pointer, DI
  8. Compare again the value stored at si and di
  9. Repeat the steps until SI<=DI
  10. If all the characters match print string is palindrome else print not palindrome


Program:
 

Output: 
 

String is palindrome


Note: 
The program cannot be run on an online editor, please use MASM to run the program and use dos box to run MASM, you might use any 8086 emulator to run the program.
 

Comment

Explore