Repeated Data Numbers - Epson FX Series User Manual

Fx series printer
Hide thumbs Also See for FX Series:
Table of Contents

Advertisement

like this one, you can just get the program to reread one set of data by
using a RESTORE statement. To see this, change two lines and then
RUN the program:
30 FOR Y=l TO 10: RESTORE: LPRINT A$;
70 NEXT X: NEXT Y
Although the new loop in line 30 repeats the pattern
don't need
10
statement in line 30 tells the program to read the same data again. If
you use it carefully, the RESTORE statement can reduce the amount
of data that you need to type in for a graphics pattern.

Repeated DATA numbers

Sometimes you will want to repeat the same DATA number several
times in succession. Here's a change that gives an instance:
90 DATA 8,28,62,93,28,28,28,28,28,28,93,62,28,8
At the center of this program line you fire the middle three pins-with
CHR$(28)-six times in succession. Six 28s was boring enough to
type. Can you imagine typing the data for 20 or 50 repetitions of the
same number? There has to be a-better way-and there is.
You can enter the number of repetitions right into the DATA lines,
coded as a negative number. Then change the READ routine to test for
a negative number. When the program reads a negative number, it
transfers control to a special subroutine that does the repeating. (Or
you could use a STRING$ statement.)
Change lines 50 and 90, and add lines
listing looks like this:
20 A$=CHR$(27)+"K"+CHR$(14)+CHR$(0)
30 FOR Y=l TO 10: RESTORE: LPRINT A$;
40 FOR X=1 TO 14
50 READ N: IF N<0 THEN 100
60 LPRINT CHR$(N);
70 NEXT X: NEXT Y
156
repetitions of the DATA statements. The RESTORE
and 120 so that your
100, 110,
times, you
10

Hide quick links:

Advertisement

Chapters

Table of Contents
loading

This manual is also suitable for:

Fx-100Fx-80Fx-185 - impact printer

Table of Contents