Slide 7.1: Programming Laboratory III: calculating a string expression
Slide 7.3: NEG instruction
Home

INC and DEC Instructions


The INC instruction adds 1 to a single operand, and the DEC instruction subtracts 1 from a single operand.

INC — Increment

Usage: INC dest

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

Adds one to destination unsigned binary operand.

Clocks
Operand 286 386 486 Size Bytes
reg8 2 2 1 2
reg16/32 2 2 1 1
mem 7 6 3 2-4

DEC — Decrement

Usage: DEC dest

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

Unsigned binary subtraction of one from the destination.

Clocks
Operand 286 386 486 Size Bytes
reg8 2 2 1 2
reg16/32 2 2 1 1
mem 7 6 3 2-4


 INC X+1  ADD X+1, 1  DEC [OFFSET X]
 .data
 X   WORD  1234h
 .code
 inc    X+1
 movzx  eax, X
 call   WriteHex
 .data
 X   WORD  1234h
 .code
 add    X+1, 1
 movzx  eax, X
 call   WriteHex
 .data
 X   WORD  1234h
 .code
 mov    ebx, OFFSET X
 dec    [ebx]
 movzx  eax, X
 call   WriteHex
 Output  Output  Output