16 bit Assembly
Home Site Map Instruction Index
The XCHG instruction is used to swap the values of operand one with operand two. This command has 3 parts, Instruction, then either a Register or a memory address.
Assembly Sample | Description | 16 bit Machine Code |
---|---|---|
XCHG AX, BX | ; Swaps Register values | 93 |
XCHG BX, AX | ; Swaps Register values | 93 |
XCHG CX, BX | ; Swaps Register values | 87 CB |
XCHG BX, CX | ; Swaps Register values | 87 CB |
XCHG AX, [BX] | ; Swaps a Register with a memory address | 87 07 |
XCHG [BX], AX | ; Swaps a Register with a memory address | 87 07 |
XCHG [BX+2], CX | ; Swaps a Register with a memory address and offset | 87 4F 02 |