Chapter 8 Peripheral Devices 291
To print these as a graphic shape, put the values into CHR$ statements,
such as the following:
10
DATA
28,42,85,81,81,85,42,28
20
OPEN
1,4
30
PRINT#I,
CHR$(8);
40
FOR
R
=1
TO
8
50
READ
A
60
PRINT#1,CHRS(A+128);
70
NEXT
80
PRINT#1
90
PRINTtl
This will print a smiling face on the printer. You can print more smiling
faces by repeating this pattern.
You can also use the function keys to produce the special characters.
Here's a short program
that
prints whatever text you enter into it, plus a
smiling face.
The smiling face will
be
printed (on the printer
only-an
asterisk will
be
printed on the screen) each time you hit the FI
key.
10
OPEN
1,4
20
GET
AS:
IF
A.·""
THEN
20
30
IF
A$
..
tt(F1)"
THEN
70
40
PRINT4H,
fI$
50
PRINT
AS;
60
GOTO
20
70
DATA
28,42,85,81,81,85,42,28
80
PRINT.l,
CHR$(S);
90
FOR
R"'l
TO
8
100
READ
fI
110
~RINT.l,
CHR$(A+128);
120
NEXT:
PRINT
"III";
130
PRINT.l,
CHRS(15)
140
RESTORE:
GOTO
20
GRAPHICS
REPEAT
FUNCTION
The graphics repeat function allows you to print any pattern
of
seven
vertical dots
as
many times as you like (up to
255
times per command).
Here's an example of a repeat function.
OPEN
1,4
PRINTll.·
CHR'(26)CHR'(
HJ)CHR'(255)