The XCHG Instruction
Why do I constantly demand having one of these intro sections???
Patater GBAGuy Mirror
You know that the MOV instruction moves values between registers, however, sometimes
this is not entirely what you want. Sometimes, you want to SWITCH values without destroying
the value of a register. You could just do something like:
But that's not good, you should do:
xchg ax,dx ; will switch the values in AX and DX.
Note that you can also do:
But you CANNOT do:
AH is only 8bits and BX is 16bits, how is that supposed to work? (That won't even assemble!)
This Day In Review
This is a convenient instruction, never forget it!
Until Next Time!,
- Mike H
Intro - Day 22