Siemens C500 User Manual page 99

Microcontroller family
Table of Contents

Advertisement

SUBB
A, <src-byte>
Function:
Subtract with borrow
Description:
SUBB subtracts the indicated variable and the carry flag together from the
accumulator, leaving the result in the accumulator. SUBB sets the carry (borrow)
flag if a borrow is needed for bit 7, and clears C otherwise. (If C was set before
executing a SUBB instruction, this indicates that a borrow was needed for the
previous step in a multiple precision subtraction, so the carry is subtracted from the
accumulator along with the source operand). AC is set if a borrow is needed for bit
3, and cleared otherwise. OV is set if a borrow is needed into bit 6 but not into bit 7,
or into bit 7 but not bit 6.
When subtracting signed integers OV indicates a negative number produced when
a negative value is subtracted from a positive value, or a positive result when a
positive number is subtracted from a negative number.
The source operand allows four addressing modes: register, direct, register-
indirect, or immediate.
Example:
The accumulator holds 0C9 H (11001001 B ), register 2 holds 54 H (01010100 B ), and
the carry flag is set. The instruction
SUBB
will leave the value 74 H (01110100 B ) in the accumulator, with the carry flag and AC
cleared but OV set.
Notice that 0C9 H minus 54 H is 75 H . The difference between this and the above
result is due to the (borrow) flag being set before the operation. If the state of the
carry is not known before starting a single or multiple-precision subtraction, it should
be explicitly cleared by a CLR C instruction.
SUBB
A,Rn
Operation:
SUBB
(A) ¬ (A) Ð (C) Ð (Rn)
Encoding:
1 0 0 1
Bytes:
1
Cycles:
1
Semiconductor Group
A,R2
1 r r r
4-73
Instruction Set
C500 Family
1998-04-01

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents