8085 Program to divide a 16-bit number with an 8-bit number

8085 is a Microprocessor which was developed by Intel in 1970s. All the instructions in this microprocessor are encoded in a single byte. Some of the instructions are followed by one or two bytes of data, which can be a memory address, an immediate operand or a port number.

In this post, we will write a program in 8085 to divide a 16-bit number with an 8-bit number.

Algorithm

Start
Read dividend(16 bit)
Read divisor
count <- 8
Left shift dividend
Subtract divisor from upper 8-bits of dividend
If CS != 1 go to 9
restore dividend
Increment lower 8-bits of dividend
count <- count - 1
If count != 0 go to 5
Store upper 8-bit dividend as remainder and lower 8-bit as quotient
Stop

Flow Chart

8085 Program to divide a 16-bit number with an 8-bit number flow chart

Program

      LHLD 2100H
      LDA 2102H
      MOV B, A
      MVI C, 08H
BACK: DAD H
      MOV A, H
      SUB B
      JC NEXT
      MOV H, A
      INR L
NEXT: DCR C
      JNZ BACK
      SHLD 2103H
      RST-5

Example

2100H: 0C
2101H: 00
2102H: 07
2103H: 01  ->  quotient
2104H: 05  ->  remainder

Check out our other 8085 programs

Let us know in the comments if you are having any questions regarding this microprocessor program.

And if you found this post helpful, then please help us by sharing this post with your friends. Thank You

Leave a Reply