Operations:

Syntax:

Operation:

Operands:

Program Counter:

Opcode

Comment

Stack

SBCI Rd,K

Rd = Rd - K - C

16 <= d <= 31, 0 <= K <= 255

PC = PC + 1

0100KKKKddddKKKK

Description

Subtracts a constant from a register and subtracts with the C flag, and places the result in the destination register Rd.

Status Register (SREG) and Boolean Formula

I

T

H

~Rd3 AND K3 OR K3 AND R3 OR R3 AND ~Rd3

Set if there was a borrow from bit 3; cleared otherwise.

S

N XOR V, for signed tests.

V

Rd7 AND ~K7 AND ~R7 OR ~Rd7 AND K7 AND R7

Set if two's complement overflow resulted from the operation; cleared otherwise.

N

R7

Set if MSB of the result is set; cleared otherwise.

Z

~R7 AND ~R6 AND ~R5 AND ~R4 AND ~R3 AND ~R2 AND ~R1 AND ~R0 AND Z

The previous value remains unchanged when the result is zero; cleared otherwise.

C

~Rd7 AND K7 OR K7 AND R7 OR R7 AND ~Rd7

Set if the absolute value of the constant plus previous carry is larger than the absolute value of Rd; cleared otherwise.

R (Result)

R (Result) equals Rd after the operation.

Example:

                          ; Subtract 0x4F23 from r17:r16
      subi  r16,0x23      ; Subtract low byte
      sbci  r17,0x4F      ; Subtract with carry high byte

Words

1 (2 bytes)

Table Cycles

Name

Cycles

AVRe

1

AVRxm

1

AVRxt

1

AVRrc

1