English
Language : 

SH-2A Datasheet, PDF (277/501 Pages) Renesas Technology Corp – Renesas 32-Bit RISC Microcomputer SuperH™ RISC engine Family
6.4.61 SUBC
SUBtract with Carry
Binary Subtraction with Borrow
Section 6 Instruction Descriptions
Arithmetic Instruction
Format
SUBC Rm,Rn
Abstract
Rn – Rm– T → Rn, Borrow → T
Code
Cycle T Bit
0011nnnnmmmm1010 1
Borrow
Description
Subtracts Rm data and the T bit value from general register Rn data, and stores the result in Rn.
The T bit changes according to the result. This instruction is used for subtraction of data that has
more than 32 bits.
Operation
SUBC(long m,long n) /* SUBC Rm,Rn */
{
unsigned long tmp0,tmp1;
tmp1=R[n]-R[m];
tmp0=R[n];
R[n]=tmp1-T;
if (tmp0<tmp1) T=1;
else T=0;
if (tmp1<R[n]) T=1;
PC+=2;
}
Examples:
CLRT
SUBC R3,R1
SUBC R2,R0
; R0:R1(64 bits) – R2:R3(64 bits) = R0:R1(64 bits)
; Before execution: T = 0, R1 = H'00000000, R3 = H'00000001
; After execution: T = 1, R1 = H'FFFFFFFF
; Before execution: T = 1, R0 = H'00000000, R2 = H'00000000
; After execution: T = 1, R0 = H'FFFFFFFF
Rev. 3.00 Jul 08, 2005 page 263 of 484
REJ09B0051-0300