You are on page 1of 12

Computer Structure And

Algorithms
-assignment 2

NAME: Aaryan Parpyani


ROLL NO: CE089
ID NO: 20ECUOS045

Q.1 Analyse the different logical


instruction by checking the usage on the
8085 simulator.

ANS->

• CMP
The contents of operand are compared with contents
of accumulator.
If (A) < (Registers / Memory): carry flag is set
If (A) = (Registers / Memory): zero flag is set
If (A) > (Registers / Memory): carry and zero flags are
reset
Ex. CMP B or CMP M

• CPI
The 8-bit data is compared with the contents of
accumulator.
If (A) < data: carry flag is set
If (A) = data: zero flag is set
If (A) > data: carry and zero flags are reset
Ex. CPI 89H or CPI 45H

• ANA
The contents of the accumulator are logically
ANDed with the contents of register or memory.
The result is placed in the accumulator.
Ex. ANA B or ANA M

• ANI
The contents of the accumulator are logically
ANDed with the 8-bit data. The result is placed in
the accumulator.
Ex. ANI 86H
• ORA
The contents of the accumulator are logically
ORed with the contents of the register or
memory. The result is placed in the accumulator.
Ex. ORA B or ORA M

• ORI
The contents of the accumulator are logically
ORed with the 8-bit data. The result is placed in
the accumulator.
Ex. ORI 86H

• XRA
The contents of the accumulator are XORed with
the contents of the register or memory. The
result is placed in the accumulator.
Ex. XRA B or XRA M

• XRI
The contents of the accumulator are XORed with
the 8-bit data. The result is placed in the
accumulator.
Ex. XRI 86H
• RLC
Each binary bit of the accumulator is rotated left
by one position. Bit D7 is placed in the position of
D0 as well as in the Carry flag.
Ex. RLC

• RRC
Each binary bit of the accumulator is rotated
right by one position. Bit D0 is placed in the
position of D7 as well as in the Carry flag.
Ex. RRC

• RAL
Each binary bit of the accumulator is rotated left
by one position through the Carry flag. Bit D7 is
placed in the Carry flag, and the Carry flag is
placed in the least significant position D0. CY is
modified according to bit D7.

• RAR
Each binary bit of the accumulator is rotated
right by one position through the Carry flag. Bit
D0 is placed in the Carry flag, and the Carry flag is
placed in the most significant position D7. CY is
modified according to bit D0.
Ex. RAR
• CMA
The content of accumulator is complemented.
Ex. CMA

• CMC
The carry flag is complemented.
Ex. CMC

• STC
The carry flag is set to 1.
Ex. STC

ASSIGNMENT:

Q.1 WAP to program to perform division of two


8-bit numbers.
Output :
Q.2 WAP to count the numbers of 1’s in the
content of D register and the store the count in B
register.
Output:
Q.3 WAP to calculate sum of series of even
numbers.

Output:
Q.4 WAP to find 1’s complement and 2’s
complement of a number.
Output:

You might also like