5.2 Immediate, Register, and Direct Addressing
An addressing mode answers: “Where does this operand come from, or where will the result go?” The same operation can behave differently depending on whether its operand is a literal in the instruction, a register, or a memory location.
This section introduces three forms with MOV. MOV destination,source copies a bit pattern from the source to the destination; it does not erase the source.
Three places an operand can live
| Mode | Example | Meaning of the source |
|---|---|---|
| Immediate | MOV AX,1234H | literal 1234H embedded in the instruction |
| Register | MOV AX,BX | current contents of BX |
| Direct memory | MOV AX,[1234H] | word stored in memory at offset 1234H |
Square brackets are not decoration. They mean use the enclosed value as an address and access memory.
Without brackets, 1234H is data. With brackets, [1234H] names a memory location. If that location contains BEEFH, then:
MOV AX,1234Hmakes AX=1234H;
MOV AX,[1234H]makes AX=BEEFH.
Immediate and register forms need no operand-data memory read. A direct-memory form requires the BIU to form an address and perform a bus cycle. That difference affects both encoding and execution time.
Source and destination must have compatible widths
An 8-bit destination needs an 8-bit source; a 16-bit destination needs a 16-bit source. For example, MOV AL,7FH is width-compatible, while MOV AX,7FH needs the assembler to choose a 16-bit immediate representation such as 007FH.
Ordinary 8086 MOV does not directly copy from one arbitrary memory location to another arbitrary memory location in one instruction. Usually at least one operand is a register, except for specialized string instructions studied later.
Lab 1 — route data from the correct compartment
Adjust AX, BX, an instruction literal, and a direct memory cell. Select and execute different MOV forms while the switchboard identifies the active source and destination.
Check your understanding
Direct addressing contains an address, not the operand data
For the special accumulator forms:
A1encodesMOV AX,[moffs16];
A3encodesMOV [moffs16],AX.
Here moffs16 means a 16-bit memory offset written directly into the instruction. If the offset is 1234H, its bytes appear low-first:
| Byte position | Value | Role |
|---|---|---|
| 1 | A1H | load AX from direct memory offset |
| 2 | 34H | offset low byte |
| 3 | 12H | offset high byte |
The bytes A1 34 12 do not place 1234H into AX. They tell the processor to access offset 1234H; the word found there becomes the data.
There are two different little-endian reconstructions:
1. Instruction bytes 34 12 reconstruct the address 1234H.
2. Two bytes read at that address reconstruct the word operand.
Do not mix those layers. Swapping address bytes changes which location is accessed; swapping data bytes changes the loaded word.
Direct memory references still need a segment. When no override is present, direct data addressing normally uses DS. Section 5.4 derives the full physical address.
Lab 2 — repair and operate a direct-address probe
Edit A1/A3 and the low/high address bytes, then issue an actual modeled read or write. The memory map makes an accidentally swapped address visibly hit a different cell.
Check your understanding
Reading assembly without guessing
For each operand:
1. A literal number without brackets is immediate data.
2. A register name means the register's current contents.
3. Brackets mean memory access; first calculate the enclosed offset, then read or write memory.
4. Keep address bytes separate from data bytes.
Direct addressing fixes the offset inside the instruction. The next section makes addresses reusable and movable by calculating them from BX, BP, SI, DI, and optional displacement.