Documente Academic
Documente Profesional
Documente Cultură
Program Design
Lecture 11(a)
Programming Design
Program Development Steps
Understand the problem: form of data involved,
necessary interface circuits, existing ways of solving
situation at hand.
Practical Programs
where there is a
junction Set counter (reg B) to 8)
alternate pathways
exist; label one of the
two paths
write_bit
Shift LSB of register A into carry flag
Y write_1
Is carry flag set?
Y
End Do while construct
Start
Practical ProgramsSequential
HL = 9000h; C = 8h; clear E
Label_1
B =8h
Preserve (HL) in D
Label_2
EX-OR D with E, keep D & E unchanged
Y Label_3
Carry set?
EX-OR E with 18H;
N
If-then store results in E
Label_4
construct Do while
Shift right Ereplacing MSB with carry
flag & LSB with 0 PLUS while-
Label_5 N
Decrement B; B = 0?
do
Shift D to right;
Y
Decrement B N Label_6
Decrement C; C=0?
Do while Increment HL;
Y
decrement C
End
Class Design Exercise1
Programming Exercises
1. Question 1
2. Question 2
3. Question 3
Class Design Example 1
Develop a program that finds the maximum in a
block of locations from memory address 5001H to
memory address 5200H. The numbers are
unsigned values.
Class Design Example 2
A microprocessor based system that works as follows is required:
When temperature is below 20˚C, turn on a heater
If temperature is in the range 20˚C to 28˚C, switch off everything
If temperature is above 28˚C, turn on a fan
Programming Design
Class Design Example 3
Write a program to move characters in memory block
addresses 7001H to 8000H to memory block starting
at C000. The source block contains a text body.
When moving it to the new block, any lower case
characters must be converted to uppercase.