Sunteți pe pagina 1din 42

Introduction to

8085
Instruction

By Dr. Syed Sahal Nazli Alhady

Free Powerpoint Templates

Page 1

Flowchart
Arrow: Indicates the direction of the
program execution
Rectangle: Represents a process of
an operation

Diamond: Represents a decisionmaking block

Oval: Indicates the beginning or


end of a program

Free Powerpoint Templates

Page 2

Flowchart

Double-sided rectangle: Represents a


predefined such as a subroutine

Circle with an arrow: Represents a


continuation (an entry or exit) to a
different page

Free Powerpoint Templates

Page 3

Flowchart

The no. of step represented is


ambiguous. Not all of them
should be included
It should represent a logical
approach and sequence of steps
in solving problem

Free Powerpoint Templates

Page 4

A Register (Accumulator)

8085
CPU
Registers

B
Register
C
Register
D
Register
E
Register
H
Register
L
Register

PC (Program
Counter)
SP (Stack Pointer)

SR (Status
Free Powerpoint Templates
Register)

Page 5

MVI Put a specified value in a


specified register.
e.g. MVI A B8H - put B8H in A
register
MVI B 5FH - put 5FH in B
register
Free Powerpoint Templates

Page 6

B 8

MVI A,B8H

A Register (Accumulator)
B
Register
C
Register
D
Register
E
Register
H
Register
L
Register

PC (Program
Counter)
SP (Stack Pointer)

SR (Status
Free Powerpoint Templates
Register)

Page 7

5 F

MVI B,5FH

A Register (Accumulator)
B
Register
C
Register
D
Register
E
Register
H
Register
L
Register

PC (Program
Counter)
SP (Stack Pointer)

SR (Status
Free Powerpoint Templates
Register)

Page 8

ADI Add the specified value to


register A
e.g. ADI 4BH
SUI Subtract the specified value
from register A
e.g. SUI 12H

Free Powerpoint Templates

Page 9

INR Increment specified register


by 1
e.g. INR C
DCR Decrement specified register
by 1
e.g. DCR B

Free Powerpoint Templates

Page 10

LDA Load data into A from given


RAM address
e.g. LDA 14C3H
STA Store data from A into given
RAM address
e.g. STA 2259H
HLT Halt program
Free Powerpoint Templates

Page 11

Example
MVI A 33H
INR A
STA 12C3H
HLT
Free Powerpoint Templates

Page 12

3 3

MVI A, 33H

A Register (Accumulator)
B
Register
C
Register
D
Register
E
Register
H
Register
L
Register

PC (Program
Counter)
SP (Stack Pointer)

SR (Status
Free Powerpoint Templates
Register)

Page 13

3 4

INR A

A Register (Accumulator)
B
Register
C
Register
D
Register
E
Register
H
Register
L
Register

PC (Program
Counter)
SP (Stack Pointer)

SR (Status
Free Powerpoint Templates
Register)

Page 14

12C3H

STA 12C3H
HLT

3 4

A Register (Accumulator)
B
Register
C
Register
D
Register
E
Register
H
Register
L
Register

PC (Program
Counter)
SP (Stack Pointer)

SR (Status
Free Powerpoint Templates
Register)

Page 15

Example
LDA 55C1H
SUI 10H
STA 55C1H
HLT
- for this example, let's suppose
55C1H starts with the value 6AH
Free Powerpoint Templates

Page 16

55C1H

6 A

LDA 55C1H

A Register (Accumulator)
B
Register
C
Register
D
Register
E
Register
H
Register
L
Register

PC (Program
Counter)
SP (Stack Pointer)

SR (Status
Free Powerpoint Templates
Register)

Page 17

5 A

SUI 10H

A Register (Accumulator)
B
Register
C
Register
D
Register
E
Register
H
Register
L
Register

PC (Program
Counter)
SP (Stack Pointer)

SR (Status
Free Powerpoint Templates
Register)

Page 18

55C1H

STA 55C1H
HLT

5 A

A Register (Accumulator)
B
Register
C
Register
D
Register
E
Register
H
Register
L
Register

PC (Program
Counter)
SP (Stack Pointer)

SR (Status
Free Powerpoint Templates
Register)

Page 19

Types of Memory Addressing 1


Immediate operand is a specific
numerical value, not an address in RAM
e.g. MVI B,52H
ADI 22H
SUI FFH
Free Powerpoint Templates

Page 20

Types of Memory Addressing 1


Load Extended Immediate (LXI)
Loads a pair of registers (BC, DE or HL) with
the 2 bytes specified.
e.g. LXI D,3F67H
- loads D register with value 3FH and
- loads E register with value 67H
Free Powerpoint Templates

Page 21

LXI D 3f67H

A Register (Accumulator)

3 F
6 7

B
Register
C
Register
D
Register
E
Register
H
Register
L
Register

