Figure 7.3 Difference between immediate-mode and direct-mode addressing
5
Some Sample Instructions
Figure 7.3 Subset of Pep/7 instructions
6
Sample Instructions
7
Sample Instructions
8
Sample Instructions
9
Sample Instructions
10
Algorithms
Write "H"Write 48 (hex)
Write "e"Write 65 (hex)
.
.
.Write "o"
Write 6F (hex)
11
A Program Example
12
Hand Simulation
13
Hand Simulation
14
Hand Simulation
15
Pep/7 Simulator
16
Pep/7 Simulator
17
Pep/7 Assembly Language
18
Pep/7 Assembly Language
19
Assembly Process
20
A New Program
Reading and adding three numbersSet sum to 0Read num1Add num1 to sumRead num2Add num2 to sumRead num3Add num3 to sumWrite sum
21
Our Completed Program
22
Decision Making
23
Decision Making
…Add num3 to sumIf sum is negative
Write "Error"Else
Write sum
Write "Error" if sum is negative.
24
Decision Making
Add num3 to sumIf status bit N is 1
Go to NegMsgWrite sumQuit: STOPNegMsg: Write the message and go to Quit
25
Decision Making
Read limitSet sum to 0While (limit is not zero)
Read numberSet sum to sum + numberSet limit to limit - 1
26
Decision Making
Set the accumulator to limitSubtract one from the accumulatorCompare accumulator to zeroIf status bit Z is 1
go to QuitElse
go to Read
27
Decision Making
What do you think?
Suppose the government no longer required physical crash tests for new cars. What factors might you consider before buying a car that was crash tested only by computer simulation?