THE 8051 MICROCONTROLLER: THE PROGRAMMER’S PERSPECTIVE 509
We have used numbers which do not generate carries in the MSB addition. e
sum is limited to four hex digits. e sum is fi nally in R4 and R5, with R4 = 0A7H and
R5 = 4EH.
13.9.4.2 | Subtraction Instructions
SUBB A, src
is subtracts the source byte and the carry fl ag from A, and puts the result in A. e
OV, CY and AC fl ags are aff ected. is is actually a ‘subtract with borrow’ instruction.
ere is no subtraction instruction, as such. For subtraction, the carry fl ag is cleared and
then the operation is done.
An example of a typical set of instructions for carrying out subtraction is
MOV A, #78H ;A = 78H
CLR C ;C = 0
SUBB A, #23H ;A = A − 23H
e result of this subtraction will ...