Addressing Modes 23
Addressing Modes 23
Addressing Modes 23
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) gp:
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
Register Indirect Addressing
• In this mode, the EA is specified in either a pointer or an index register. Pointers
are BX and BP while Index registers are (SI) and (DI).
• Example:
• MOV [DI], BX ; The inst. Copies contents of BX (as register) into an EA
location given by DI
Based Addressing
• The EA is generated by adding a displacement (unsigned 16-bit or signed 8-bit)
value to the contents of BX or BP. The segment registers are DS and SS.
• When memory is accessed, use BX and DS while when the Stack is accessed use
BP and SS.
• MOV AL, ALPHA [BX]
;ALPHA is an 8-bit displacement while BX contains EA.
Indexed Addressing
• The EA is calculated by adding a displacement (unsigned 16- or signed 8-bit) to
the contents of DI or SI
• MOV BH, START [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:
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
Relative Addressing
• This mode of addressing require a signed 8-bit displacement relative to PC
• Example: JNC START; jump if no carry IP + 8-bit signed value of START. Otherwise next
instruction is executed.
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.