You are on page 1of 1

Microprocessor 8085

Appendix A

Explanation :

Get the dividend in the HL register pair. Get the divisor in the accumulator and store it in register C.
Initialize quotient in register pair DE as 00 H.
Perform the division by subtracting the divisor from the dividend, till the dividend is greater than the
divisor. Increment the quotient every time the dividend is greater than the divisor when the
subtraction is performed.
When the dividend becomes less than the divisor then this dividend is the remainder. Store the
quotient and remainder.

Algorithm :

Step I
Step II
Step III
Step IV

:
:
:
:

Step V
Step VI

:
:

Step VII :
Step VIII :
Step IX :

Get the dividend in the HL register pair.


Get the divisor in the accumulator
Initialize quotient =0
Perform division,
Division = Dividend Divisor
Increment quotient by 1
Check if dividend < divisor,
if not zero goto step IV
Remainder = Dividend
Store the quotient and remainder.
Stop.

Flowchart : Refer flowchart 21.

Program :

Instruction
LHLD
D000H
LDA D002H
MOV C, A
LXI D, 0000H
BACK:MOV A, L
SUB C
MOV L, A
JNC SKIP
DCR H
SKIP: INX D
21
MOV A, H
CPI 00
JNZ BACK
MOV A, L
CMP C
JNC BACK
SHLD
E002H
XCHG
SHLD
E000H
HLT

Comment
; Get the dividend
; Get the divisor
; Store the divisor in C
; Initialize Quotient = 0
;
; Division = Dividend Divisor
; Subtract borrow of previous subtraction
; quotient = quotient + 1
; Check if dividend < divisor
; if no repeat
; Store the remainder
; Store the quotient
; Terminate program execution

Flowchart

You might also like