Professional Documents
Culture Documents
Mpi Final
Mpi Final
PROJECT REPORT
ON
SQUARE OF 8 BIT NUMBER
May ,2024
AKNOWLEDGEMENT
WE hereby declare that the work, which is being presented in the project , entitled “Square of
8 bit number”. partial fulfilment for the award of Degree of Bachelor of Technology in
Department of computer science Engineering with Specialization in Artificial
Intelligence/Cloud Technology and information Security and submitted to the Department of
Computer Science Engineering, Vivekananda Global University , Jaipur, Rajasthan is a
record of my own investigations carried under the Guidance of MR.PRADEEP KUMAR
JANGID , Department of Computer Science Engineering, Vivekananda Global University ,
Jaipur , Rajasthan.
We have submitted the matter presented in this project anywhere for the award of any other
degree.
the purpose of squaring an 8-bit number can be used for error correction or error detection
purposes. By squaring a number and comparing it to a known value, errors in data transmission
or processing can be detected. It's often used to compute power or energy measurements in
signals, or to enhance certain features of the signal for further analysis. Squaring can help
reduce the dynamic range of the data, making it easier to encode or store efficiently. It also
used in mathematical algorithms and computations, such as in optimization algorithms,
statistical calculations, or cryptographic operations.
TABLE OF CONTENTS
ACKNOWLEDGEMENT 1
PREFACE 2
CONTENT 3
NOMENCLATURES 6
1 INTRODUCTION 7
2 SYNOPSIS 12
3 PROCESS CHART 13
4 WORKING PROCESS 14
5 PROJECT CODE 15
6 OUTPUT 15
CONCLUSION
REFERENCE
LIST OF TABLE
1. Introduction of 8085 7
2. Architecture of 8085 7
3. Pin diagram of 8085 8
3.1 Arithmetic logic unit 8
3.2 Flag register 8
3.3 Accumulator 9
1. Architecture of 8085 7
3. Flowchart 13
LIST OF NOMENCLATURES AND ABBREVIATION
5. DCR Decrement
The 8085 microprocessor has B, C, H, D, E, A Flag register pairs which are available to the
programmer for programming the 8085. 8085 needs an external latch for demultiplexing the
D0-D7 lines of the 8085. An external RAM and ROM are also needed to be connected . It
also a 16-bit program counter and 16-bit stack pointer to memory. Using input and output
mapped ports 256 different ports can be connected to 8085.
8085 PIN DIAGRAM
Flag Register:
It is an 8-bit register that stores either 0 or 1 depending upon which value is stored in the
accumulator. Flag Register contains 8-bit out of which 5-bits are important and the rest of
3-bits are “don’t Care conditions”. The flag register is a dynamic register because after each
operation to check whether the result is zero, positive or negative, whether there is any
overflow occurred or not, or for comparison of two 8-bit numbers carry flag is checked. So
for numerous operations to check the contents of the accumulator and from that contents if
we want to check the behavior of given result then we can use Flag register to verify and
check. So we can say that the flag register is a status register and it is used to check the
status of the current operation which is being carried out by ALU.
Different Fields of Flag Register:
1. Carry Flag
2. Parity Flag
3. Auxiliary Carry Flag
4. Zero Flag
5. Sign Flag
Accumulator:
Accumulator is used to perform I/O, arithmetic, and logical operations. It is connected to
ALU and the internal data bus. The accumulator is the heart of the microprocessor because
for all arithmetic operations Accumulator’s 8-bit pin will always there connected with ALU
and in most-off times all the operations carried by different instructions will be stored in the
accumulator after operation performance.
Program Counter
Program Counter holds the address value of the memory to the next instruction that is to be
executed. It is a 16-bit register.
Stack Pointer
It works like a stack. In stack, the content of the register is stored that is later used in the
program. It is a 16-bit special register. The stack pointer is part of memory but it is part of
Stack operations, unlike random memory access. Stack pointer works in a continuous and
contiguous part of the memory. whereas Program Counter(PC) works in random memory
locations. This pointer is very useful in stack-related operations like PUSH, POP, and nested
CALL requests initiated by Microprocessor. It reserves the address of the most recent stack
entry.
Temporary Register:
It is an 8-bit register that holds data values during arithmetic and logical operations.
Interrupt control:
Whenever a microprocessor is executing the main program and if suddenly an interrupt
occurs, the microprocessor shifts the control from the main program to process the incoming
request. After the request is completed, the control goes back to the main program. There are
5 interrupt signals in 8085 microprocessors: INTR, TRAP, RST 7.5, RST 6.5, and RST 5.5.
Priorities of Interrupts: TRAP > RST 7.5 > RST 6.5 > RST 5.5 > INTR
Abstract
The project aimed to develop an assembly language program for the 8085 microprocessor
that calculates the square of an 8-bit number. This report outlines the design, implementation,
and testing of the program.
Introduction
Objectives
Develop an assembly language program for the 8085 microprocessor to compute the
square of an 8-bit number.
Utilize the arithmetic and logical operations available in the 8085 instruction set.
Optimize the program for efficiency and minimal memory usage.
Program Design
i. Initialize a counter to 0.
ii. Load the input number into a register.
iii. Multiply the number by itself, effectively squaring it.
iv. Store the result in memory.
v. Repeat steps 2-4 for each input number.
FLOW CHART
WORKING
This program finds the square of an 8-bit number stored in memory location 3000H
The square of a number is found by multiplying it by itself.
Therefore, the number is added with itself and is also used as counter.
Let us assume that the operands stored at memory location 3000H is 03H.
Then, by using successive addition method, we get 03H + 03H + 03H = 09H.
Initially, H-L pair is loaded with the address of the operand.
The operand is moved to register B from memory location 3000H and then it is copied
to register
Accumulator is initialized to 00H.
Register B is added with accumulator and the result is stored in accumulator.
Register C (counter) is decremented by 1.
Then, counter is checked for zero. If it hasn’t become zero yet, then register B is again
added with accumulator, and counter is again checked for zero.
If counter becomes zero, then H-L pair is incremented and the result is moved from
accumulator to memory location 3001H
Project Code
LXI H,0100
XRA A
MOV B,M
ADD M
DCR B
JNZ 0005
STA 0101
HLT
Output
In conclusion, the assembly language program developed for the 8085 microprocessor
successfully computes the square of an 8-bit number. It demonstrates the utilization of
arithmetic and logical operations available in the 8085 instruction set to perform mathematical
computations efficiently. Further optimizations could be explored to enhance the performance
or reduce the code size of the program.
REFERENCE
1. ONLINE RESOURCES:
Google , Wikipedia,Chatgpt and Youtube
2. https://electronicsforu.com/
3. https://www.slideshare.net/
4. 8085 Microprocessor Instruction Set Manual
5. Assembly Language Programming guides