Slide 4.14: Control and status flags
Slide 4.16: SUB instruction
Home

ADD Instruction


The ADD instruction adds a source operand to a destination operand of the same size.

ADD — Arithmetic Addition
Usage: ADD dest, src

Flag O D I S Z A P C
Result *     * * * * *

Adds “src” to “dest” and replacing the original contents of “dest.” Both operands are binary.
Clocks
Operands 286 386 486 Size Bytes
reg, reg 2 2 1 2
mem, reg 7 7 3 2-4
reg, mem 7 6 2 2-4
reg, immed 3 2 1 3-4
mem, immed 7 7 3 3-6
accum, immed 3 2 1 2-3

Source is unchanged by the operation, and the sum is stored in the destination operand. The set of possible operands is the same as for the MOV instruction.

 Memory & Memory  Memory & Immediate  Memory & Register
 .data
 X   SDWORD   100
 Y   SDWORD  -200
 .code
 add   X, Y
 mov   eax, X
 call  WriteInt
 .data
 X   SDWORD  100
 .code
 add   X, -200
 mov   eax, X
 call  WriteInt
 .data
 X   SDWORD  100
 .code
 mov   eax, -200
 add   X, eax
 call  WriteInt
 Output  Output  Output
   



   



   




Note that the 80x86 assembly languages are case-insensitive.