Microprocessor &
Application (EE-503)
Introduction to 8085 Instruction
Set
Language Used for programming
Program is nothing but a sequence of instructions coded in
binary form and stored in successive locations.
There are three language levels that can be used to write a
program:
Level 1. Machine Language
Level 2. Assembly Language
Level 3. High Level Language
Contd.
Machine Language: A program which has a simply a
sequence of binary codes for the instruction is called machine
level language program
Assembly language: The programmer writes program in
assembly language and then translate it to machine language
so that it can be loaded into memory and executed.
High level language: Basic, Pascal, C, C++ is another way
of writing program. High level language is converted to
machine codes with the help of compiler.
Instruction Set of 8085
An instruction is a binary pattern designed inside a
microprocessor to perform a specific function.
Since the 8085 is an 8 bit device, it can have up to 28 (256)
instructions.
8085 only uses 246 combinations that represent a total of 74
instructions.
Each instruction has two parts:
- first part is called the op-code (operation code)
- second part is the data to be operated on (operand)
Instruction Word size of 8085
According to the word size of the 8085, instructions are classified
into following three groups:
One byte instruction
Two byte instruction
Three byte instruction
Instruction Classification
Data Transfer operation
Arithmetic operations
Logical Operations
Branch Operations
Machine Control Operations
Data Transfer Instruction
The data transfer instruction copy the data from source to
destination.
They transfer:
- Data between registers
- Data byte to a register or memory locations
- Data between a memory location and a register
- Data between an I/O device and accumulator
The contents of the source are not modified.
Data Transfer Instruction
The data transfer instruction copies the data from source
register to destination register.
If one of the operands is a memory location, it is specified
by the content of HL registers.
Example: MOV B,C
MOV B,A
Data Transfer Instruction
8 bit data is stored in the destination register or memory.
If one of the operands is a memory location, it is specified
by the content of HL registers.
Example: MVI A,57H
MVI M,57H
Data Transfer Instruction
The contents of a memory location, specified by 16 bit
address in the operand, are copied to the accumulator.
Example: LDA 2000H
Data Transfer Instruction
Load A register with the content of the memory location
whose address is specified by BC or DE register pair.
Example: LDAX B
Data Transfer Instruction
Load 16 bit data in the specified register pair.
Example: LXI B 1020H
Data Transfer Instruction
Store the content of A register at address given in the
instruction.
Example: STA 2000H
Data Transfer Instruction
Store the content of A register in the given memory
location whose address is specified by BC or DE register
pair.
Example: STAX B
Data Transfer Instruction
Store the content of HL register in the given memory
location whose address is specified 16 bit address.
Example: SHLD 2050H
Data Transfer Instruction
Exchange the content of HL and DE register pair.
H with D and L with E
Example: XCHG
Arithmetic Operation
Addition – Any 8 bit number or the contents of register or the
contents of memory location are added to the contents of
accumulator and the result is stored in the accumulator.
Subtraction - Any 8 bit number or the contents of register or
the contents of memory location are subtracted from the
contents of accumulator and the result is stored in the
accumulator.
Increment/Decrement – 8 bit contents of a register or memory
location can be incremented or decremented by 1.
Arithmetic Operation
The contents of the register or memory are added to the
content of accumulator.
The result is stored in the accumulator.
Example: ADD B
Arithmetic Operation
The contents of the register or memory and the carry flag
(CY) are added to the content of accumulator.
All flags are modified to reflect the result of the addition.
Example: ADC B
Arithmetic Operation
The 8 bit data is added to the content of the accumulator.
All flags are modified to reflect the result of the addition.
Example: ADI 45H
Arithmetic Operation
The 8 bit data and the carry flag (CY) is added to the
content of the accumulator.
All flags are modified to reflect the result of the addition.
Example: ACI 45H
Arithmetic Operation
The 16 bit content of the register pair are added to the
content of HL pair.
The result is stored in the HL pair.
Example: DAD B
Arithmetic Operation
The contents of the register or memory are subtracted
from the content of accumulator.
The result is stored in the accumulator.
Example: SUB B
Arithmetic Operation
The contents of the register or memory and the borrow
flag (CY) are subtracted from the content of accumulator.
All flags are modified to reflect the result of the
subtraction.
Example: SBB B
Arithmetic Operation
The 8 bit data is subtracted from contents of the
accumulator.
All flags are modified to reflect the result of the
subtraction.
Example: SUI 45H
Arithmetic Operation
The 8 bit data and the borrow flag (CY) is subtracted from
the content of the accumulator.
All flags are modified to reflect the result of the addition.
Example: SBI 45H
Arithmetic Operation
The contents of the register or memory location are
incremented by 1.
If the operand is a memory location, its address is
specified by the contents of HL pair.
Example: INR B, INR M
Arithmetic Operation
The contents of the register pair are incremented by 1.
The result is stored in the same place.
Example: INX H
Arithmetic Operation
The contents of the register or memory location are
decremented by 1.
If the operand is a memory location, its address is
specified by the contents of HL pair.
Example: DCR B, DCR M
Arithmetic Operation
The contents of the register pair are decremented by 1.
The result is stored in the same place.
Example: DCX H
Logical Operation
These instruction perform logic operations on the contents of
the accumulator.
The logical operations are:
- AND
- OR
- XOR
- Rotate
- Compare
- Complement
Logical Operation
if (A) < (reg / mem) : Carry flag is set
if (A) = (reg / mem) : Zero flag is set
if (A) > (reg / mem) : Carry and Zero flags is reset
Example: CMP B
CMP M
Logical Operation
if (A) < data : Carry flag is set
if (A) = data : Zero flag is set
if (A) > data : Carry and Zero flags is reset
Example: CPI 70H
Logical Operation
The contents of the accumulator are logically ANDed with
the contents of the register or memory.
Result is placed in the accumulator.
CY is reset and AC is set.
Example: ANA B
ANA M
Logical Operation
The contents of the accumulator are logically ANDed with
the 8 bit data.
Result is placed in the accumulator.
CY is reset and AC is set.
Example: ANI 68H
Logical Operation
Each binary bit of accumulator is rotated left by one position
through the carry flag.
Bit D7 is placed in the carry flag and the carry flag is placed
in the least significant position D0.
Example: RAL
Logical Operation
Each binary bit of accumulator is rotated right by one
position through the carry flag.
Bit D0 is placed in the carry flag and the carry flag is placed
in the most significant position D7.
Example: RAR
Logical Operation
Each binary bit of accumulator is rotated left by one
position.
Bit D7 is placed in the D0 as well as in the carry flag.
Example: RLC
Logical Operation
Each binary bit of accumulator is rotated right by one
position.
Bit D0 is placed in the D7 as well as in the carry flag.
Example: RRC
Logical Operation
The contents of the accumulator are complemented..
No flags are affected..
Example: CMA
Logical Operation
The carry flag is complemented..
No flags are affected..
Example: CMC
Logical Operation
The carry flag is set to 1.
No others flags are affected..
Example: STC
Branching Instruction
Branching instruction alter the normal sequential flow either
conditionally or unconditionally.
Jump Conditionally
Branching Instruction
Jump to a memory location whose 16 bit address is specified
by the operand.
Example: JMP 2030 H
Branching Instruction
The program sequence is transferred to a memory location
specified by the 16 bit address given in the operand.
Before the transfer, the address of the next instruction after
CALL is pushed on to the stack.
Example: CALL 2030 H
Branching Instruction
The program sequence is transferred from a subroutine to
the calling program.
Example: RET
Control Instruction
No operation is executed.
Example: NOP
Control Instruction
The CPU finishes executing the current instruction and halts
any further execution.
An interrupt or reset is necessary to exit from the halt state.
Example: HLT