ADD 11 AND 22 IN BCD
0001
0010
0011
0001 111 BCD)
0010 (22 BCD)
0011 (33 BCD )
CY-0,H-0
ADD 19 AND 29 IN BCD
0001 1001
( 19 BCD)
0010 1001 (29 BCD)
D1 0010 (42 BCD. WRONG ) CY - 0, H - 1
0000 0110
ADJUST BY + 6 TO LOW ORDER BCD DIGIT
0100 1000
(48 BCD CORRECT)
ADD 91 AND 92 IN BCD
1001
0001
( 91 BCD)
CY
1001
0010
( 92 BCD)
1
0010
0011
(23 BCD: WRONG ) CY-1, H-0
C
0110
0000
ADJUST BY + 6 TO HIGH ORDER BCD DIGIT
II
1000
0011
( 83 BCD WITH CY -1 CORRECT)
ADD 99 AND 99 IN BCD
1001
1001
( 99 BCD(
1001
1001
(99 BCDI
L
0 011
1
0010
( 32 BCD. WRONG ) CY - 1, H -1
110
0
0110
ADJUST BY +6 TO BOTH BCD DIG ITS
1
1001
1000
(98 BCD WITH CY • 1 CORRECT)
Fig. 6 - 6. Bcd addition and use of CY and H.
Some examples of the above are shown in Fig. 6-6. For a subtract
(N = 1), a binary result must be corrected by subtracting a six from
a bed digit position under certain conditions. If there is a half-carry,
a six is subtracted from the least significant bed digit position. If
there is a carry, a six is subtracted from the most significant bed
digit position. If there are both a carry and half-carry, a six is sub-
tracted from each bed digit position. Fig. 6-7 illustrates the condi-
tions for bed subtract corrections.
Multiple-precision bed arithmetic is easily possible by maintain-
ing the carry from the last bed addition or subtraction.
102
Need help?
Do you have a question about the Z80 and is the answer not in the manual?
Questions and answers