Module 4
Module 4
Module 4
MOD U LE- 4
- LIPSA SUBHADARSHINI
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 categories:
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
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:
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 instructions. Zero address instruction are designed with implied addressing mode.
Example: MOV AL, 35H (move the data 35H into AL register)
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.
The 8086 CPUs let you access memory indirectly through a register using the register indirect addressing modes.
Example: MOV AX, [BX](move the contents of memory location s
addressed by the register BX to the register AX)
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
R1 = R1 +M[R2]
R2 = R2 + d
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
R1 = 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.
Kalinga Institute of Industrial Technology (Deemed to be University), Bhubaneswar 07/01/2023 6
PROGRAMMING THE BASIC COMPUTER
ADDRESSING MODE
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.
Indexed addressing mode: The operand’s offset is the sum of the content of an index register SI or DI and an 8 bit or 16 bit displacement.
Example: MOV AX, [SI+05]
Based Indexed Addressing: The operand’s offset is sum of the content of a base register BX or BP and an index register SI or DI.
Example: ADD AX, [BX+SI]
Based on Transfer of control, addressing modes are:
PC relative addressing mode: PC relative addressing mode is used to implement intra segment transfer of control, In this mode effective
address is obtained by adding displacement to PC.
EA= PC + Address field value
PC= PC + Relative value.
Base register addressing mode: Base register addressing mode is used to implement inter segment transfer of control.In this mode effective
address is obtained by adding base register value to address field value.
EA= Base register + Address field value.
PC= Base register + Relative value.
Advantages of Addressing Modes
To give programmers to facilities such as Pointers, counters for loop controls, indexing of data and program relocation.
To reduce the number bits in the addressing field of the Instruction.
Kalinga Institute of Industrial Technology (Deemed to be University), Bhubaneswar 07/01/2023 8
PROGRAMMING THE BASIC COMPUTER
MACHINE LANGUAGE
Machine language is the low level programming language. Machine language can only be represented by 0s and
1s. In earlier when we have to create a picture or show data on the screen of the computer then it is very difficult to
draw using only binary digits(0s and 1s). For example: To write 120 in the computer system its representation is
1111000. So it is very difficult to learn. To overcome this problem the assembly language is invented.
Assembly language is the more than low level and less than high-level language so it is intermediary language.
Assembly languages use numbers, symbols, and abbreviations instead of 0s and 1s.For example: For addition,
subtraction and multiplications it uses symbols likes Add, sub and Mul, etc.
Example:
Where,
X µsec =data transfer time or preparation time (words/block)
Y µsec =memory cycle time or cycle time or transfer time (words/block)
% CPU idle (Blocked)=(Y/X+Y)*100
% CPU Busy=(X/X+Y)*100
Cyclic Stealing :
An alternative method in which DMA controller transfers one word at a time after which it must return the control of
the buses to the CPU. The CPU delays its operation only for one memory cycle to allow the direct memory I/O
transfer to “steal” one memory cycle.
Steps Involved are:
1. Buffer the byte into the buffer
2. Inform the CPU that the device has 1 byte to transfer (i.e. bus grant request)
3. Transfer the byte (at system bus speed)
4. Release the control of the bus back to CPU.
Before moving on transfer next byte of data, device performs step 1 again so that bus isn’t tied up and the transfer won’t
depend upon the transfer rate of device. So, for 1 byte of transfer of data, time taken by using cycle stealing mode (T).
= time required for bus grant + 1 bus cycle to transfer data + time required to release the bus, it will be N x T
In cycle stealing mode we always follow pipelining concept that when one byte is getting transferred then Device is
parallel preparing the next byte. “The fraction of CPU time to the data transfer time” if asked then cycle stealing mode is
used.
Where,
X µsec =data transfer time or preparation time
(words/block)
Y µsec =memory cycle time or cycle time or transfer
time (words/block)
% CPU idle (Blocked) =(Y/X)*100
% CPU busy=(X/Y)*100
Interleaved mode: In this technique , the DMA controller takes over the system bus when the microprocessor is not
using it. An alternate half cycle i.e. half cycle DMA + half cycle processor.
Kalinga Institute of Industrial Technology (Deemed to be University), Bhubaneswar 07/01/2023 21