Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (3 votes)
2K views

ALP Code For String Manipulation Project

Microprocessor 8086 alp + documentation for strinig manipulation project

Uploaded by

Khemraj Bohra
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
2K views

ALP Code For String Manipulation Project

Microprocessor 8086 alp + documentation for strinig manipulation project

Uploaded by

Khemraj Bohra
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Annexure – II

PART B – Micro-Project Report

Title of Micro-Project: 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.

2.0 Course Outcomes Addressed


(Add to the earlier list if more COs are addressed)
a) Write assembly language program for the given problem.
b) Develop an assembly language program using assembler.

3.0 Literature Review

The different ways in which a source operand is denoted in an instruction is known as


addressing modes. There are 8 different addressing modes in 8086 programming–
1. Immediate addressing mode
2. Register addressing mode
3. Direct addressing mode
4. Register indirect addressing mode
There are five basic instructions for processing strings. They are −
1. MOVS − This instruction moves 1 Byte, Word or Doubleword of data from memory
location to another.
2. LODS − This instruction loads from memory. If the operand is of one byte, it is loaded
into the AL register, if the operand is one word, it is loaded into the AX register and a
doubleword is loaded into the EAX register.
3. STOS − This instruction stores data from register (AL, AX, or EAX) to memory.
4. CMPS − This instruction compares two data items in memory. Data could be of a byte
size, word or doubleword.
5. SCAS − This instruction compares the contents of a register (AL, AX or EAX) with the
contents of an item in memory.
4.0 Actual Methodology Followed
1. We selected the topic from the syllabus.
2. We discussed about the project for a while with the team members and the respective
staff member.
3. We distributed the project sectors such as documentations, writing code, code testing.
4. We researched about the project on the network, took some references and then we
performed our code in tasm.

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

5.0 Actual Resources Used (Mention the actual resources used).


S. Name of Specifications Qty Remarks
No. Resource/material
1 MS Word Microsoft 1
2 laptop i5, 16gb ram,1TB 1
3 TASM TASM 1.4 1

6.0 Outputs of the Micro-Project

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

2. ALP to check whether the string is palindrome or not


DATA SEGMENT
MSG1 DB 10,13,'ENTER ANY STRING :- $'
MSG4 DB 10,13,'NO, GIVEN STRING IS NOT A PALINDROME $'
MSG5 DB 10,13,'THE GIVEN STRING IS A PALINDROME $'
P1 LABEL BYTE
M1 DB 0FFH
L1 DB ?
P11 DB 0FFH DUP ('$')
P22 DB 0FFH DUP ('$')
DATA ENDS
DISPLAY MACRO MSG
MOV AH,9
LEA DX,MSG
INT 21H
ENDM
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV AX,DATA
MOV DS,AX

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

EXIT: MOV AH,4CH


INT 21H
CODE ENDS
END START
7.0 Skill Developed / learning out of this Micro-Project

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.

8.0 Applications of this Micro-Project


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.
9.0 Area of Future Improvement
Some of these functions seem almost pointless, but we have found them and will make it very
useful at some point or the other. Feel free to do whatever you want with these functions, no
annoying copyright or anything like that.

**************

You might also like