beautypg.com

Subc – Texas Instruments TMS320C2XX User Manual

Page 334

background image

Conditional Subtract

SUBC

7-181

Assembly Language Instructions

SUBC affects OV but is not affected by OVM; therefore, the accumulator does
not saturate upon positive or negative overflows when executing this instruc-
tion. The carry bit is affected in the normal manner during this instruction: the
carry bit is cleared (C = 0) if the result of the subtraction generates a borrow
and is set (C = 1) if it does not generate a borrow.

Words

1

Cycles for a Single SUBC Instruction

Program

Operand

ROM

DARAM

SARAM

External

DARAM

1

1

1

1+p

SARAM

1

1

1, 2

1+p

External

1+d

1+d

1+d

2+d+p

† If the operand and the code are in the same SARAM block

Cycles for a Repeat (RPT) Execution of an SUBC Instruction

Program

Operand

ROM

DARAM

SARAM

External

DARAM

n

n

n

n+p

SARAM

n

n

n, n+1

n+p

External

n+nd

n+nd

n+nd

n+1+p+nd

† If the operand and the code are in the same SARAM block

Example 1

SUBC

DAT2

;(DP = 6)

Before Instruction

After Instruction

Data Memory

Data Memory

302h

01h

302h

01h

ACC

X

04h

ACC

0

08h

C

C

Example 2

RPT

#15

SUBC

*

Before Instruction

After Instruction

ARP

3

ARP

3

AR3

1000h

AR3

1000h

Data Memory

Data Memory

1000h

07h

1000h

07h

ACC

X

41h

ACC

1

20009h

C

C

Cycles