Knowledge Base

X = Y - X - ((R:0) ? 1 : 0); R:0 = <carry>; (Y = T; Z = T)

Binary 8-bit subtraction of X from Y with carry in. Pops the operands off the stack, leaves the result in X. If the subtraction produces a borrow, sets the carry flag.

The R register does double duty as result flags for binary arithmetic instructions.

From dialect 23 bit 0 of R is the carry flag. A carry out of an ADD, ADC, SUB or SBC instruction will set bit 0 of R.

The same bit 0 then acts as the carry input to ADC and SBC.

See also ADD, SUB, ADC, RtoX