Semiconductor Group
4-27
1998-04-01
Instruction Set
C500 Family
BCD variables can be incremented or decremented by adding 01H or 99H. If the
accumulator initially holds 30H (representing the digits of 30 decimal), then the
instruction sequence
ADD
A, #99H
DA
A
will leave the carry set and 29H in the accumulator, since 30 + 99 = 129. The low-
order byte of the sum can be interpreted to mean 30 Ð 1 = 29.
Operation:
DA
contents of accumulator are BCD
if [[(A3-0) > 9]
Ú
[(AC) = 1]]
then (A3-0)
¬
(A3-0) + 6
and
if [[(A7-4) > 9]
Ú
[(C) = 1]]
then (A7-4)
¬
(A7-4) + 6
Bytes:
1
Cycles:
1
Encoding:
1 1 0 1
0 1 0 0