EasyManua.ls Logo

Intel 8080 - B4_Page_30

Intel 8080
224 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter
6.
Programming
Techniques
6-10
The following reentrant program
uses
the
Band
C registers
to
hold the dividend
and
quotient, and the D
and
E
register
to
hold the divisor
and
remainder. The
Hand
L registers
are
used
to
store data temporarily.
DIV:
MOV
CMA
MOV
MOV
CMA
MOV
INX
LXI
MVI
DVO:
PUSH
DAD
INC
XTHL
DVl:
POP
PUSH
MOV
RAL
MOV
MOV
RAL
MOV
MOV
RAL
MOV
MOV
RAL
MOV
POP
DCR
JNZ
;POST-DIVIDE CLEAN
UP
A,D
D,A
A,E
E,A
D
H,O
A,I7
H
D
DVI
H
PSW
A,C
C,A
A,B
B,A
A,L
L,A
A,H
H,A
PSW
A
DVO
;NEGATE THE
DIVISOR
;FOR TWO'S COMPLEMENT
;INITIAL
VALUE
FOR
REMAINDER
;INITIALIZE
LOOP COUNTER
;SAVE
REMAINDER
;SUBTRACT DIVISOR
(ADD
NEGATIVE)
;UNDER FLOW, RESTORE
HL
;SAVE LOOP COUNTER (A)
;4
REGISTER LEFT SHIFT
;WITH
CARRY
;CY->C>B
>L->H
;RESTORE LOOP COUNTER (A)
;DECREMENT
IT
;KEEP LOOPING
;SHIFT
REMAINDER
RIGHT
AND
RETURN IN
DE
ORA
A
MOV
A,H
RAR
MOV
D,A
MOV
A,L
RAR
MOV
E,A
RET
END

Table of Contents

Related product manuals