ADD – ADDITION
DEC – DECREMENT
Operation
(DEST)
(LSRC) + (RSRC)
Flags Affected Description
AF, CF, OF, PF, SF, ZF ADD destination, source
Operation
(DEST)
Flags Affected Description
AF, OF, PF, SF, ZF
The sum of the two operands, which may be bytes or words, replaces the destination operand. Both operands may be signed or unsigned binary numbers (see AAA and DAA). ADD updates AF, CF, OF, PF, SF and ZF. Encoding
DEC (Decrement) subtracts one from the destination operand. The operand may be a byte or a word and is treated as an unsigned binary number (see AA and DAA). DEC updates AF, OF, PF, SF and ZF; it does not affect CF.
Encoding
Memory or Register Operand with Register Operand 0 0 0 0 0 0 d w
mod reg r/m
data low
data high
8-bit Register or Memory 1 1 1 1 1 1 1 w
mod 0 0 1 r/m
If d=1 then LSRC = REG, RSRC = EA, DEST = REG, else LSRC = EA, RSRC = REG, DEST = EA.
DEST = EA.
Immediate Operand to Memory or Register Operand
16-bit Register Operand
1 0 0 0 0 0 s w
mod 0 0 0 r/m
data
data if w=1
LSRC = EA, RSRC = data, DEST = EA. Immediate Operand to Accumulato Accumulatorr 0 0 0 0 0 1 0 w
data
data if w=1
If w=0 then LSRC = AL, RSRC = data, DEST = AL, else LSRC = AX, RSRC = data, DEST = AX. ADD Operands
Clocks
Transfers
Bytes
3
-
2
register,memory
9 + EA
1
2-4
memory,register
register,register
0 1 0 0 1 reg
DEST = REG. DEC Operands reg16 reg8 memory
Clocks 3 3 15 + EA
Transfers 2
Bytes 1 2 2-4
ADD Coding Example DEC AX DEC AL DEC ARRAY[SI]
ADD Coding Example ADD CX, DX ADD DI, [BX]ALPHA
16 + EA
2
2-4
ADD TEMP, CL
register,immediate
4
-
3-4
ADD CL,2
memory,immediate
17 + EA
2
3-6
ADD ALPHA,2
4
-
2-3
MOV AX, 200
accumulator,immediate
(DEST) – 1
JNE – JUMP ON NOT EQUAL / JNZ – JUMP ON NOT ZERO Operation Flags Affected Description
If (ZF) = 0 then (IP) none
(IP) + disp (sign extended to 16-bits)
JNE (Jump on Not Equal to)/JNZ (Jump on Not Zero) transfers control to the target operand (IP + displacement) if the condition tested (ZF = 0) is true.
Encoding 0 1 1 1 0 1 0 1
JNE/JNZ Operands
Short-label
Disp
Clocks
Transfers
B ytes Bytes
16 or 4
-
2
ADD Coding Example _EQUAL _ JNE NOT