add
Adds the value of the first operand to the second operand.
Sizes .b .w .l, .w by default
Used in
- The M68K instruction setM68K assembly
- The condition code registerM68K assembly
- Loops and dbraM68K assembly
- Arithmetic, logic and bitsM68K assembly
- Arrays, strings and (a0)+M68K assembly
- bsr, rts, link and unlkM68K assembly
- trap #15 and its tasksM68K assembly
- The screen, keyboard and mouse through trapsM68K assembly
- Moving values aroundM68K assembly
- Variables in memory and constantsM68K assembly
XNZVC ●●●●●
- ● set from the result
Forms
Operands
<ea>- An operand using one of the addressing modes listed for this form. The list determines whether it can be a register, memory or an immediate value. With
opt p=68020, an allowedd(An,Xn)ord(PC,Xn)mode also permits the corresponding 68020 indexed and memory indirect forms. See 68020 addressing. More #imm- An immediate value written after
#: a number, character or label, such as#10,#$FFor#'a'. It must fit the operation’s size: byte-128to255, word-32768to65535, or long-2147483648to4294967295; signed and unsigned spellings are accepted. More
If the second operand is an address register, the ADDA instruction is used instead.
* --- Different sizes ---
move.l #$FF, d0
add.b #$01, d0 ; only affects low byte
move.l #$10000, d1
add.w #$FFFF, d1 ; only affects low word
move.l #$10000000, d2
add.l #$F0000000, d2 ; carry flag set
* --- Overflow: signed result changes sign ---
move.l #$7F, d3
add.b #$01, d3 ; $80, V flag set