<<< CMP Arithmetic Comparison     Index     IMUL Signed Integer Multiplication >>>


DEC Decrement Operand

Flags affected:

        O D I T S Z A P C  OF: Overflow flag  TF: Trap flag AF: Aux carry
        F F F F F F F F F  DF: Direction flag SF: Sign flag PF: Parity flag
        *         * * * *  IF: Interrupt flag ZF: Zero flag CF: Carry flag

Legal forms:

        DEC m8
        DEC m16
        DEC m32
        DEC r8
        DEC r16
        DEC r32

Examples:

        DEC AL
        DEC CX
        DEC EBX
        DEC BYTE [BP]   ; Decrements the BYTE at [BP]
        DEC WORD [BX]   ; Decrements the WORD at [BX]
        DEC DWORD [EDX] ; Decrements the DWORD at [EDX]

Notes:

Remember that segment registers cannot be decremented with DEC. All register-half opcodes are 2 bytes in length, but all 16-bit register opcodes are 1 byte in length. If you can decrement an entire register of which only the lower half contains data, use the 16-bit opcode and save a byte.

As with all instructions that act on memory, memory data forms must be used with a data size specifier such as BYTE, WORD, and DWORD! NASM doesn't assume anything!

        r8 = AL AH BL BH CL CH DL DH        r16 = AX BX CX DX BP SP SI DI
        sr = CS DS SS ES FS GS              r32 = EAX EBX ECX EDX EBP ESP ESI EDI
        m8 = 8-bit memory data              m16 = 16-bit memory data
        m32 = 32-bit memory data            i8 = 8-bit immediate data
        i16 = 16-bit immediate data         i32 = 32-bit immediate data
        d8 = 8-bit signed displacement      d16 = 16-bit signed displacement
        d32 = 32-bit unsigned displacement


<<< CMP Arithmetic Comparison     Index     IMUL Signed Integer Multiplication >>>