Introduction To 8085: ALU (Arithmetic Logic Unit)
Introduction To 8085: ALU (Arithmetic Logic Unit)
Introduction To 8085: ALU (Arithmetic Logic Unit)
INTRODUCTION TO 8085
The 8085A has a simple 8-bit ALU and it works in coordination with the
accumulator, temporary registers, 5 flags and arithmetic and logic circuits.
ALU has the capability of performing several mathematical and logical
operations. The temporary registers are used to hold the data during an
arithmetic and logic operation. The result is stored in the accumulator and the
flags are set or reset according to the result of the operation. The flags are
affected by the arithmetic and logic operation. They are as follows:
Sign flag
After the execution of the arithmetic - logic operation if the
bit D7 of the result is 1, the sign flag is set. This flag is used with
signed numbers. If it is 1, it is a negative number and if it is 0, it is a
positive number.
Zero flag
The zero flag is set if the ALU operation results in zero. This
flag is modified by the result in the accumulator as well as in other
registers.
Parity flag
After arithmetic logic operation, if the result has an even
number of 1s the flag is set. If it has odd number of 1s it is reset.
Carry flag
If an arithmetic operation results in a carry, the carry flag is
set. The carry flag also serves as a borrow flag for subtraction.
This unit synchronizes all the microprocessor operation with a clock and
generates the control signals necessary for communication between the
microprocessor and peripherals. The control signals RD (read) and WR (write)
indicate the availability of data on the data bus.
The instruction register and decoder are part of the ALU. When an
instruction is fetched from memory it is loaded in the instruction register. The
decoder decodes the instruction and establishes the sequence of events to
follow.
Register array
The 8085 has six general purpose registers to store 8-bit data during
program execution. These registers are identified as B, C, D, E, H and L. they
can be combined as BC, DE and HL to perform 16-bit operation.
Accumulator
Program counter
Communication lines
AIM:
ALGORITHM:
RESULT:
Thus the 8 bit numbers stored at 4500 &4501 are added and the result stored at 4502 & 4503.
START
[C] 00H
[HL] 4500H
FLOW CHART:
Is there a
Carry ?
STOP
NO
YES
PROGRAM:
4101
4103 4500
4104
INPUT OUTPUT
4500 4502
4501 4503
AIM:
ALGORITHM:
RESULT:
Thus the 8 bit numbers stored at 4500 &4501 are subtracted and the result stored at 4502 &
4503.
START
FLOW CHART:
Is there a
Borrow ?
Complement [A]
Add 01H to [A]
STOP
NO
YES
PROGRAM:
4102
4103 4500
4104
OBSERVATION:
INPUT OUTPUT
4500 4502
4501 4503
3(A). 8 BIT DATA MULTIPLICATION
AIM:
To multiply two 8 bit numbers stored at consecutive memory locations and store the
result in memory.
ALGORITHM:
RESULT:
Thus the 8-bit multiplication was done in 8085p using repeated addition method.
FLOW CHART:
START
[HL]
4500
B M
[HL] [HL]+1
A 00
C 00
NO
YES
C C+1
B B-1
IS B=0
NO
YES
STOP
PROGRAM:
4101 4500
4102
4106
4108
410C
410F JNZ L1
4110 Jump to L1 if B is not
zero.
4111
OBSERVATION:
INPUT OUTPUT
4500 4502
4501 4503
AIM:
ALGORITHM:
Thus an ALP was written for 8-bit division using repeated subtraction method and
executed using 8085 p kits