SBC

SBC

Subtract With Borrow (DALU)

Operation

Assembler Syntax

Db – Dc – C → Dd

SBC Dc,Dd

SBC

Description

SBC Dc,Dd

Subtracts the first data register (Dc) from the second (Dd), then subtracts the borrow (C bit) and stores the result in the second data register (Dd). The source operands are a data register pair. The destination register is the second register of the pair.

This instruction can be used in multiple-precision subtraction as illustrated in the example, which is a 64-bit subtraction.

Status and Conditions that Affect Instruction

Register Address

Bit Name

Description

SR[0]

C

Subtracted as a borrow from the LSB.

SR[5:4]

S[1:0]

Scaling mode bits determine which bits in the result are used in the Ln bit

 

 

calculation.

Status and Conditions Changed by Instruction

Register Address

Bit Name

Description

EMR[2]

DOVF

Set if the result cannot be represented in 40 bits.

Ln

L

Calculates and updates the Ln bit in the destination register.

SR[0]

C

Calculates and updates the carry bit in the status register.

Note: The carry bit is set correctly for multiple-precision arithmetic using long word operands if the extension of the destination data register is the sign-extension of bit 31.

Example

sub d0,d1,d1 sbc d2,d3

Register/Memory Address

D0

L1:D1

SR

D2

L3:D3

Before

$00 0000 0008

$0:$00 0000 0005

$00E4 0000

$00 0000 0003

$0:$00 0000 0005

After

$0:$FF FFFF FFFD

$00E4 0001

$0:$00 0000 0001

A-382

SC140 DSP Core Reference Manual

Page 696
Image 696
Freescale Semiconductor SC140 specifications Sbc, Subtract With Borrow Dalu, Db Dc C → Dd, SBC Dc,Dd