6F3B0253

7. Instructions

FUN 035

+C

Addition with carry

Expression

Input [ A +C B C ]Output

Function

When the input is ON, the data of A, B and the carry flag (CF = S050) are added, and the result is stored in C. If carry is occurred in the operation, the carry flag is set to ON. If the result is greater than 32767 or smaller than -32768, the output is turned ON.

This instruction is used to perform unsigned addition or double-length addition.

Execution condition

Input

 

Operation

Output

CF

OFF

No execution

 

OFF

ON

Execution

Normal

No carry

OFF

Reset

 

 

 

Carry occurred

OFF

Set

 

 

Overflow /

No carry

ON

Reset

 

 

underflow

Carry occurred

ON

Set

Operand

 

Name

 

 

Device

 

 

 

 

 

 

 

 

 

Register

 

 

 

 

 

Constant

Index

 

 

X

Y

R

S

T.

C.

XW

YW

RW

SW

T

C

D

I

 

J

K

 

 

A

Augend

 

 

 

 

 

 

 

 

 

 

B

Addend

 

 

 

 

 

 

 

 

 

 

C

Sum

 

 

 

 

 

 

 

 

 

 

 

 

Example

When R013 is ON, the data of double-length registers D0101D0100 and RW21RW20 are added, and the result is stored in D0201D0200. The RSTC is a instruction to reset the carry flag before starting the calculation.

If the data of D0101D0100 is 12345678 and RW21RW20 is 54322, the result 12400000 is stored in D0201D0200.

D0101D0100

RW21RW20

12345678

+ D0201D0200

54322

12400000

Basic Hardware and Function 149

Page 151
Image 151
Toshiba 6F3B0253 user manual FUN Addition with carry