You are on page 1of 17

A

MICRO-PROJECT REPORT

[ MICROPROCESSOR ]

(22415)

ON

Search a Given Character In String and Find How Many


Time It's Present In String
UNDER THE GUIDANCE OF

MR R.D.MOON SIR

DEPARTMENT OF COMPUTER ENGINEERING

GOVERNMENT POLYTECHNIC, THANE

(0116)

YEAR 2023-24
OUR TEAM MEMBERS :-

ROLL NO NAME ENROLLMENT

37 Jaya Gujar 2201160040

38 Siddhant Magade 2201160042

39 Manali Marathe 2201160043

40 Vaibhav Thorat 2201160044


CERTIFICATE
This is to certify that, the project report entitled “Search a Given
Character In String and Find How Many Time It's Present In
String” In Microprocessor was successfully completed by Students of
Fourth semester Diploma in Computer Engineering
37. Jaya Gujar

38. Siddhant Magade

39. Manali Marathe

40. Vaibhav Thorat

in partial fulfilment of the requirements for the award of the Diploma


in Computer Engineering and submitted to the Department of
Computer Engineering of Government
Polytechnic, Thane.

Guide Principal HOD

Date :

Place: Government Polytechnic, Thane


ACKNOWLEDGEMENT

It is great pleasure for us to acknowledge the assistance &


contribution of the number of individuals who helped us in presenting
the Project We have successfully completed our project with “Search
a Given Character In String and Find How Many Time It's Present In
String” the handful support of Staff, Project Partners, External
Resources, etc. We acknowledge all of them & them for their support.

Special thanks to project guide Mr R.D.Moon Sir who gave us the


valuable guidelines for the seminar & project work. We whole
heartedly thank all the staff members & every possible person who
possibly helped as in the project.

Thank You !
TABLE OF CONTENTS

Sr no Contents Remarks
01 Aims/Benefits
02 Course outcome
03 Proposed Methodology
04 Action Plan
05 Resources used

PART I
01. Aims / benefits :

• To know the details about the Microprocessor.


• Get Information about Registers in Microprocessor.
• Gain knowledge about Register/Microprocessor.

02. Course outcome : ·

• Identify different types of Registers.


• Apply the Implementation in Program.
• Solve problems based on Programs.

03. Proposed Methodology :

• Focus on selection a topic for micro-project.


• Select a topic.
• To prepare a report on Micro-project Topic.
• Gather all information based on topic.
• Analysis and study of our topic in details.
• Following all the above Methodology we successfully completed
our micro-project.
04. Action plans

Name of
Sr Details of Plan start Plan end Responsible
No activity date date team member
Searching the
topic for
01 microproject All member

Collect
information
from the
Internet and
02 textbook
Arrange the
program in
TASM (version
03 1.7)
Prepare report on
it Using Ms
04 Word
Print
05 microproject
05. Resource Used

Name of
resource
Sr no material Specification Quantity Remarks
8 GB RAM,
Computer Windows 10
01 System Pro 01

02 TASM Version 1.7 01

03 Linker T-Link 01

04 Debugger TD 01
You-tube /
05 Internet Wikipedia 01
Manual /
06 Textbook MIC (22416) 01

07 Operating S/w Windows 01


TABLE OF CONTENTS

Sr no Contents Remark
01 Introduction
02 Minimum Theoretical Background
03 Results and Application
04 Working
05 Source code
06 Algorithm
07 Flowchart
08 Explanation
09 Conclusion

PART II

01. INTRODUCTION :

The project aims to develop a program using the 8086 microprocessor


to search for a given character within a string and determine the number
of times it appears. This task is fundamental in string manipulation and
is often encountered in various applications, ranging from text
processing to data analysis.
02. MINIMUM THEORETICAL BACKGROUND

Understanding the architecture of the 8086 microprocessor, including


