inc

Increment by 1

Adds 1 to the operand and stores the result there, leaving the carry flag unchanged.

8086 and lateraccepts the lock prefix with a memory operand

Intel's reference: INC

CFPFAFZFSFDFOF –●●●●–●
  • ● depends on the result
  • – not changed

Forms

Operands

r/m
A general-purpose register or memory location matching the operation’s size, for example rax or qword [rbp-8].

It does not affect the carry flag: to affect the carry flag, use ADD something,1. INC affects all the other flags according to the result.

This instruction can be used with a LOCK prefix to allow atomic execution.

See also DEC.

global _start

section .text
_start:
        mov rax, 12
        mov rbx, 5
        mov rcx, 3
        mov rsi, 9

        inc rax

        mov rax, 60         ; syscall 60: exit
        xor rdi, rdi
        syscall