X86-assembly/Instructions/xchg

From aldeid
Jump to navigation Jump to search
You are here:
xchg

Description

Exchanges (swaps) the value of 2 registers

Syntax

xchg destination, value

Example

mov eax, 2
mov edx, 3
xchg eax, edx

After the execution of the 3 above lines, EAX will equal 3 and EDX will equal 2.

Comments