The data swap instruction is used to swap a byte or word quantity between a register and external memory.
This instruction is implemented as a memory read followed by a memory write which are “locked”
together (the processor cannot be interrupted until both operations have completed, and the memory
manager is warned to treat them as inseparable). This class of instruction is particularly useful for
implementing software semaphores.