0% found this document useful (0 votes)
3 views2 pages

Instruction

The document explains the SBC (Subtract with Carry) instruction, detailing its syntax, operation, and the role of the Carry Flag in determining the subtraction outcome. It illustrates how the instruction works with an example, showing different results based on the Carry Flag's state. Additionally, it briefly introduces the RSB (Reverse Subtract) instruction with its syntax and purpose.

Uploaded by

prafullaenc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Instruction

The document explains the SBC (Subtract with Carry) instruction, detailing its syntax, operation, and the role of the Carry Flag in determining the subtraction outcome. It illustrates how the instruction works with an example, showing different results based on the Carry Flag's state. Additionally, it briefly introduces the RSB (Reverse Subtract) instruction with its syntax and purpose.

Uploaded by

prafullaenc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Instruction: SBC R7, R1, R0

 Mnemonic: SBC stands for Subtract with Carry.

 Syntax: SBC Rd, Rn, Rm

o Rd = Destination register

o Rn = First operand (minuend)

o Rm = Second operand (subtrahend)

 Rd = Rn - Rm - (1 - CarryFlag) //**It subtracts the value in Rm and the inverse of the carry flag
(i.e., it includes borrow) from Rn.**//

It’s typically used for multi-word subtraction, where subtraction carries over from previous word
operation.

🔸 Carry Flag Role

 If C = 1, then no borrow has occurred previously.

 If C = 0, then a borrow did occur.

So SBC effectively becomes:

 If C = 1: Rd = Rn - Rm

 If C = 0: Rd = Rn - Rm - 1

✅ Example:

Let's assume:

 R1 = 0x00000005 (5 in decimal)

 R0 = 0x00000003 (3 in decimal)

 Carry flag C = 1 (no borrow occurred previously)

 With C = 1:
 R7 = R1 - R0 - (1 - C)
 R7 = 5 - 3 - (1 - 1)
 R7 = 5 - 3 - 0 = 2
 So after execution, R7 = 2.

Now, if Carry flag C = 0 (borrow did occur before):


R7 = 5 - 3 - (1 - 0)
R7 = 5 - 3 - 1 = 1
So R7 = 1

🔹 Instruction: RSB R8, R1, R0


 Mnemonic: RSB stands for Reverse Subtract.
 Syntax: RSB Rd, Rn, Rm
o Rd = Destination register
o Rn = Operand
o Rm = Operand (gets subtracted from)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy