0% found this document useful (0 votes)
16 views5 pages

Exercise 9 (Palindrome)

The document outlines an exercise for a Microprocessors and Microcontroller Lab at Presidency University, Bengaluru, focusing on writing an Assembly Language Program (ALP) to check if a string is a palindrome. It includes the code for the program, which involves user input, string reversal, and comparison. Additionally, it provides steps to execute Assembly Language programs using DOSBOX and MASM.

Uploaded by

houndclegane860
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views5 pages

Exercise 9 (Palindrome)

The document outlines an exercise for a Microprocessors and Microcontroller Lab at Presidency University, Bengaluru, focusing on writing an Assembly Language Program (ALP) to check if a string is a palindrome. It includes the code for the program, which involves user input, string reversal, and comparison. Additionally, it provides steps to execute Assembly Language programs using DOSBOX and MASM.

Uploaded by

houndclegane860
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 5

PRESIDENCY UNIVERISTY, BENGALURU

School of Engineering

Microprocessors and Microcontroller Lab


CSE 254

IV Semester 2018-19
Exercise-
9
Write an ALP to check whether a string is Palin-
drome or not
.MODEL SMALL CMP AL,13
JE NEXT
.DATA
MOV STR[SI],AL
MSG1 DB 10,13,"ENTER THE STRING : $"
INC SI
MSG2 DB 10,13,"REVERSE THE STRING: $"
JMP LOOP1
MSG3 DB 10,13,"GIVEN STRING IS PALINDROME$" NEXT: PRINT MSG2
MSG4 DB 10,13,"GIVEN STRING S NOT A PALIN- MOV CX,SI
DROME$"
DEC SI
STR DB 100 DUP(?)
LOOP2:MOV DL,STR[SI]
REV DB 100 DUP(?) MOV REV[DI],DL
.CODE INC DI
MOV AX,@DATA DEC SI
MOV DS,AX MOV AH,02H
MOV DI,00H INT 21H
PRINT MACRO MSG LOOP LOOP2
LEA DX,MSG MOV SI,00H
MOV CX,DI
MOV AH,09H
PALY:MOV AL,STR[SI]
INT 21H
MOV BL,REV[SI]
ENDM INC SI
PRINT MSG1 CMP AL,BL
MOV SI,00H JNE NOTPALY
LOOP1:MOV AH,01H LOOP PALY
INT 21H PRINT MSG3
JMP STOP

NOTPALY: PRINT MSG4


STOP:MOV AH,4CH
INT 21H
END
Steps to Execute Assembly Language pro-
grams
1) Install DOSBOX 0.74

2) Launch DOSBOX, By default it will be in Z drive <Z:\>


3) Change the drive to that, in which MASM is installed
mount c c:\masm
4) C:
5) C:\> Edit filename.asm
6) C:\> Masm filename.asm;
7) C:\> Link filename.obj;
8) Filename (Enter Key)
THANK YOU

You might also like