Professional Documents
Culture Documents
Algorithms
-assignment 2
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:
Output:
Q.4 WAP to find 1’s complement and 2’s
complement of a number.
Output: