0% found this document useful (0 votes)
58 views

CS 305 Microprocessors and Microcontrollers

This document discusses microprocessors and microcontrollers. It describes different types of instruction flow, including sequential control flow instructions and control transfer instructions. It then defines addressing modes, such as immediate, direct, register, register indirect, indexed, register relative, based indexed, and relative based indexed addressing modes. It provides examples of how these addressing modes are used. Finally, it discusses branch addressing modes, including intrasegment and intersegment modes, and the instruction set of the 8086 microprocessor.

Uploaded by

lara
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

CS 305 Microprocessors and Microcontrollers

This document discusses microprocessors and microcontrollers. It describes different types of instruction flow, including sequential control flow instructions and control transfer instructions. It then defines addressing modes, such as immediate, direct, register, register indirect, indexed, register relative, based indexed, and relative based indexed addressing modes. It provides examples of how these addressing modes are used. Finally, it discusses branch addressing modes, including intrasegment and intersegment modes, and the instruction set of the 8086 microprocessor.

Uploaded by

lara
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

CS 305

MICROPROCESSORS AND
MICROCONTROLLERS
MODULE II
 According to the flow of execution control
instructions may be categorized as
1. Sequential Control flow instructions
2. Control transfer instructions
 Sequential control flow instructions are the
instructions which after execution transfer control to
the next instruction appearing immediately.
 The control transfer instructions transfer control to
some predefined address or the address somehow
specified in the instruction after their execution
ADDRESSING MODES
What is addressing mode?

 The different ways in which a source operand is


denoted in an instruction are known as addressing
mode.
The addressing modes for
sequential control flow
instructions
1. Immediate Addressing Mode
2. Direct Addressing mode
3. Register Addressing mode
4. Register Indirect Addressing mode
5. Indexed Addressing Mode
6. Register Relative addressing mode
7. Based indexed addressing mode
8. Relative based indexed Addressing
IMMEDIATE ADDRESSING
MODE
 The addressing mode in which the data operand is a
part of the instruction itself is known as immediate
addressing mode. Example
 MOV DL, 08H
 The 8-bit data (08H) given in the instruction is
moved to DL (DL).
 MOV AX, 0A9FH The 16-bit data (0A9FH) given in
the instruction is moved to AX register (AX) .
DIRECT ADDRESSING MODE
 The addressing mode in which the effective address
of the memory location at which the data operand is
stored is given in the instruction.
 The effective address (Offset) is just a 16-bit number
written directly in the instruction.
 Example:
 MOV BX, [1354H]
DIRECT ADDRESSING MODE
 MOV BL, [0400H]
 The square brackets around the 1354H denote the
contents of the memory location.
 When executed, this instruction will copy the
contents of the memory location into BX register.
 This addressing mode is called direct because the
displacement of the operand from the segment base
is specified directly in the instruction
REGISTER ADDRESSING MODE
 The instruction will specify the name of the register
which holds the data to be operated by the
instruction.
 All registers except IP may be used in this mode
 Example: MOV CL, DH
 The content of 8-bit register DH is moved to another
8-bit register CL
REGISTER INDIRECT
ADDRESSING MODE
 This addressing mode allows data to be addressed
at any memory location through an offset address
held in any of the following registers: BP, BX, DI & SI.
 Example
 MOV AX, [BX]
 suppose the register BX contains 4895H, then the
contents of 4895H are moved to AX
 ADD CX, [BX]
INDEXED ADDRESSING MODE
 In this addressing mode, the operands offset address
is found by adding the contents of SI or DI register
and 8-bit/16-bit displacements.
 DS and ES are the default segments for index
registers SI and DI respectively.
 This is the special case of the of register indirect
addressing mode.
 Example
 MOV BX, [SI+16],
 ADD AL, [DI+16]
REGISTER RELATIVE
ADDRESSING MODE
 In register relative Addressing, BX, BP, SI and DI is
used to hold the base value for effective address and
a signed 8-bit or unsigned 16-bit displacement will be
specified in the instruction.

 In case of 8-bit displacement, it is sign extended to


16-bit before adding to the base value.
 When BX holds the base value of EA, 20-bit physical
address is calculated from BX and DS.
 When BP holds the base value of EA, BP and SS is
used.
 Example: MOV AX, [BX + 08H]
 MOV AX, 08H [BX]
BASED INDEXED ADDRESSING
MODE
 In this addressing mode, the offset address of the
operand is computed by summing the base register
to the contents of an Index register.
 The default segment registers may be ES or DS
 Example:
 MOV DX, [BX + SI]
 MOV DX, [BX][SI]
RELATIVE BASED INDEXED
ADDRESSING MODE
 In this addressing mode, the operands offset is
computed by adding the base register contents.
 An Index registers contents and 8 or 16-bit
displacement.
 Example
 MOV AX, [BX+DI+08]
 ADD CX, [BX+SI+16]
INSTRUCTIONS ADDRESSING
MODES /BRANCH ADDRESSING
MODE
 The control transfer instructions transfer control to
some predefined address or the address somehow
specified in the instruction after their execution

 Examples :
 INT , CALL ,RET and JUMP instructions
INSTRUCTIONS ADDRESSING
MODES /BRANCH ADDRESSING
MODE
 The control transfer instruction the addressing
modes depend upon whether destination location is
within the same segment or a different one .

 It also depends on the method of passing the


destination address to the processor Basically there
are two methods for passing control transfer
instructions
INSTRUCTIONS ADDRESSING
MODES /BRANCH ADDRESSING
MODE

 1. Intersegment addressing mode

 2. Intrasegment addressing mode


INTRASEGMENT ADDRESSING
MODE
 If the destination location is within the same
segment the mode is called intrasegment addressing
mode

 There are two types


 1. Intrasegement direct mode
 2. Intrasegment indirect mode
INTRASEGMENT DIRECT MODE
 In this mode the address to which the control is to be
transferred lies within the segment in which the control
transfer instruction lies and appears directly in the
instruction as an immediate displacement value .
 The displacement is computed relative to the content
of the instruction pointer IP.
 JMP SHORT LABEL;
 is a control transfer instruction following intra segment
direct mode. Here, SHORT LABEL represents a signed
displacement.
INTRASEGMENT INDIRECT
MODE
 In this mode the displacement to which the control is
to be transferred is in the same segment in which the
control transfer instruction lies but it is passed to the
instruction indirectly
 Here the branch address is found as the content of a
register or a memory location .
 Example JMP [AX]
INTERSEGMENT ADDRESSING
MODE
 If the destination location is in the different segment
the mode is called intersegment addressing mode

 There are two types

1. Intersegment direct mode


2. Intersegment indirect mode
INTERSEGMENT DIRECT MODE
 In this mode the address to which the control is to be
transferred is in a different segment this addressing
mode provides a means of branching from one code
segment to another code segment.

 Here the CS and IP of the destination address are


specified directly in the instruction.
 Example JMP 2000H: 3000H
INTERSEGMENT INDIRECT
MODE :
 In this the address to which the control is to be
transferred lies in a different segment and it is
passed to the instruction indirectly
 Content of memory block containing four bytes
IP(LSB) ,IP(MSB),CS(LSB) and CS(MSB) sequentially
 The starting address of the memory block may be
referred using any of the addressing mode except
immediate mode .
 Example JMP [5000H];
INSTRUCTION SET OF 8086
 The 8086 microprocessor supports 8 types of
instructions .
1. Data Transfer Instructions
2. Arithmetic Instructions
3. logical Instructions
4. String Instructions
5. Program Execution Transfer Instructions (Branch &
Loop Instructions)
6. Processor Control Instructions
7. Iteration Control Instructions
8. Interrupt Instructions
THANK YOU.

You might also like