Friday, 28 June 2013

8085 program for 8 bit binary division

Here, dividend is of 16 bits and divisor is of 8 bits. Dividend is stored in 8DC1 (LSB) and 8DC2 (MSB), divisor is stored in 8DC3, quotient is in 8DC4 and remainder is in 8DC5.

Mnemonics:

LHLD 8DC1H
LDA 8DC3H
MOV B, A
MVI C, 08

LOOP:
   DAD H
   MOV A, H
   SUB B
   JC AHEAD
   MOV H, A
   INR L

AHEAD:
   DCR C
   JNZ LOOP
   SHLD 8DC4H
   HLT

Observation Table:
Memory Address
Content
8DC1
04H
8DC2
01H
8DC3
03H
8DC4
56H
8DC5
02H


©Dixit Bhatta 2013

2 comments:

  1. what if quotient size is of 2 bytes ..???

    ReplyDelete
    Replies
    1. "Here, dividend is of 16 bits and divisor is of 8 bits." Will it have a quotient of size 2 bytes?

      Delete

Was this post helpful? Ask any questions you have, I will try to answer them for you.

Follow by Email