Register addressing mode
In this addressing mode, the operands may be:
| || reg32: 32-bit general registers: EAX, EBX, ECX, EDX, ESI, EDI, ESP, or EBP.
| || reg16: 16-bit general registers: AX, BX, CX, DX, SI, DI, SP or BP.
| || reg8 : 8-bit general regisers: AH, BH, CH, DH, AL, BL, CL, or DL.
| || Sreg : segment registers: CS, DS, ES, FS, or GS. There is an exception: CS cannot be a destination.
For register addressing modes, there is no need to compute the effective address. The operand is in a register and to get the operand there is no memory access involved, so it doesn't make sense to talk about effective address here.
|Example: Register Operands|
MOV AX, BX ; mov reg16, reg16
ADD EAX, ESI ; add reg32, reg32
MOV DS, AX ; mov Sreg, reg16
Immediate addressing mode
In this addressing mode, the operand is stored as part of the
instruction. The immediate operand which is stored along with
the instruction, resides in the code segment -- not in the data
segment. This addressing mode is also faster to execute an instruction
because the operand is read with the instruction from memory.
Here are some examples:
|Example: Immediate Operands|
MOV AL, 20 ; move the constant 20 into register AL
ADD EAX, 5 ; add constant 5 to register EAX
MOV DX, offset msg ; move the address of message to register DX