A PROJECT ON
“REVERSING STRING USING
ASSEMBLY LANGUAGE
INSTUCTIONS”
Submitted in the partial fulfilment of the requirements for the award of diploma in
Engineering
Microprocessor (22415)
SUBMITTED BY
NAME Enroll.NO
1. CHAITANYA PATIL
2. AYUSH PADVAL
3. MANISH PATIL
4. SARTHAK RAJANE
5. MAYUR PATIL
UNDER THE GUIDANCE OF,
Prof. Asmita Patil
Submitted to
Maharashtra State Board of Technical Education
BHARTIYA EDUCATION/SOCIAL CHARITABLE TRUSTS SHETH SHREE
OTARMAL SHESHMAL PARMAR COLLEGE OF DIPLOMA ENGINEERING
AT/POST: - NAGOTHANE (VELSHET)-402106, TAL:-ROHA, DIST:-RAIGAD
Academic Year 2023-2024
2023-2024
Sheth Shree Otarmal Sheshmal College of Diploma Engineering
(Affiliated by Maharashtra State Board of Technical Education)
CERTIFICATE
DEPARTMENT OF COMPUTER ENGINEERING
This is to certify that the following students of S.S.O.S.P College of
Diploma Engineering, Nagothane, second year Computer Engineering
(2023-2024) completed the project work on “reversing string using
assembly language intructions” as a partial fulfilment and academic
requirement for diploma in computer engineering as prescribed by
MSBTE.
NAME Enroll.NO
● CHAITANYA PATIL
● AYUSH PADVAL
● MANISH PATIL
● SARTHAK RAJANE
● MAYUR PATIL
Prof. Asmita Patil Prof. Sagar Surekar 1145
(Microproject Guide) (HOD) (Principal)
Acknowledgement
We wish to express our deepest and most sincere gratitude to our Guide
Prof.Asmita Patil her exemplary guidance, encouragement and support
throughout the study. The confidence reposed by her has helped us to
develop positive orientation towards project. It has been the most
rewarding experience to undertake this project under her. We further wish
to express our sincere thanks to all faculty members, support staff of
S.S.O.S.P College of Diploma Engineering, Velshet, Nagothane – Roha
and all my colleagues for providing moral support throughout the project
work.
We would like to express thanks to concerned authority of central library
of the college for providing us with the various literature materials
required for our project work.
Finally, before ending, we would like to express our true gratitude to all
those involved directly or indirectly in our project.
Action Plan:-
Sr.no Activity Start Due Name of
Date date Group
Member
1 Divide the All group
work for members
students
2 Collection of All group
information members
3 Make a note All group
for project members
4 All project Ayush
typing padval
5 Make a final All group
report for members
project
6 Final All group
submission members
date
annexure-I
A MICRO PROJECT ON " Reversing String Using Assembly Language Instructions”
1.0 Aims/Benefits of the micro project
2.0 Course outcome addressed.
1)
2)
3)
3.0 Proposed methodology
1. Focused on the selection of an appropriate topic for the micro-project.
2.
3. Brief study on our topic.
4. Gather all information based on the topic of the micro project.
5. Analysis and study of our topic in detail.
6. Following all the above methodologies we successfully completed our microproje
ct.
4.0 Resources used
Sr. no. Name of resource material Specifications
1 Computer System (Laptop) 8 GB RAM, Windows 11 OS
2 Internet Youtube, wikipedia
3 textbook/manual MIC (Microprocessor) 22415
annexure-II
Micro-Project Report
A MICRO PROJECT ON " Reversing String Using Assembly Language Instructions "
1.0 Brief Introduction/Rationale
The Algorithm
In the process of reversing a string, we employ a stack-based approach. The concept is to
systematically push each character of the original string onto a stack. Subsequently, we
retrieve these characters from the stack, storing them back into the original string starting from
the initial position. This methodology leverages the Last In, First Out (LIFO) property of the
stack data structure. Due to this property, the characters are retrieved in the reverse order from
how they were initially pushed onto the stack. Consequently, the resulting string mirrors the
original string but in a reversed sequence. This approach is a clear illustration of how certain
data structures, like stacks, can be harnessed to efficiently solve problems such as string
reversal.
Code
1. .model small: This directive sets the memory model for the program. In this case,
it specifies a small memory model, which is one of the memory models used in
x86 assembly programming. The memory model determines how the program's
code and data are organized in memory.
2. .stack 100h: This directive sets the size of the stack to 100 hexadecimal bytes. The
stack is a region of memory used for storing temporary data and managing
function calls.
3. .data: This directive marks the beginning of the data segment. The data segment is
used for declaring and initializing data that the program uses during its execution.
4. string db "hello": This line declares a string variable named string and initializes it
with the string "hello". Here's the breakdown:
db: Declares a byte (8 bits) of data.
"hello": The actual string data. Each character is represented by one byte.
1. mov ax, @data: This instruction loads the address of the data segment (@data)
into the accumulator register (ax). The @data directive represents the start of the
data segment in the code.
2. mov ds, ax: This instruction moves the value in the accumulator register (ax),
which now holds the address of the data segment, into the data segment register
(ds). This sets up the data segment for accessing data in the program.
3. mov si, offset string: This instruction moves the offset of the string variable into
the source index register (si). The offset keyword retrieves the offset of a variable
or label, and in this case, it points si to the beginning of the string.
4. mov cx, 5: This instruction sets the loop counter register (cx) to 5. This is likely
intended to control the number of iterations in a loop.
We have already defined a string named ‘hello,’ and our objective is to push each letter onto
the stack to reverse the string. The process is quite simple. To reverse the string, we will
systematically push the letters ‘h,’ ‘e,’ ‘l,’ ‘l,’ and ‘o’ into the stack, followed by popping them
out in reverse order.
I moved “offset string” to the source index so the offset is being 00000h which refers to letter
“h”
1. mov bx, [si]: This instruction moves the 16-bit value (a word) stored at the
memory location pointed to by the source index register (si) into the base register
(bx). In this case, si is pointing to the current character or word in the string.
2. push bx: This instruction pushes the value in the base register (bx) onto the stack.
The x86 stack is a Last-In-First-Out (LIFO) data structure, so the value will be
pushed onto the top of the stack.
3. inc si: This instruction increments the value in the source index register (si). This
is done to move to the next character or word in the string.
4. loop stackpush: This instruction decrements the loop counter (cx) and jumps to
the stackpush label if cx is not zero. It essentially implements a loop that repeats
the stackpush block until cx becomes zero.
This code block is likely part of a larger program that initializes the data segment, sets up a
string, and then pushes each word of the string onto the stack in a loop. The loop is controlled
by the cx register, which is initially set to 5, so the loop will iterate five times (pushing five
words onto the stack).
In order to reverse the string, we should pop each letter from the stack. It is really simple to do
that:
mov cx, 5: This instruction initializes the loop counter (cx) to 5, indicating that the
loop will iterate five times.
stackpop:: This label marks the beginning of the loop.
pop dx: This instruction pops a 16-bit value from the stack into the dx register.
The assumption here is that the values on the stack represent characters or bytes to
be printed.
mov ah, 02h: This instruction sets the high byte of the ax register to 02h,
indicating that the DOS function 02h (character output) will be used.
int 21h: This instruction calls the DOS interrupt 21h, which is a software interrupt
used for various DOS functions. In this case, function 02h is invoked, and it prints
the character in the dl register (which was loaded with the popped value).
loop stackpop: This instruction decrements the loop counter (cx) and jumps to
the stackpop label if cx is not zero. It effectively creates a loop that repeats
the stackpop block until cx becomes zero.
As you can see, ‘68’ is being pushed into the stack, which corresponds to ‘h’ (AL) in the first
iteration. In the second iteration, (AH) corresponds to ‘65,’ representing ‘e,’ and so on..
If we examine the stackpop operation, we can observe that (AL) '6F' corresponds to 'o' in the
first iteration. In the second iteration, '6C' corresponds to 'l,' and so on."
I added the word “operation” after stackpop for clarification and adjusted the phrasing for
smoother flow.
Here is the output:
Here is the code:
Output:
2.0 Actual Resources Use
Sr. no. Name of resource material Specifications
1 Computer System 8 GB RAM,
Windows 11 OS
2 Internet Youtube /
Wikipedia
3 textbook/manual MIC
(Microprocessor)
22415
3.0 Skill Developed
1. Teamwork
2. Communication skills
3. Able to get all information about network topologies.
Conclusion
we have comprehended the concept of network topologies and its types.