Professional Documents
Culture Documents
Part 5
Data Addressing Mode
(Brey: Ch3; Hall: pp30-35, 49-50, 89-90;
Triebel: pp52-69; Also check “addressing
mode in Index)
ELEG 3230 - Part 5 1
Outline
aIntroduces various data addressing modes of the
8088 for memory retrieval and storage.
`Register addressing mode,
`Immediate addressing mode,
`Direct addressing mode,
`register indirect addressing mode,
`Based addressing mode,
`Indexed addressing mode,
`Based indexed addressing mode,
`String addressing mode, and
`Port addressing mode.
Examples:
Destination Source
MOV AX, BX ; copy the 16-bit content of BX to AX
MOV AL, BL ; copy the 8-bit content of BL to AL
MOV SI, DI ; copy DI into SI
MOV DS, AX ; copy AX into DS
Valid Examples:
MOV AL, 0Ah ; load 0Ah into AL
MOV BX, 1000h ; load 1000h into BX
MOV CL, ‘A’ ; load the ASCII code for ‘A’ (65) into CL
Invalid example:
MOV AL, 2AAh ; U
NOT allowed as the data exceeds the length of the destination register
MOV AX, [20h] ; load the contents at address 10020h and 10021h
; into AL and AH, respectively
MOV [1234h], AL ; copy AL to address 11234h
MOV ES:[1234h], AL ; copy AL to address 21234h
MOV FRED, AL ; copy AL to address14567h (offset is calculated by the
; assembler)
MOV CX, [BX] ; copy a word from address 10222h and 10223h to CX
MOV [BP], DL ; copy a byte from register DL to address 20111h
Note : BP defaults to SS
a Very similar to based addressing except that the index registers (SI or DI)
must be used instead.
a The operand is located at the address given by adding a signed 8- or 16-
bit displacement to either SI or DI and combining the result with a
segment register (DS by default).
Examples:
MOV [DI+FRED], BL ; This syntax is used above
MOV [DI]+FRED, BL
MOV FRED[DI], BL
Default
Offset register Override Prefix
Segment register
IP CS Never
SP SS Never
BP SS DS, ES or CS
SI, DI (for non-string DS ES, SS or CS
instruction)
DI for string instructions ES Never
Example:
JMP CX ; Jump to the current code segment location addressed by
; the content of CX.
a Stack addressing mode uses the PUSH and POP instruction to transfer
data between the stack memory and registers or direct data.
Example:
POPF ; Remove a word from stack and place it into the flag
PUSH DS ; Copy DS to the stack
PUSH 1234h ; Copy a 1234h to the stack
ELEG 3230 - Part 5 19
Pros and Cons of Different Data
Addressing Modes
Principal Principal Example
Mode Algorithm Advantage Disadvantage
Register EA = R No memory Limited address
MOV AX,BX
reference space
Immediate Operand = A No memory Limited operand MOV CH, 3Ah
reference magnitude
Direct EA = A Simple Less flexible MOV [123h], AX
Register EA = (R) Large address Extra memory
MOV [BX], CL
indirect space reference
Base-Index EA = A + (R) Flexibility Complexity
MOV [BX+SI+30h], DX
Relative
Stack EA = top of No memory Limited POP DX
stack reference applicability