MIC Micro2024
MIC Micro2024
This report is a partial fulfilment of subject MIC(22415) for the award of the
Diploma in Computer Technology , By MSBTE, Mumbai.
HOD PRINCIPAL
1
INDEX
2
ABSTRACT
characters that reads the same backward as forward. The program utilizes efficient string
manipulation techniques to compare characters from both ends of the string, checking for
equality iteratively until the midpoint is reached. If all characters match, the string is confirmed
The program employs appropriate logic and control flow to handle various string
lengths and edge cases effectively. Additionally, it leverages assembly language's low-level
capabilities to optimize performance and minimize resource usage. Through thorough testing
and validation, the program ensures reliable and accurate identification of palindromic strings,
programming..
3
INTRODUCTION
The assembly language program described in this paper serves the purpose of
characters that reads the same backward as forward, such as "radar" or "level". This program
employs low-level string manipulation techniques to efficiently compare characters from both
ends of the string, ultimately providing a verdict on whether the input string meets the
palindrome criterion.
By leveraging the power of assembly language, this program aims to provide a simple
4
PROGRAM DEVELOPMENT STEPS
3.2 Algorithm:
1. Start
8. Stop
5
3.3 Flowchart:
6
3.4 Initialisation and explanation of instructions used:
7
Instructions Used:
1. MOV: This instruction moves data from one location to another. In this code, it's used
to initialize registers and store characters read from input into memory.
2. LEA: Load Effective Address instruction computes and loads the effective address of a
memory operand into a register. It's used here to load the address of strings and
variables into registers.
3. INT: This instruction generates a software interrupt. In this code, it's used to invoke
DOS functions for input/output operations and program termination.
4. CMP: Compare instruction compares two operands and sets the status flags in the CPU
accordingly. It's used for comparing characters to determine if the string is a
palindrome.
5. JE: Jump if Equal instruction jumps to a specified location if the Zero Flag (ZF) is set.
In this code, it's used to check if the Enter key was pressed to terminate the input string.
6. INC: Increment instruction increases the value of the operand by 1. It's used here to move to
the next memory location when storing characters in memory.
7. DEC: Decrement instruction decreases the value of the operand by 1. It's used to move
backward through memory when comparing characters for palindrome checking.
8. JMP: Jump instruction unconditionally jumps to a specified location. It's used here for
loops and to control program flow.
8
3.5 Write a neat program in proper format along with comments:
data SEGMENT
MSG1 DB 10,13,'ENTER THE STRING: $' ; Message to prompt user to enter a string
MSG2 DB 10,13,'STRING IS PALINDROME$' ; Message displayed if the string is a
palindrome
MSG3 DB 10,13,'STRING IS NOT PALINDROME$' ; Message displayed if the string
is not a palindrome
STR1 DB 50 DUP(0) ; Buffer to store the input string
data ENDS
code SEGMENT
START:
MOV AX, DATA ; Load the starting address of the data segment into
AX MOV DS, AX ; Set DS to point to the data segment
LEA DX, MSG1 ; Load the address of the prompt message into DX
MOV AH, 09H ; Set AH to display string function
INT 21H ; Display the prompt message
NEXT:
character TERMINATE:
9
MOV [DI], AL
DOTHIS:
PALINDROME:
NOTPALINDROME:
EXIT:
code ENDS
END START
10
3.6 write 5 set of inputs and the respective output:
1. Input: "madam"
a. Output: "STRING IS PALINDROME"
2. Input: "racecar"
a. Output: "STRING IS PALINDROME"
3. Input: "hello"
a. Output: "STRING IS NOT PALINDROME"
4. Input: "level"
a. : "STRING IS
PALINDROME" 5. Input: "12321"
a. Output: "STRING IS PALINDROME"
Image 1.1
Image 1.2
11
Image 1.3
Image 1.4
Image 1.5
12
4 Conclusion:
Throughout the code, appropriate comments are provided to enhance readability and
understanding of the logic behind each instruction. The program efficiently utilizes the
8086 assembly language instructions to manipulate data, compare characters, and display
messages to the user using DOS interrupt calls.
By breaking down the process into clear steps, from inputting the string to determining its
palindrome status, this project serves as a valuable educational resource for understanding
low-level programming concepts. It highlights the importance of memory management,
character manipulation, and conditional branching in assembly language programming.
Overall, this project offers a practical example of how assembly language can be used to
solve real-world problems, showcasing the power and versatility of low-level programming
languages.
13
5 Acknowledgement:
We would like to express our sincere gratitude to all those who have contributed to
the completion of this assembly language project on palindrome checking.
First and foremost, we extend our heartfelt appreciation to our mentor A.L. Tarange Sir
for their invaluable guidance and support throughout the development of this project.
Their encouragement have been important in shaping the project and enhancing its
quality.
Last but not least, we extend our appreciation to our family and friends for their
unwavering support and encouragement throughout this endeavor.
Thank you all for your contributions and encouragement. Without your support, this
project would not have been possible.
14
6 References:
https://www.cs.ubbcluj.ro/~forest/teaching/os/laboratory/lab4/docs/interrupts.html
https://www.tutorialspoint.com/assembly_programming/index.htm
https://www.cs.virginia.edu/~evans/cs216/guides/x86.htm
https://en.wikibooks.org/wiki/X86_Assembly/Interfacing_with_DOS
https://www.mathsisfun.com/numbers/palindrome.html
15