# 8085 Program to Divide a 16-bit number by an 8-bit number

In this program we will see how to divide a 16-bit number by an 8-bit number

### Problem Statement

Write 8085 Assembly language program to divide a 16-bit number by an 8-bit number.

### Discussion

In this program we are taking the 16-bit number from 8000H and 8001H. The 8000H is holding the lower order byte and 8001H is holding higher order byte. The8002H is holding the 8-bit numerator. After dividing the number the16-bit quotient is stored at location 8050H and 8051H. The remainderis stored at 8052H.

.
.
.
.
.
.
80002B
8001CA
800253
.
.
.
.
.
.

### Program

F00021, 00, 80
F0037E
MOV A, MStore the lower order byte
F00423
INX H   Increase the HL pair to point next loc
F00546
MOV B, MStore the higher order byte
F00623
INX H   Increase the HL pair to point next loc
F0074E
F00804
INR BIncrease B register
F00921, 00, 00
LXI H,0000HStore 0000Hinto HL pair
F00C91LOOPSUB C   Subtract C from acc
F00DDA, 14, F0
F01023INCRINX H   Increase quotient part
F011C3, 0C, F0
F01405SKIPDCR B   Decrease B
F015CA, 1B, F0
F018C3, 10, F0
F01CEB
XCHG    swap DE andHL pair contents
F01D21, 50, 80
F02073
MOV M,EStore the lower order quotient
F02123
INX H   Increase HLpair
F02272
MOV M,DStore the higher order quotient
F02323
INX H   Increase HLpair
F02477
MOV M,AStore the remainder
F02576
HLTTerminate the program

### Output

.
.
.
.
.
.
80506F
805102
80522E
.
.
.
.
.
.

Updated on: 30-Jul-2019

3K+ Views