# Carry Flag

### From Intellivision Wiki

The Carry Flag (C), if set, indicates that the previous operation resulted in an unsigned integer overflow. If clear, the previous operation did not result in an unsigned integer overflow.

For unsigned addition, the Carry is set when the addition's result is larger than what would fit in a 16-bit register, and cleared otherwise. For unsigned subtraction, the Carry is set whenever the minuend (the number being subtracted from) is greater than or equal to the subtrahend (the number being subtracted), and cleared otherwise. (In essence, it indicates "Did Not Borrow.") The Carry bit can be used in conjunction with ADCR to perform Extended Precision Arithmetic.

Since the CMP family of instructions compare numbers by subtracting them, one sometimes sees Branch if Carry set described as an unsigned variation of "Branch if Greater-than or Equal" (also BHIS: Branch if HIgher or Same), and Branch if No Carry set described as an unsigned variation of "Branch if Less-than" (also BLO: Branch if LOwer). The names BHIS and BLO come from the PDP-11.

The behavior of the following opcodes is affected by the status of the Carry Flag.

BC

BNC

BUSC

BESC

ADCR

GSWD

RLC*

RRC*

In addition to affecting the behavior of the opcodes above, the following opcodes affect the status of the Carry Flag.

CLRC

SETC

NEGR

ADCR

RSWD*

RRC*

RLC*

SARC*

SLLC*

ADDR

SUBR

CMPR

ADD

ADD@

SUB

SUB@

CMP

CMP@

- Indicates slight variation from normal Carry Flag behavior. See opcode documentation for more details.