![](http://datasheet.mmic.net.cn/380000/-PD784928Y_datasheet_16744934/-PD784928Y_309.png)
309
CHAPTER 7 DESCRIPTION OF INSTRUCTIONS
Subtract with Carry
Byte Data Subtraction including Carry
[Instruction format]
SUBC dst, src
[Operation]
dst, CY
←
dst – src – CY
[Operands]
Mnemonic
Operands (dst, src)
Mnemonic
Operands (dst, src)
SUBC
A, #byte
SUBC
A, [saddrp]
r, #byte
A, [%saddrg]
saddr, #byte
[saddrp], A
sfr, #byte
[%saddrg], A
r, r’
A, !addr16
A, saddr2
A, !!addr24
r, saddr
!addr16, A
saddr, r
!!addr24, A
r, sfr
A, mem
sfr, r
mem, A
saddr, saddr’
[Flags]
S
Z
AC
P/V
CY
×
×
×
V
×
[Description]
The source operand (src) specified by the 2nd operand and the CY flag are subtracted from the destination
operand (dst) specified by the 1st operand, and the result is stored in the destination operand (dst) and the CY
flag. The CY flag is subtracted from the LSB. This instruction is mainly used when performing multiple byte
subtraction.
The S flag is set (1) if bit 7 of dst is set (1) as a result of the subtraction, and cleared (0) otherwise.
The Z flag is set (1) if dst is 0 as a result of the subtraction, and cleared (0) otherwise.
The AC flag is set (1) if a borrow is generated out of bit 4 into bit 3 as a result of the subtraction, and cleared
(0) otherwise.
The P/V flag is set (1) if a borrow is generated out of bit 6 into bit 7 and a borrow is not generated in bit 7 as
a result of the subtraction (when underflow is generated by a two’s complement type operation), or if a borrow
is not generated out of bit 6 into bit 7 and a borrow is generated in bit 7 (when overflow is generated by a two’s
complement type operation), and is cleared (0) otherwise.
The CY flag is set (1) if a borrow is generated in bit 7 as a result of the subtraction, and cleared (0) otherwise.
[Coding example]
SUBC A, [TDE+] ; Subtracts the contents of the TDE register address and the CY flag from the A register, and
stores the result in the A register (the TDE register is incremented after the subtraction)
SUBC