Download Print this page

Epson MX-80 User Manual page 63

Hide thumbs Also See for MX-80:

Advertisement

Advanced C r a p
B A S S
C L E F
M L J S I C :
C O
8 1 6
H A R M O N I C
WAY
M U S I C T O W N ,
USA
11
Figure 7-3
Beautiful, isn't it. (We've squeezed it up a little here in the Manual to make it fit,
but on the Printer it should be 7-11/16" wide.) Hitch up your pants and tighten
your belt. Here we go — a line at a time:
Let's start our NEW program by carefully typing in these lines:
2 0 READ A :
I F A > 1 0 0 L P R I N T C H R $ ( A + 3 2 ) ;
: GOTO 2 0
3 0
I F A>0 READ B : L P R I N T S T R I N G $ ( A , B + 3 2 ) ;
: GOTO 2 0
4 0
I F A=0 L P R I N T
: GOTO 2 0
5 0 ON A B S ( A )
GOSUB 6 0 , 7 0 , 8 0
: GOTO 2 0
90 DATA
1 5 1 , 1 6 3 , 1 5 9 , 1 7 5 , 1 4 7 , 1 6 3 , 1 4 7 , 1 9 , 1 3 1 , 1 7 1 , 0
Analysis of the Program Logic
Look carefully at lines 20,30,40 and 50. Their logic is very straightforward.
We begin by reading a value for A from DATA. That value is then tested up to 4
times, once in each line.
" A " 's value will fall in one of 4 ranges. When its value matches a range, something
will happen in the line where the match takes place:
Line 20
greater than 100
Line 30
greater than 0 (but less than 100)
Line 40
exactly zero
Line 50
none of the above, (which only leaves a negative number)
Correspondingly, these 4 categories of numbers are "coded" into our DATA lines.
Now look at line 90. How many of the 4 categories of numbers can you find?
and RUN.
I T F T
l
Figure 7-4

Advertisement

loading