Lec 03-Introduction To 8085 Instruction Set

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 32

Lecture 3: Introduction to 8085

Instruction Set (1)

1
Intel 8085 Internal Structure

2
Instruction and Program

An instruction is certain binary pattern acts as a


command to the microprocessor to perform a
given task on specified data.
The entire group of instructions, called the
instruction set, determines what functions the
microprocessor can perform.
A microcomputer performs a task by reading and
executing the set of instructions written in its
memory.
This set of instructions, written in a sequence, is
called a program.
3
Instruction, Data Format, And Storage
Each instruction has two parts:
• one is the task to be performed, called the operation
code (op-code),
• the second is the data to be operated on, called the
operand.
• The operand (or data) can be specified in various
ways.
• It may include 8-bit (or 16-bit) data, an internal
register, a memory location, or an 8-bit (or 16-bit)
address. In some instructions, the operand is
implicit.

Prepared by: Dr Masri Ayob 4


Instruction, Data Format, And Storage

In the 8085, “byte” and “word” are synonymous


because it is an 8-bit microprocessor.
However, instructions are commonly referred to in
terms of bytes rather than words.
• 1-byte instructions
• 2-byte instructions
• 3-byte instructions

Prepared by: Dr Masri Ayob 5


1-byte instructions

It includes the opcode and the operand in the


same byte. For example:

6
Prepared by: Dr Masri Ayob - TK2123
2-byte instructions

The first byte specifies the operation code and


the second byte specifies the operand. For
example:

7
Prepared by: Dr Masri Ayob - TK2123
3-byte instructions
The first byte specifies the operation code and the
following two bytes specify the 16-bit address.
The second byte is the low-order address and the
third byte is the high-order address.
For example:

8
Prepared by: Dr Masri Ayob – TK2633
8085 Instruction Set

Can be classified into the following five functional


categories:
• data transfer (copy) operations,
• arithmetic operations,
• logical operations,
• branching operations, and
• machine-control operations.

9
Data Transfer (copy) Instructions

Copies data from a location called a source to


another location, called a destination, without
modifying the contents of the source.

• The term transfer is misleading; it creates the


impression that the contents of a source are
destroyed when, in fact, the contents are retained
without any modification.

The previous contents of the destination are


replaced by the contents of the source.
10
Data Transfer (copy) Instructions

11
DATA TRANSFER OPERATIONS

12
Move Immediate Instructions
EXAMPLE 1

13
Move Immediate Instructions
EXAMPLE 2
Load the accumulator A with the data byte 82H
(the letter H indicates hexadecimal number), and
save the data in register B.

Instructions: MVI A, 82H


MOV B, A

The first instruction is a 2-byte instruction that


loads the accumulator with the data byte 82H, and
the second instruction MOV B,A copies the
contents of the accumulator in register B without
changing the contents of the accumulator.
14
Move Immediate Instructions
EXAMPLE 3

15
Move Immediate Instructions
EXAMPLE 4

The memory location, which is indirectly addressed by the HL register


pair, appears as the letter M in all instructions.

16
Direct Data Transfer Instructions

Direct data transfer instructions are useful if only


one byte or word of data is transferred to or from
the memory.
If more than one byte or word is transferred, it is
more efficient to use indirectly addressed
instruction.

17
Direct Data Transfer Instructions

18
Direct Data Transfer Instructions
EXAMPLE 1

19
Direct Data Transfer Instructions
EXAMPLE 2

stores the contents of


Copies the contents of the L register at
location 1000H into the memory location I200H
L register and the and the H register at
contents of location location 1201H
1001 H into the H
register 20
INDIRECT DATA TRANSFER INSTRUCTIONS

With register indirect addressing, a register pair


holds the address of the memory location
accessed by the instruction.
The contents of the register pair indirectly
addresses a memory location.
Whenever, the letter M appears instead of a
register, the HL register pair indirectly addresses a
memory location.

21
INDIRECT DATA TRANSFER INSTRUCTIONS

22
INDIRECT DATA TRANSFER INSTRUCTIONS
EXAMPLE 1

23
REGISTER DATA TRANSFER INSTRUCTIONS

24
REGISTER DATA TRANSFER INSTRUCTIONS

25
MISCELLANEOUS DATA TRANSFER INSTRUCTIONS

Exchange DE with HL (XCHG)


• The XCHG instruction exchanges the contents of
the HL register pair with the contents of the DE
register pair.

Input/Output Data Transfer Instructions


• IN : instruction inputs data from an I/O device into
the accumulator.
• OUT : sends accumulator data out to an I/O device.

26
SUMMARY

Data transfer instructions transfer information from


register to register, from register to memory, from
memory to register.
Data transfer instructions also allow data transfer
between registers and stack or the I/O devices in a
system.
The Intel 8085A uses four different addressing
modes: direct, register, register indirect, and
immediate.

27
SUMMARY

Direct addressing accesses a memory location to


transfer data between memory and the
accumulator or HL register pair. The address of
the data follow with the instruction in the memory.
Register addressing allows either a single 8-bit
register (B, C, D, E, H, L, or A) or a 16-bit register
pair (BC, DE, HL, and SP).
Register indirect addressing allows the instruction
to address memory through the address held in a
register pair.

28
SUMMARY

Immediate addressing is used whenever the data


(8 or 16 bits) are a constant. Immediate data
immediately follow the opcode in the program.
The M register or operand indirectly addresses
memory through the HL register pair.
The LDA and STA instructions load or store the
accumulator. The LHLD and SHLD instructions
load or store the HL register pair.

29
SUMMARY

Besides M for indirectly addressing the memory,


the DE and BC register pairs are also available.
The LDAX and STAX instructions allow the
accumulator to be indirectly stored or loaded from
the memory by using the BC or DE register pairs.
Register data transfer instructions are the most
numerous form of data transfer: 63 instructions.

30
SUMMARY

The PSW is the processor status word that


contains both the accumulator and the flag byte.
The accumulator is the high-order register and the
flag bits are the low-order register.
IN and OUT effect data transfers between an
external I/O device and the accumulator.
I/O devices are often called I/O ports and are
addressed by an 8-bit I/O port address.

31
Exercises

Write a sequence of immediate instructions that


store a 16H into memory location 1200H and a
17H in memory location 1202H.
Write a sequence of instructions that use register
indirect addressing to transfer the contents of A
into location 2800H, B into 2801H, and C into
2802H.
Write a sequence of instructions that use register
indirect addressing to transfer the number stored
in memory location 1300H into memory location
2302H.

32

You might also like