Day 21




The XCHG Instruction


	Why do I constantly demand having one of these intro sections???

The Info

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: push dx push ax pop dx pop ax 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: xchg bl,ch But you CANNOT do: xchg bx,ah 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

Patater GBAGuy Mirror
Contact