6.1 Data-Transfer Instructions
Chapter 5 taught you how instruction bytes identify operands. We now ask the next question: after the CPU decodes those bytes, what state actually changes? A data-transfer instruction copies, exchanges, loads, or stores a bit pattern. “Transfer” does not mean the source disappears; the CPU normally reads a source and writes an identical copy to the destination.
MOV: copy without destroying the source
MOV destination,source copies one byte or one word. The operands must have the same width. MOV AX,BL is therefore invalid: AX is 16 bits while BL is 8 bits.
The ordinary 8086 MOV instruction supports register-to-register, immediate-to-register or memory, register-to-memory, and memory-to-register transfers. It does not support a general memory-to-memory form because its encoding has room for at most one ordinary memory operand. A program must use a register as an intermediate:
MOV AX,[1000H]
MOV [1002H],AXInstruction fetching still uses memory, but when we discuss an operand bus cycle, we mean the extra read or write needed for the data operand. MOV AX,BX needs no operand-memory cycle. MOV AX,[1000H] needs one read, and MOV [1000H],AX needs one write.
MOV, XCHG, LEA, PUSH, and POP do not modify arithmetic status flags. This lets a program move values without destroying a comparison result that a later conditional jump needs.
XCHG and LEA solve different problems
XCHG left,right swaps two operands. A temporary internal value prevents either original from being lost. At least one operand must be a register; two memory operands are not allowed.
LEA register,memory-expression means load effective address. It calculates the offset described by a memory expression and writes that number into a register, but it does not read memory at that offset.
Suppose BX=1000H, SI=0020H, and memory at offset 1024H contains BEEFH:
MOV AX,[BX+SI+4]reads memory and gives AX=BEEFH.
LEA AX,[BX+SI+4]performs address arithmetic and gives AX=1024H.
This difference matters when a program needs a pointer rather than the pointed-to value.
PUSH and POP transfer words through the stack
The 8086 stack is a last-in, first-out region addressed through SS:SP. For a word PUSH, the CPU first subtracts 2 from SP and then writes the word at the new SS:SP. For POP, it first reads the word at SS:SP and then adds 2 to SP.
If SP starts at 0100H and AX contains 1234H, PUSH AX changes SP to 00FEH. Little-endian storage places 34H at SS:00FEH and 12H at SS:00FFH. A later POP BX reconstructs 1234H in BX and restores SP to 0100H.
Do not pop from a stack location your program did not previously establish. A mismatched number of pushes and pops changes SP and can make later procedure returns read the wrong address.
You can now identify where a value comes from, where it goes, and whether memory is accessed. Section 6.2 adds arithmetic: the destination changes as before, but the flags also record properties of the result.