Home »
Embedded Systems
Divide Two 8-bit Numbers using 8085 Microprocessor
In this tutorial, we will learn how to divide two 8-bit numbers in 8085 Microprocessor?
By Akash Kumar Last updated : May 13, 2023
Division of Two 8-bit Numbers using 8085 Microprocessor
Given two 8-bit numbers, we have to divide them in 8085 Microprocessor.
Algorithm
- Load the HL pair registers with address of memory location.
- Move the first data to register B.
- Move the second data to the accumulator.
- Then compare two numbers for carry.
- Subtract the content of Register B to the content of accumulator.
- Then increment the value of carry.
- Then check whether the repeated subtraction is over.
- If the repeated subtraction is over then store the value of quotient and remainder in the given memory location.
Program
LXI H, 3050
MOV B, M
MVI D, 00
INX H
MOV A, M
*** CMP B
JC **
SUB B
INR C
JMP ***
** STA 3052
MOV A, C
STA 3053
HLT
Observation
INPUT:
3050:04
3051:02
OUTPUT:
3052:02
3053:00
Hence we successfully divided two 8 bits numbers.