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

Introduction To Microprocessor 8086: Objective

This document provides an introduction to the 8086 microprocessor instruction set. It discusses the pointer and index registers (SI, DI, BP, SP), segment registers (CS, DS, ES, SS), and common data transfer instructions (MOV, ADD, SUB). The objectives are to introduce the 8086 instruction set and demonstrate its implementation in an emulator. Example programs are provided to load registers, add ID digits, perform subtraction, and add the first ten natural numbers.

Uploaded by

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

Introduction To Microprocessor 8086: Objective

This document provides an introduction to the 8086 microprocessor instruction set. It discusses the pointer and index registers (SI, DI, BP, SP), segment registers (CS, DS, ES, SS), and common data transfer instructions (MOV, ADD, SUB). The objectives are to introduce the 8086 instruction set and demonstrate its implementation in an emulator. Example programs are provided to load registers, add ID digits, perform subtraction, and add the first ten natural numbers.

Uploaded by

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

EEE342 - Microprocessor Systems and Interfacing

Introduction to Microprocessor 8086


Lab. Experiment # 2

Objective:
Introduction to 8086 Instruction Set and it implementation in EMU 8086 (Microprocessor
Emulator).

Introduction:
Pointers and Index Registers:
The registers in this group are all 16 bits wide and, unlike the data registers, cannot be accessed
as a low or high byte. These registers are used as memory pointers. For example, the instruction
MOV AH, [SI] has the word interpretation "Move the byte whose address is contained in register
SI to register AH". SI is thus interpreted as "pointing" to the desired memory location. The
brackets around SI are used to indicate the contents of memory pointed to by SI and not the
value of SI itself.
SI - source index register:

 Can be used for pointer addressing of data


 Used as source in some string processing instructions
 Offset address relative to DS
DI - destination index register:

 Can be used for pointer addressing of data


 Used as destination in some string processing instructions
 Offset address relative to ES
BP - base pointer:

 Primarily used to access parameters passed via the stack


 Offset address relative to SS

18 | P a g e Department of Electrical & Computer Engineering | CUI Wah


EEE342 - Microprocessor Systems and Interfacing

SP - stack pointer:

 Always points to top item on the stack


 Offset address relative to SS
 Always points to word (byte at even address)
Segment Registers:
CS - points at the segment containing the current program.
DS - generally points at segment where variables are defined.
ES - extra segment register, it's up to a coder to define its usage.
SS - points at the segment containing the stack.
Although it is possible to store any data in the segment registers, this is never a good idea. The
segment registers have a very special purpose - pointing at accessible blocks of memory. Segment
registers work together with general purpose register to access any memory value.
For example if we would like to access memory at the physical address 12345h(hexadecimal), we
could set the DS = 1230h and SI = 0045h. This way we can access much more memory than with
a single register, which is limited to 16 bit values. The CPU makes a calculation of the physical
address by multiplying the segment register by 10h and adding the general purpose register to it
(1230h * 10h + 45h = 12345h). The address formed with 2 registers is called an effective address.

Instruction Set:
What is instruction set? When we talk to some person we need to talk in the language which that
person is able to understand. If we talk in a language that is not understandable by that person
he will not be able to follow our words and will not be able to reply us or fulfill the task we are
asking him to do. This is because we are not understandable to him which means that we are not
following his instruction set. Same is the case with microprocessor. If the microprocessor is able
to understand our words he will be able to perform our said tasks otherwise will not be able to
do it. That is only possible if we talk to microprocessor in its language i.e. its INSTRUCTION SET.
Each microprocessor has its own instruction set.

8086 Instruction Set:


8086 Instructions can be divided into different classes which are data movement instructions,
conversions, Arithmetic Instructions, Logical Shift Rotate and Bit Instructions, I/O Instructions
String Instructions, Program Flow control instructions and other Miscellaneous Instructions.

19 | P a g e Department of Electrical & Computer Engineering | CUI Wah


EEE342 - Microprocessor Systems and Interfacing

Data Transfer instructions:


MOV instruction:

 It is one of the simplest and flexible instructions


 Source is far to the right
 Destination is next to the opcode
 An opcode, or operation code, tells the microprocessor which operation to perform
 Source and destination are separated by a comma
 Source never changes while destination almost always changes

Figure 3.1: Sample Example

Operands supported by MOV:


1. MOV REG, MEMORY (MOV AL,[1234h])
2. MOV MEMORY, REG
3. MOV REG, REG
4. MOV MEMORY, IMMEDIATE
5. MOV REG, IMMEDIATE (e.g: MOV AL,100)
6. MOV REG, SEGREG (e.g: MOV AL,DS)

Operands not supported by MOV:


1. MOV MEMORY, MEMORY
2. MOV IMMEDIATE, SEGREG
3. MOV SEGREG, SEGREG

ADD:

It adds the source operand to destination operand and places the result in destination. But source
and destination operands must watch and only one of them can be in memory. Carry is stored in
carry flag (CF).

20 | P a g e Department of Electrical & Computer Engineering | CUI Wah


EEE342 - Microprocessor Systems and Interfacing

Format: - ADD destination, source

SUB:

It subtract byte from byte or word from word.


Format: operand1 = operand1 - operand2
Example:
MOV AL, 5
SUB AL, 1 ; AL = 4

21 | P a g e Department of Electrical & Computer Engineering | CUI Wah


EEE342 - Microprocessor Systems and Interfacing

Lab Tasks

Task 1:
Write and assemble a program to load register AX with value 99H. Then from register AX move it
to BX, CX, and DX. Use the simulator to single-step the program and examine the registers.

Task 2:
Write and assemble a program to add all the single digits of your ID number and save the result
in Accumulator. Then use the simulator to single-step the program and examine the registers.

Task 3:
Subtraction of two 8 bit numbers and placed the result in accumulator register.

Task 4:
Addition of first ten natural numbers by using INC and ADD instruction.

22 | P a g e Department of Electrical & Computer Engineering | CUI Wah

You might also like