PC (Program
Counter)
SP (Stack Pointer)

SR (Status
Free Powerpoint Templates
Register)

Page 22

Types of Memory Addressing 2


Direct operand represents an address
in RAM (address bus is 16 bits or 2
Bytes)
e.g. LDA 55A2H
STA AB31H
Free Powerpoint Templates

Page 23

Another Direct Command:


Load HL Pair Direct
LHLD Load value stored at given RAM
address into L register and load value at next
address into H register
e.g. LHLD 45CDH
- load value stored at 45CDH into register L and
- load value stored at 45CEH into register H
Free Powerpoint Templates

Page 24

Another Direct Command:


Store HL Pair Direct
SHLD Store contents of L register at the
specified RAM address. Store contents of H
register at the next adjacent RAM address.
e.g. SHLD 6649H
- store contents of L register at 6649H.
- store contents of H register at 664AH.
Free Powerpoint Templates

Page 25

Types of Memory Addressing 3


Indirect operand specifies a
pair of registers (BC, DE, or
HL) where the RAM address of
the data is stored.

Free Powerpoint Templates

Page 26

An Indirect Command:
Load Accumulator Extended
LDAX Loads into register A the data
stored at RAM address specified by pair of
registers
e.g. LDAX D
Byte from register D and byte from
register E are put together to make a RAM
address. Value stored at that RAM address
Powerpoint
Templates
is loadedFree
into
register
A.
Page 27

Another Indirect Command:


Store Accumulator Extended
STAX Stores value in register A into the
RAM address specified by pair of registers
e.g. STAX B
Byte from register B and byte from
register C are put together to make a RAM
address. Value from register A is stored at
that RAM
address.
Free Powerpoint Templates
Page 28

Example

MVI A,33H
MVI B,89H
MVI C,87H
STAX B
HLT

Free Powerpoint Templates

Page 29

MVI A,33H

3 3

A Register (Accumulator)
B
Register
C
Register
D
Register
E
Register
H
Register
L
Register

PC (Program
Counter)
SP (Stack Pointer)

SR (Status
Free Powerpoint Templates
Register)

Page 30

MVI B,89H

3 3
8 9

A Register (Accumulator)
B
Register
C
Register
D
Register
E
Register
H
Register
L
Register

PC (Program
Counter)
SP (Stack Pointer)

SR (Status
Free Powerpoint Templates
Register)

Page 31

MVI C,87H

3 3
8 9
8 7

A Register (Accumulator)
B
Register
C
Register
D
Register
E
Register
H
Register
L
Register

PC (Program
Counter)
SP (Stack Pointer)

SR (Status
Free Powerpoint Templates
Register)

Page 32

8987H

STAX B

3 3
8 9
8 7

A Register (Accumulator)
B
Register
C
Register
D
Register
E
Register
H
Register
L
Register

PC (Program
Counter)
SP (Stack Pointer)

SR (Status
Free Powerpoint Templates
Register)

Page 33

Low-Level Repetition &


Selection
Introduce concept of looping with JMP
Every instruction has a memory location (used by
program counter)
e.g. JMP 0033H
- means jump to instruction at memory location
0033H

Free Powerpoint Templates

Page 34

Low-Level Repetition &


Selection
Must keep track of how much
space each instruction requires in
order to loop to the right location

Free Powerpoint Templates

Page 35

Conditional Loops
By comparing two values, we cause
flags to be set in the status register.
Based on the result of this comparison
we can decide to loop or not.
1.

Compare another register to A.


e.g. CMP C

Free Powerpoint Templates

Page 36

Conditional Loops
Sets the flags in the status
register as if we were subtracting
contents of C from A. (Does not
actually subtract)

Free Powerpoint Templates

Page 37

Conditional Loops
2.Compare an immediate value to
register A.
e.g. CPI FFH
Sets the flags in the status register as
if we were subtracting the value FF
from A. (Does not actually subtract)
Free Powerpoint Templates

Page 38

Conditional Loops
Now, looking at the flags in the status register,
we can tell our program to loop under certain
conditions. (Each command is followed by the
memory location to jump to)
JZ - Jump if Zero
JNZ - Jump if Not Zero
JP - Jump if Plus
JM - Jump if Minus
Free Powerpoint Templates

Page 39

Example
MVI A,07H
INR A
CPI 0BH
JNZ ??
STA 4400H
HLT
Free Powerpoint Templates

Page 40

0100

MVI A,07H

0102

INR A

0103

CPI 0BH

0105

JNZ ??

0108

STA 4400H

010A

HLT

Free Powerpoint Templates

Page 41

0100

MVI A,07H

0102

INR A

0103

CPI 0BH

0105

JNZ 0102H

0108

STA 4400H

010A

HLT

Free Powerpoint Templates

Page 42

S-ar putea să vă placă și