3. To perform multiplication and division of two 8 bit numbers using 8085.

 ORG 0000h    ; Starting address of the program


; Multiplication of two 8-bit numbers

MVI A, 0Ah    ; Load first 8-bit number in register A

MVI B, 02h    ; Load second 8-bit number in register B

MVI C, 00h    ; Clear register C

MVI D, 08h    ; Set loop counter to 8

LOOP:

MOV E, A      ; Copy A to E

RLC          ; Rotate left through carry

JNC SKIP     ; Jump to SKIP if MSB of A is not set

ADD B        ; Add B to C if MSB of A is set

SKIP:

RRC          ; Rotate right through carry

DCR D        ; Decrement loop counter

JNZ LOOP     ; Jump to LOOP if loop counter is not zero

HLT          ; End of program


; Division of two 8-bit numbers

MVI A, 0Fh    ; Load dividend in register A

MVI B, 03h    ; Load divisor in register B

MVI C, 00h    ; Clear quotient in register C

MVI D, 08h    ; Set loop counter to 8

DIVLOOP:

RLC          ; Rotate left through carry

SUB B        ; Subtract divisor from dividend

JC NOBORROW  ; Jump to NOBORROW if there is no borrow

ADD B        ; Add divisor back to dividend

NOBORROW:

RAR          ; Rotate right through carry

DAA          ; Decimal adjust after subtraction

JNC SKIP1    ; Jump to SKIP1 if quotient bit is zero

INR C        ; Increment quotient if quotient bit is one

SKIP1:

DCR D        ; Decrement loop counter

JNZ DIVLOOP  ; Jump to DIVLOOP if loop counter is not zero

HLT          ; End of program


END          ; End of program