EasyManua.ls Logo

Intel 8080 - B4_Page_35

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
The detailed procedure for subtracting multi-digit decimal numbers
is
as follows:
1. Set the carry flag
= 1 to indicate no borrow.
2.
Load the accumulator with 99H, representing the number 99 decimal.
3. Add zero to the accumulator with carry, producing either 99H or 9AH,
and resetting the
carry flag.
4. Subtract the subtrahend digits from the accumulator, producing either the nines or tens
complement.
5.
Add the minuend digits to the accumulator.
6.
Use
the
OAA
instruction to make sure the result
in
the accumulator
is
in
decimal format, and
to indicate a borrow
in
the carry flag
if
one occurred.
7.
If
there are more digits to subtract,
go
to step 2. Otherwise, stop.
Example:
Perform the decimal subtraction:
1 . Set carry
::
1.
43580
-13620
29960
2.
Load accumulator with 99H.
3. Add zero with carry to the accumulator, producing 9AH.
Accumulator
= 10011001 B
=
OOOOOOOOB
Carry
10011010B
=:
9AH
4.
Subtract the subtrahend digits 62 from the accumulatnr.
Accumulator
=: 1001101
OB
62
= 1001111
OB
]]
00111000B
6-15

Table of Contents

Related product manuals