PadhaikoAll subjects

Past exam question: 2082 Kartik (Back), Q3

Microprocessors · 6 marks

Open in the Padhaiko app

Topic: 8085 Programs: Arithmetic, Loops, Arrays, BCD, Multiply/Divide

Question

Write a program in 8085 to multiply two 8 bit binary numbers stored at 2050H and 2051H where multiplicand is at 2050H and multiplier is at 2051H. Store 16 bit result at memory location 2052H.

Solution

Algorithm & Repeated Addition Design:

8085 Assembly Language Program:

8085 8-Bit Multiplication (16-Bit Product)8085 ASM
          LDA 2051H          ; Load multiplier into accumulator
          MOV C, A           ; C = multiplier (loop counter)
          ORA A              ; Test if multiplier is zero
          JZ  STORE_ZERO     ; If multiplier is 0, product is 0

          LDA 2050H          ; Load multiplicand into accumulator
          MOV E, A           ; E = multiplicand
          MVI D, 00H         ; D = 00H (DE = 16-bit multiplicand)
          LXI H, 0000H       ; HL = 0000H (16-bit product accumulator)

MULT_LOOP:
          DAD D              ; HL = HL + DE (add multiplicand)
          DCR C              ; Decrement loop counter
          JNZ MULT_LOOP      ; Repeat until counter reaches 0
          JMP STORE_RES

STORE_ZERO:
          LXI H, 0000H       ; Result is zero

STORE_RES:
          SHLD 2052H         ; Store lower byte at 2052H, higher byte at 2053H
          HLT                ; Terminate program

Trace Example:

Answer:

The program performs repeated addition by adding the 16-bit extended multiplicand in DE to HL using DAD D for multiplier times (counter C), then saves the 16-bit product to 2052H and 2053H using SHLD 2052H.

All past exam questions for Microprocessors