Addressing Modes 24
Addressing Modes 24
and
Addressing
i8086 Microprocessor
Type
s
Intel 8086 categorises the instructions into six types.
Transfer group:
Transfers data to or from registers from or to memory/ IO
devices.
Arithmetic group:
Does computational activities and any shifting or rotation
required during computation.
Logic group:
Does and logic operations required on operands
Jump / Loop group:
Condition or unconditional jumps / loops as well as branching
from the main program belong to this group of instructions
Miscellaneous (Misc) group:
Contains instructions like NOP (no operation), LEA (load
effective address) and INT (interrupt).
Processor control group:
Used to directly control the state of some flags, to disable /
enable interrupts and to synchronise the processor to external
peripherals.
These instructions include:
STC (set carry flag), CLC (clear carry flag, CMC (complement the
state of carry flag), STD (set direction flag (DF) to 1 or
decrement string pointer, WAIT, CLD, STI, CLI, HLT, ESC, LOCK.
Refer to instruction set provided.
Addressing Modes
The power of any instruction set is based on the types of instructions
and the number of addressing modes. The 8086 has 12 basic addressing
modes that can be grouped into five namely:
• Accessing immediate and register data (Register and
immediate modes)
• Accessing data in memory (Memory modes)
• Accessing I/O ports (I/O modes)
• Relative addressing mode
• Implied addressing mode
Register and immediate modes
• The register addressing mode uses registers as source and destination.
Immediate addressing has the 8- or 16-bit data specified by the instruction.
• The data must be located in the memory addressed by the 8086 CS and IP
registers.
𝑚𝑜𝑣 𝐴𝑋 , 2000 𝐻
Memory modes
Direct memory addressing
• A 16-bit effective address is taken directly from the displacement field of
the instruction.
• MOV [2000H], AX ; EA is 2000H being the OFFSET value in DS as illustrated
in figure 1
MOV [2000H], AX
Contents of AX copies to memory
locations starting from offset
2000H
Indexed Addressing
• The EA is calculated by adding a displacement (unsigned 16- or signed 8-bit) to
the contents of DI or SI. Refer to figure 4.
• MOV BH, ALPHA [SI]
; contents pointed by DS + EA (displacement START + SI)
;copied to BH
MOV AL, ALPHA [BX]
• EA is computed by adding the base register (BX or BP), an Index register (SI or
DI), and a displacement (unsigned 16-or signed 8-bit).
Example Figure 5:
MOV ALPHA [SI] [BX], CL.
String Addressing
• Uses index registers. The string instructions assume SI to point to the first byte
or word of the source operand and DI to point to the first byte or word of
destination operand. The contents of SI and DI are automatically incremented
(by clearing DF to 0 by CLD instruction) or decremented (by setting DF to 1 by
SRD instruction).
Input output (I/O) Addressing
• There are two types of I/O addressing: Direct and Indirect.
MOV ALPHA [SI] [BX], CL
Implied Addressing
This mode of addressing has no operands. Example CLC; clears carry flag to zero. Other
examples are CLD, STD, ESC, LOCK, NOP, WAIT, and CLI.
Virtual Memory
Is the memory management technique that allows all memory (main and mass storage
devices) to be addressed as part of one large logical address space. The logical address
space is larger than the microprocessor’s physical address space.