Add instruction

Instruction Add
Syntax Add Destination, Source1, Source2[, Overflow-Label]
Constraints Destination, Source1, and Source2 are all of the same type
Process Destination := Source1 + Source2
If Overflow Detected Then Go To Overflow-Label

The Add instruction is used to add two integral or decimal variables together.

This instruction is not capable of converting a value to another. See the convert instruction instead.

The optional overflow label is used in case an overflow is detected by the processor. For example, adding to signed integers on an Pentium processor sets the V flag to 1 on overflow (when the result of the addition of the two sources is mathematically incorrect.) The overflow label is the name of the exception to raise on overflow.

Signed, unsigned, floating point, and fixed point numbers may all use different capabilities of the process to detect an overflow. On the INTEL processor, Signed integers use the V flag (Overflow) whereas unsigned will use the C flag (Carry).

Syndicate content