its registers, memory organization, and instruction set, is essential.
Additionally, familiarity with string manipulation concepts such as
indexing, comparison, and looping is necessary to implement an
efficient search algorithm.

03. RESULTS AND APPLICATION

The program will display the number of occurrences of the given


character in the string. Its application extends to tasks such as data
validation, text processing, and pattern matching. For example, it can
be utilized in word processing software to count the frequency of
specific characters or in data analysis to identify patterns within
datasets.

04. WORKING

 Initialize pointers to the beginning of the string and set a counter


to zero.

 Iterate through each character of the string.

 Compare each character with the given character.

 If a match is found, increment the counter.

 Continue until the end of the string is reached.

 Display the value of the counter, which represents the number of


occurrences of the given character in the string.
05. SOURCE CODE

WAP:- Search a Given Character In String and Find How Many


Time It's Present In String
.model small

.data

msg1 db 'Enter String: $'

msg2 db 'Enter Char To Find : $'

msg3 db 'Number Of Occurence : $'

count db 0 ; Counter for the number of occurrences

searchword db 0

buffer db 255 DUP('$') ; Buffer to store the input string

.code

mov ax, @data

mov ds, ax

; Display prompt to enter a string

mov ah, 09h

lea dx, msg1

int 21h

; Read a string from the user

mov ah, 0Ah


lea dx, buffer

int 21h

mov ah, 09h

lea dx, msg2

int 21h

mov ah,01h

int 21h

mov searchword,al

; sub searchword,'0'

mov si, offset buffer +2

start:

mov bl, [si]

cmp bl,'$'

je last

cmp bl,searchword

je countplus

jmp last1

countplus : inc count


last1: inc si

jmp start

last:

mov ah, 09h

lea dx, msg3

int 21h

add count, '0' ; Convert to ASCII

mov dl, count

mov ah, 02h

int 21h

; Pause The Program For Output

mov ah,01h

int 21h

; Terminate the program

mov ah, 4Ch

int 21h

end
Result ( output of the program ) :
06. Algorithm

1. Set up a counter to keep track of the number of occurrences.

2. Start from the beginning of the string.

3. Load the current character into a register.

4. Compare the character with the given character.

5. If they match, increment the counter.

6. Move to the next character in the string.

7. Repeat steps 3-6 until the end of the string is reached.

8. Display the value of the counter as the result.


07. Flowchart
08. Explanation

Certainly, let's summarize each instruction in three points:

 DUP(Duplicate)

EX. array DB 0 DUP(10)

This line tells the assembler to reserve 10 bytes of memory, each


initialized with the value 0.

 OFFSET (Memory Address Retrieval):

01. `OFFSET` is a directive that returns the memory address (offset)


of a specified variable or label.

02. Commonly used in conjunction with strings or data declarations.

03. In the code, it is used with `MESS` and `MESS2` to get the starting
addresses of the strings.

 LEA(Load Effective Address):

Load Effective Address." It's an instruction used to load the effective


address of a memory operand into a register without actually accessing
the memory.

 JE (Jump if equal):

"Jump if Equal" It's a conditional jump instruction used to transfer


control to a different part of the program if the last comparison
operation indicated that two operands were equal.
 CMP (Compare):

stands for "Compare." It's an instruction used in assembly language to


compare two operands.

 JNE (Jump if Not Equal):

"Jump if Not Equal." Similar to JE, but it jumps if the last comparison
operation indicated that two operands were not equal.

 INC (Increment):

INC` increments the value of the specified register or memory


location by 1. Used for incrementing counters or variables. In the
code, it increments the count of set bits during bit manipulation.

 09. CONCLUSION

In summary, the program designed for the 8086 microprocessors


effectively counts the number of 1's in a given 16-bit number using
efficient bitwise operations. Thorough testing has validated its accuracy
and robustness. This project showcases the significance of low-level
language proficiency and microprocessor understanding, providing a
strong foundation for future optimizations and complex tasks in
assembly language programming.

 THANK YOU

You might also like