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:
©Dixit Bhatta 2013
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
|