5 - 14
(difference) obtained from addition (subtraction) is different from the usual negative number representation. When the
operation result is a negative value, 0 can never appear in the MSB of the sum (difference) operand. The carry flag
represents the positive value 32768 (2147483648) and the borrow flag represents the negative value −32768
(−2147483648).
Negative Value
(MSB=1)
Positive Value
(MSB=0)
0 Flag
=1
xxx,−2,−1,−32768,
(−2147483648)
,−2,−1,0,1,2,
,32767,0,1,xxx
(2147483647)
Borrow Flag=1 Carry Flag=1
x
x
MSB
↓
x
x
LSB
↓
x
x
C=1 B=0 Z=0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 32769
C=1 B=0 Z=0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 32768
C=0 B=0 Z=0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 32767
C=0 B=0 Z=0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 32766
C=0 B=0 Z=0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 32765
x
x
x
x
x
x
x
x
x
x
C=0 B=0 Z=0 0 0 0 0 000000000010 2
C=0 B=0 Z=0 0 0 0 0 000000000001 1
C=0 B=0 Z=1 0 0 0 0 000000000000 0
Positive Value
C=0 B=0 Z=0 1 1 1 1 111111111111 −1
C=0 B=0 Z=0 1 1 1 1 111111111110 −2
x
x
x
x
x
x
x
x
x
x
C=0 B=0 Z=0 1 0 0 0 000000000010 −32766
C=0 B=0 Z=0 1 0 0 0 000000000001 −32767
C=0 B=0 Z=0 1 0 0 0 000000000000 −32768
C=0 B=1 Z=0 1 1 1 1 111111111111 −32769
C=0 B=1 Z=0 1 1 1 1 111111111110 −32770
x
x
x
x
x
x
Negative Value
C = Carry B = Borrow Z = Zero