Lecture 9 Microprocessor Programs
Lecture 9 Microprocessor Programs
Microprocessor
Programs
Lecture 9(a)
Program Design
Flowcharts
For complicated problems, flowcharts help
simplify the development of the program.
Labels at points
Example 1 DE = 4000h
where there is a HL = 6000h
junction BC = 1000h
MOVE_NEXT
Increment DE
Increment HL
Decrement BC
BC = 0? N
MOVE_NEXT
Assembling Programs
Cont’d
Assembling labels
The program is first assembled with blank
memory spaces left for the 16-bit addresses
corresponding to the label values.
ORG 9000H
Program Execution
Program Execution Illustration Memory
address (hex)
Contents
(hex)
Program 0850 DB
0851 06
ORG 8050h 0852 06
0853 7F
IN 06h Program 0854 88
MVI B,7FH into 0855 32
ADD B memory 0856 50
STA 085Ch
0857 08
HLT
0858 76
0859 10
085A 6F
085B DD
Ports
Data
085C 14
085D 88
Program
Execute
Fetch Execution
byte Illustration
instruction
instruction
Memory
address (hex)
Contents
(hex)
0850 DB
8085 CPU 0851 06
0852 06
PC 8057
8053
8055
8050
8051
8052
8054
8056
8059
8058 0853 7F
0854 88
IR 3208
DB
06 76
06
7F
5C
88 0855 32
0856 5C
0857 08
A
16
96
0858 76
Port address
0859 Contents
10 (hex)
B
7F (hex)
085A 6F
04 D5
Cy 01 085B
05
DD
86
085C 14
96
06 16
085D 88
07 E1
High Level Programming
The standard practice is to write programs using high
level programming languages
1. Question 2
2. Question 3