LAB - 7 - R - AKASH - 20BCE1501 - Template
LAB - 7 - R - AKASH - 20BCE1501 - Template
Aim:
Tool Used:
Algorithm:
1] Display name:
Step 1 – START
Step 2 – Inside data segment store the String by ending it with “$”.
Step 8 – Call INT 21H for printing the status of program execution
2] Length of String:
Step 1 – START
Step 2 – Inside data segment store the String by ending it with “$”.
Step 5 – Check whether the character equals to “$” each time, once its equal
quit the loop.
Step 7 – Print count by moving 02H to AH register and calling INT 21H
Step 12 – Call INT 21H for printing the status of program execution
Step 2 – Inside data segment store the String by ending it with “$”.
Step 5 – After taking the character from last one by one store them in any
locations like 2000H and consecutive locations.
Register No.: 20BCE1501 Name: Akash R
Step 6 – Load address (ex. 2000H) of the reversed String into DX register
Step 10 – Call INT 21H for printing the status of program execution
4] Check Palindrome:
Step 1 – START
Step 2 – Inside data segment store the String by ending it with “$”.
Step 5 – After taking the character from last one by one check them with the
character taken from front and count how many time they are equal and store
the count in bx.
Step 10 – Call INT 21H for printing the status of program execution
Program:
1] Display name:
dispname.asm:
DATA SEGMENT
DATA ENDS
CODE SEGMENT
START:
MOV DS, AX
INT 21h
INT 21h
HLT
CODE ENDS
END START
Register No.: 20BCE1501 Name: Akash R
2] Length of String:
lenstr.asm:
DATA SEGMENT
DATA ENDS
CODE SEGMENT
START:
MOV DS, AX
CMP AL, AH
JE EXIT
INC CX
INC SI
JMP RPT
INT 21H
Register No.: 20BCE1501 Name: Akash R
MOV DL, CL
INT 21h
INT 21H
HLT
CODE ENDS
END START
DATA SEGMENT
DATA ENDS
CODE SEGMENT
START:
MOV DS, AX
CMP AL, AH
JE EXIT
INC CL
INC SI
JMP RPT1
EXIT:
ADD DI, CX
RPT2: DEC DI
MOV [BX], AL
INC BX
DEC CL
JE EXIT1
JMP RPT2
INT 21H
INT 21H
HLT
CODE ENDS
END START
4] Check Palindrome:
palin.asm:
DATA SEGMENT
DATA ENDS
CODE SEGMENT
START:
MOV DS, AX
CMP AL, AH
JE EXIT
INC CL
INC SI
JMP RPT1
EXIT:
ADD DI, CX
MOV BH, CL
RPT2: DEC DI
CMP AL, AH
JE INCR
JMP CONT
INCR: INC BL
CONT: INC SI
DEC CL
JE DIS
JMP RPT2
Register No.: 20BCE1501 Name: Akash R
DIS:
CMP BL, BH
JE EXIT1
JMP EXIT2
INT 21H
JMP HALT
INT 21H
INT 21H
HLT
CODE ENDS
END START
Sample Input:
1] Display name:
2] Length of String:
MSG1 = “AKASH”, “$”
4] Check Palindrome:
MSG1 = "MADAM", "$"
or
Sample Output:
1] Display name:
AKASH
2] Length of String:
LENGTH OF THE STRING IS 5
4] Check Palindrome:
THE GIVEN STRING IS PALINDROME.
Or
Register No.: 20BCE1501 Name: Akash R
Manual Verification:
1] Display name:
AKASH
2] Length of String:
MSG1 = “AKASH”, “$”
Length = 5
If we reverse it becomes,
HSAKA
4] Check Palindrome:
MSG1 = “AKASH”, “$”
Or
1] Display name:
2] Length of String:
Register No.: 20BCE1501 Name: Akash R
4] Check Palindrome:
Register No.: 20BCE1501 Name: Akash R
1] Display name:
2] Length of String:
4] Check Palindrome:
MSG1 = AKASH
MSG1 = MADAM
Result:
From the above experiment I have learned to write basic assembly language
codes for String handling and INT 21H.