Computer Science, asked by arorabhumi1133, 1 year ago

Which one of the following 8085 microprocessor programs correctly calculates
the product of two 8-bit numbers stored in registers B and C?
(A) MVI A, 00H
JNZ LOOP
CMP C
LOOP DCR B
HLT
(B) MVI A, 00H
CMP C
LOOP DCR B
JNZ LOOP
HLT
(C) MVI A, 00H
LOOP ADD C
DCR B
JNZ LOOP
HLT
(D) MVI A, 00H
ADD C
JNZ LOOP
LOOP INR B
HLT

Answers

Answered by cat911
1
c) one will be the correct answer
Answered by shubhamjoshi033
3

The correct answer is option C

           MVI A, 00H

LOOP ADD C

          DCR B

          JNZ LOOP

          HLT

Explanation :

We have to multiply B and C which is equivalent to adding C register B number of times. Hence the program works in the following way:

 MVI A, 00H  -----------> Reset the accumulator i.e put 00 in the accumulator.

LOOP ADD C  ----------> Add value of C to accumulator.

          DCR B  -----------> Decrement B register

          JNZ LOOP  -----------> till B becomes 0 jumps to LOOP and repeat

          HLT ----------->  Halts

Hence C register will be added to itself until B becomes 0 i.e. B number of times which is equal to multiplication of B and C.

Similar questions