ALP Code For String Manipulation Project
ALP Code For String Manipulation Project
1.0 Rationale
This simple project is developed by using TASM. Here, the user can easily get palindrome and
can change lower case to upper case vice versa using string function. It is easy to check whether
the string is palindrome or not. It will also change the string into lower case to upper case. This
system is easy to operate and understand by the user. String is s series of data byte or word
available in memory at consecutive locations. It is either referred as byte string or word string.
Their memory is always allocated in a sequential order. Instructions used to manipulate strings
are called string manipulation instructions. A string in literal terms is a series of characters. The
functions are set up to return empty strings or something of that effect when there is an invalid
situation, to prevent runtime errors, but feel free to modify them to handle invalid strings in
other ways.
Palindrome
1. Start
2. Store variables like msg, arrray1, array2, etc. in data segment.
3. Take the string input from the user.
4. Make the string reverse and copy to another variable.
5. Compare the reversed string with the original string.
6. If reversed string = original string
Then print it is palindrome
Else
Print it is not a palindrome
7. Stop
1. ALP to convert string to lower case to upper case and vice versa
DIS MACRO STR
MOV AH,09H
LEA DX,STR
INT 21H
ENDM
DATA SEGMENT
MSG1 DB "ENTER YOUR STRING : $"
MSG2 DB "CONVERTED STRING IS : $"
STR1 DB 20 DUP('$')
LINE DB 10,13,'$'
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:
MOV AX,DATA
MOV DS,AX
DIS MSG1
MOV AH,0AH
LEA DX,STR1
INT 21H
DIS LINE
MOV CH,00
MOV CL,BYTE PTR[STR1+1]
LEA SI,STR1+2
L1: MOV AH,BYTE PTR[SI]
CMP AH,'A'
JL L4
CMP AH,'Z'
JG L2
ADD BYTE PTR[SI],32
JMP L3
L2:CMP AH,'a'
JL L4
CMP AH,'z'
JG L4
SUB BYTE PTR[SI],32
L3:INC SI
LOOP L1
DIS MSG2
DIS STR1+2
L4:MOV AH,4CH
INT 21H
CODE ENDS
END START
DISPLAY MSG1
LEA DX,P1
MOV AH,0AH
INT 21H
DISPLAY P11
MOV DL,L1
ADD DL,30H
MOV AH,2
INT 21H
LEA SI,P11
LEA DI,P22
MOV DL,L1
DEC DL
MOV DH,0
ADD SI,DX
MOV CL,L1
MOV CH,0
REVERSE:
MOV AL,[SI]
MOV [DI],AL
INC DI
DEC SI
LOOP REVERSE
DISPLAY P22
LEA SI,P11
LEA DI,P22
MOV CL,L1
MOV CH,0
CHECK:
MOV AL,[SI]
CMP [DI],AL
JNE NOTPALIN
INC DI
INC SI
LOOP CHECK
DISPLAY MSG5
JMP EXIT
NOTPALIN:
DISPLAY MSG4
Here, we learn many things like write a ALP code for making program run neatly, and also
increase the writing speed. In coding we learn many skills like making macro, procedure, etc.
We learn to develop program in Assembly language programming. We also learn the skill string
function, taking input, loops, etc.
**************