Professional Documents
Culture Documents
• 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
cond – conditional instructions
NZ (Z = 0) Z (Z = 1) P (S = 0) N (S = 1)
PO (P = 0) PE (P = 1) NC (CY = 0) C (CY = 1)
Z – zero flag, S – sign flag, P – parity flag, C – carry flag
Note:
• Each instruction is having an 8-bit instruction
code.
• Some instructions have fields to specify
registers, while others are fixed.
Instruction formats for the Relatively
Simple CPU
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
MOV rp,
r1,r2
Specifies rp
instructionstored
instruction storedininmemory:
memory:
25thbyte
25th byte 25: 25: 00rp00000001
0001 (LXI
(MOV)rp)
26th
26thbyte
byte 26: 26: xxxxxxxxxxxx
xxxx (low-order
(specifies memory)
r1)
27th
27thbyte
byte 27: 27: yyyyyyyyyyyy
yyyy (high-order
(specifies r2)
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.