Intel MCS 51 User Manual page 100

Table of Contents

Advertisement

i@.
MCS"-51PROGRAMMER'S G UIDEANDINSTRUCTION SET
SUBB A<sro-byte>
Function:
Deeoription:
SUBB A,Rn
Bytes:
Cycles:
Encoding:
Operation:
Subtract with bOrrOW
SUBBsubtracts the indicated variable and the carry tlag together from the Accumulator,
lesvingthe result in the Accumulator.SUBBsets the carry (borrow)tlag if a borrowis needed
for bit 7, and cleam C otherwise. (H c was set
bqfors executing
a SUBBinstruction, this
indicates
that
a borrow was
neededfor the previousstepin a multipleprecisionsubtraction,so
the csrry is subtracted from the Accumulatoralong with the source operand.)AC is set if a
borrowis neededfor bit 3, and clearedotherwise.OVis set ifa borrowis neededinto bit 6, but
not into bit 7, or into bit 7, but not bit 6.
When subtraetm " g signedintegersOV indicatesa negativenumber produwd whena negative
value is subtracted from a positive value, or a positive result when a positive number is
subtractedfrom a negativenumber.
The sourceoperandallowsfour addressingmodes:register,direct, register-indirecL or imme-
diate.
The AccumulatorholdsOC9H(11OO1OO1B),
register2 holds 54H (O1O1O1OOB),
and the carry
flag is set. The instruction,
SUBB A,R2
will leavethe value 74H (O1I1O1OOB)
in the accumulator,with the cany flag and AC cleared
but OVset.
Notice that OC9Hminus 54H is 75H.The differencebetweem this and the aboveresult is due
to the carry (borrow)flag beingset beforethe operation.If the state of the carry is not known
before starting a singleor multiple-precision subtraction, it should be explicitlycleared by a
CLR C instruction.
1
1
I
1001
Irrr
SUBB
(A) -
(A) - (C) - (IQ
2-70

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the MCS 51 and is the answer not in the manual?

Table of Contents

Save PDF