Division of Two 8 bit Numbers using 8085 microprocessor
In this post, you will find the required algorithm, & 8085 program code to perform the Division of two 8 bit numbers using the 8085 microprocessor. Also, you will get the observation and result.
Algorithm for Division of Two 8 bit Numbers using 8085
1) Start the program by loading HL register pair with the address of memory location.
2) Move the data to a register(B register).
3) Get the second data and load it into Accumulator.
4) Compare the two numbers to check for the carry.
5) Subtract the two numbers.
6) Increment the value of the carry.
7) Check whether repeated subtraction is over and store the value of the product and the carry in the memory location.
8) Terminate the program.
Program for Division of Two 8 bit Numbers using 8085
LXI H, 4150
MOV B, M //Get the dividend in B – reg.
MVI C, 00 //Clear C – reg for qoutient
INX H
MOV A, M //Get the divisor in A – reg.
NEXT: CMP B //Compare A – reg with register B.
JC LOOP //Jump on carry to LOOP
SUB B //Subtract A – reg from B- reg.
INR C //Increment content of register C.
JMP NEXT //Jump to NEXT
LOOP: STA 4152 //Store the remainder in Memory
MOV A, C
STA 4153 //Store the quotient in memory
HLT //Terminate the program.
Observation
Input:
FF (4150)
FF (4251)
Output:
01 (4152) —- Remainder
FE (4153) —- Quotient
Result
Thus the 8085 microprocessor program to divide two 8-bit numbers was executed.