We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 7
arzay2019 ‘Addressing Modes - GeeksforGecks
GeeksforGeeks
A computer science portal for geeks
Custom Search
Addressing Modes
Addressing Modes- The term addressing modes refers to the way in which the operand of an
instruction is specified. The addressing mode specifies a rule for interpreting or modifying the
address field of the instruction before the operand is actually executed
Addressing modes for 8086 instructions are divided into two categorie:
1) Addressing modes for data
2) Addressing modes for branch
The 8086 memory addressing modes provide flexible access to memory, allowing you to easily
access variables, arrays, records, pointers, and other complex data types. The key to good
assembly language programming is the proper use of memory addressing modes.
‘An assembly language program instruction consists of two parts
‘Opeode Operand
The memory address of an operand consists of two components:
IMPORTANT TERMS
+ Starting address of memory segment.
+ Effective address or Offset: An offset is determined by adding any combination of three
address elements: displacement, base and index.
+ Displacement: It is an 8 bit or 16 bit immediate value given in the instruction.
* Base: Contents of base register, BX or BP.
+ Index: Content of index register SI or DI.
According to different ways of specifying an operand by 8086 microprocessor, different
addressing modes are used by 8086.
Addressing modes used by 8086 microprocessor are discussed below:
hitps:lwwn.geeksforgesks orgladdressing-modes! wrsrzerzot9 Acrassng Modes - GenksorGecks
* Implied mode:: In implied addressing the operand is specified in the instruction itself. In
this mode the data is 8 bits or 16 bits long and data is the part of instruction Zero address.
instruction are designed with implied addressing mode
Instruction
a
Example: MOV AL, 35H (move the data 35H into AL register)
+ Immediate addressing mode (symbol #):In this mode data is present in address field of
instruction Designed like one address instruction format.
Note:Limitation in the immediate mode is that the range of constants are restricted by size
of address field.
Opcode Address
4
Data is
rectly
stored
here.
+ Register mode: In register addressing the operand is placed in one of 8 bit or 16 bit general
purpose registers. The data is in the register that is specified by the instruction.
Here one register reference is required to access the data,
Instruction Register
Register — Data
Example: MOV AX,CX (move the contents of CX register to AX register)
+ Register Indirect mode: In this addressing the operand’s offset is placed in any one of the
fegisters BX,BPSI,DI as specified in the instruction. The effective address of the data is in
the base register or an index register that is specified by the instruction.
Here two register reference is required to access the data.
Instruction Register Memory
Register -——}_Effectve Address. | |_——> Data
The 8086 CPUs let you access memory indirectly through a register using the register
indirect addressing modes.
MOV AX, [BX](move the contents of memory location s
addressed by the register BX to the register AX)
hitps:lwwn.geeksforgesks orgladdressing-modes! ararzar2019 ‘Adressing Modes - GeoksforGasks
* Auto Indexed (increment mode): Effective address of the operand is the contents of a
register specified in the instruction. After accessing the operand, the contents of this
register are automatically incremented to point to the next consecutive memory location.
(R1)+.
Here one register reference,one memory reference and one ALU operation is required to
access the data.
Example:
Add R1, (R2)+ // OR
1 = RL 4M[R2
2= R24
Useful for stepping through arrays in a loop. R2 ~ start of array d~ size of an element
+ Auto indexed (decrement mode): Effective address of the operand is the contents of a
register specified in the instruction. Before accessing the operand, the contents of this,
register are automatically decremented to point to the previous consecutive memory
location. -(R1)
Here one register reference,one memory reference and one ALU operation is required to
access the data.
Example:
Add R1,-(R2) //OR
R2 = R2-d
RL = R1 + M[R2]
Auto decrement mode is same as auto increment mode. Both can also be used to implement a
stack as push and pop . Auto increment and Auto decrement modes are useful for implementing
“Last-In-First-Out" data structures.
* Direct addressing/ Absolute addressing Mode (symbol []): The operand’s offset is given in
the instruction as an 8 bit or 16 bit displacement element. In this addressing mode the 16
bit effective address of the data is the part of the instruction.
Here only one memory reference operation is required to access the data.
Instruction Memory
Effective address § _—————» Data
‘ample: ADD AL, [0301] //add the contents of offset address 0301 to AL
* Indirect addressing Mode (symbol @ or () ):In this mode address field of instruction
contains the address of effective address Here two references are required.
Ist reference to get effective address.
2nd reference to access the data.
hitps:lwwn.geeksforgesks orgladdressing-modes! 3