FADD
Usage: FADD dest , src Modifies flags:
Adds the 'dest' and 'src' operands and stores the sum in the 'dest' location. The 'dest' operand is always an FPU register; the 'src' operand can be a register or a memory location. 'Src' operands in memory can be in single-precision or double-precision floating-point format or in word or doubleword integer format.
Floating-Point Addition
FADD mem32 ; D8 /0 [8086,FPU]
FADD mem64 ; DC /0 [8086,FPU]
FADD fpureg ; D8 C0+r [8086,FPU]
FADD ST0,fpureg ; D8 C0+r [8086,FPU]
FADD TO fpureg ; DC C0+r [8086,FPU]
FADD fpureg,ST0 ; DC C0+r [8086,FPU]
FADDP fpureg ; DE C0+r [8086,FPU]
FADDP fpureg,ST0 ; DE C0+r [8086,FPU]
FADD, given one operand, adds the operand to ST0 and stores the result back in ST0. If the operand has the TO modifier, the result is stored in the register given rather than in ST0.
FADDP performs the same function as FADD TO, but pops the register stack after storing the result.
The given two-operand forms are synonyms for the one-operand forms.
The no-operand version of the instruction adds the contents of the ST(0) register to the ST(1) register. The one-operand version adds the contents of a memory location (either a floating-point or an integer value) to the contents of the ST(0) register. The two operand version, adds the contents of the ST(0) register to the ST(i) register or vice versa.
To add an integer value to ST0, use the FIADD instruction.
FADD/FADDP/FIADD-Add
Opcode Instruction Description
D8 /0 FADD m32fp Add m32fp to ST(0) and store result in ST(0).
DC /0 FADD m64fp Add m64fp to ST(0) and store result in ST(0).
D8 C0 +i FADD ST(0), ST(i) Add ST(0) to ST(i) and store result in ST(0).
DC C0 +i FADD ST(i), ST(0) Add ST(i) to ST(0) and store result in ST(i).
DE C0 +i FADDP ST(i), ST(0) Add ST(0) to ST(i), store result in ST(i), and pop theregister stack.
DE C1 FADDP Add ST(0) to ST(1), store result in ST(1), and pop theregister stack.
DA /0 FIADD m32int Add m32int to ST(0) and store result in ST(0).
DE /0 FIADD m16int Add m16int to ST(0) and store result in ST(0).
EXAMPLE:
fadd Label
fadd st0
fadd st0, st0 ;Doubles the value in ST0.