Relatively Simple CPU and 8085 Microprocessor Instruction
Relatively Simple CPU and 8085 Microprocessor Instruction
• Summary
Relatively Simple microprocessors, or CPU
• Designed as an instructional aid and draws its
features from several real microprocessors
Instruction Operation
JUMP Γ GOTO Γ
JMPZ Γ If (Z = 1) Then GOTO Γ
JPNZ Γ If (Z = 0) Then GOTO Γ
Z – zero flag
Γ -- 16-bit memory address
Note:
• Each instruction is having an 8-bit instruction
code.
• LDAC, STAC, JUMP, JUMPZ, and JPNZ
instructions all require a 16-bit memory
address, represented by Γ /M[Γ ]. These
instructions each require 3 bytes in
memory.
Instruction formats for the Relatively
Simple CPU
byte 1 Instruction code
byte 2 Low-order 8 bits of Γ
byte 3 High-order 8 bits of Γ
Example:
25: JUMP 1234 H
instruction stored in memory:
25th byte 25: 0000 0101 (JUMP)
26th byte 26: 0011 0100 (34H)
27th byte 27: 0001 0010 (12H)
H -- in hexadecimal format
• Example program using Relatively Simple CPU coding
CY – carry flag
Program control instruction for the
8085 microprocessor
Instruction Operation
JUMP Γ GOTO Γ
Jcond Γ If condition is true then GOTO Γ
CALL Γ Call subroutine at Γ
Ccond Γ If condition is true then call subroutine at Γ
RET Return from subroutine
Rcond If condition is true then return from subroutine
Example:
25: MVI r, n
Specifies r
instruction stored in memory:
25th byte 25: 00xxx110 (MVI r)
26th byte 26: xxxx xxxx (low-order memory)
byte 1 Instruction code
Three-byte byte 2 Low-order 8 bits
byte 3 High-order 8 bits
Example:
Example:
25:
25: LXI r1,Γr2
MOV rp,
Specifies rp
instructionstored
instruction storedininmemory:
memory:
25th
25thbyte
byte 25: 25: 00rp00000001
0001 (LXI
(MOV)rp)
26th
26thbyte
byte 26: 26: xxxxxxxxxxxx
xxxx (low-order
(specifies memory)
r1)
27thbyte
27th byte 27: 27: yyyyyyyyyyyy
yyyy (specifies r2)
(high-order
memory)
• Example program using 8085 microprocessor coding
The Algorithm of the program
1: total = 0, i = 0
2: i=i+1 n + (n - 1) + … + 1
3: total = total + i
4: IF i ≠ n THEN GOTO 2
The 8085 coding of the program
LDA n
i=n
MOV B, A
XRA A sum = A ⊕ A = 0
Loop: ADD B sum = sum + i
DCR B i=i-1
JNZ Loop IF i ≠ 0 THEN GOTO Loop
STA total total = sum
Analyzing the 8085 ISA
• The 8085 CPU’s instruction set is more
complete than that of the Relatively
Simple CPU. More suitable for consumer
appliance.
2. The ISA does not specify how the CPU is designed, but
it specifies what it must be able to do.