Showing posts with label addressing modes. Show all posts
Showing posts with label addressing modes. Show all posts

Saturday, May 30, 2009

Addressing modes of 8086 microprocessor .

Describe the addressing modes of 8086 microprocessor .

The 8086 BIU we described how the 8086 accesses code bytes suing CS and IP. We also described how the 8086 accesses the stack using SS and SP. The different ways that an 8086 can access the data that it operates on. The different ways that a processor can access data are referred to as its addressing modes. In assembly language statement the addressing mode is indicated in the instruction. We will used the 8086 MOV instruction to illustrate some of the 8086 addressing modes.
The Move instruction has the format:-

MOV destination, source

When executed, this instruction copies a word or a byte from the specified source location to the specified destination location. The source can be a number written directly in a instruction, s specified register, or a memory location specified in one of 24 different ways. The destination can be a specified register or a memory location specified in any one of 24 different ways. the source and the destination cannot both be memory locations in an instruction.

Immediate Addressing Mode

Suppose that in a program you need to put the number 437H in te CS register. The MOV CX , 437BH instruction can be used to do this when it executes, this instruction will put the immediate hexadecimal number 437BH in the 16-it CX register. This is referred to as immediate addressing mode because the number to be loaded into the CS register will be put in two memory locations immediately following the code for the MOV instruction. This is similar to the way the port address was put in memory immediately after the code for the input instruction in the three-instruction program in above figure.

Register Addressing Mode

Register addressing mode means that a register is the source of an operand for an
Instruction. The instruction
MOV CS,AX ( example)
Copies the contents of the 16 –bits AX register into the 16 bit CX register. Remember that the Destination location is specified in the instruction before te source. Also not hat the contents of AX are just copied t CX. Not actually moved. In other words, the previous content of CS are written over, but the contents of AX are not changed.

Direct Addressing Mode

For the simplest memory addressing mode the effective address is just an 8 and 16 bit number written directly in the instruction. The instruction MOV CL,[437 AH] is an example . the square brackets around the 437AH are shorthand for “ te contents of the memory location at a displacement from the segment base of “ when executed. This instruction will copy the contents of the memory location, at a displacement of 437 AH from the data segment base, into the CL register. Shifting the data segment base in DS four bits left and adding the effective address 437AH to the result will produce the actual 20-bit pysical memory address. Above figure sows how the operation is done. This addressing mode is called direct because the displacement of operand from the segment base is specified directly in the instruction. The displacement in the instruction will be added to the data segment base in DS unless you used a segment override prefix to tell the BIU to add it to some other segment base.

Addressing modes required for this machine?

Assume that a machine and its OS does not support stack, but support arrays, subroutine calls with maximum of 2 arguments; and other simple arithmetic, logic and shift instructions. What addressing modes would be required for this machine? Justify your answer.


Machine and its OS support arrays, Subroutines calls with maximum of 2 arguments, such as arithmetic, logic and shift instruments.

Arithmetic Operation:- Almost all the machines provide the four basic arithmetic operations on sign fixed point integer. Some machines provide operation on floating point and packed decimal number.
It arithmetic operations which can be provided in a machine in general are-
ADD, SUBTRACT, MULTIPLY, DIVIDE
ABSOLUTE, NEGATE, INCREMENT, DECREMENT

Logical and Shift Operation:- The logical operations are based an Boolean operation performed an binary data. Some of the logical operations are – AND, OR, NOT Exclusive OR.

Shift Operation:-

* In logical left most right shift the “bitin” is a O bit
*Arithmetic shift is same as logical shift except for the sign bit, which is not shifted.
*A Circular shift uses the “bit out” bit as the “bit in” bit
Subroutine Call:- It is a self user program which contains the code often used repeatedly in a large program.

In Subroutine is called explicity by a program stalment
100 CALL X
101
102
103 CALL X
200 SUB X
201 STATEMENT X
202
OTHER STATEMENT
300 RETURN


There are so many addressing modes such as: -
Ø Index- addressing mode.
Ø Relative- addressing mode.
Ø Indirect- addressing mode.
Ø Base- addressing mode.
Ø Direct- addressing mode.
Ø Immediate addressing mode.
Ø Displacement addressing mode
But for the above machine we can use Displacement addressing machine.

EA = A+ (R)
DA = DO (A)
EA = DA+ (R)
D = (EA)
(DA is the direct address)
IA = A + (R)
EA = (IA)
D = (EA)
(IA is Indexed address)