EasyManua.ls Logo

Commodore VIC-20 - Page 301

Commodore VIC-20
404 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter
8:
Peripheral Devices 287
between them. Remember, however,
that
numeric variables will still be
preceded by a space even with the semicolon. To see this, try the following
program:
10
OPEN
1,4
20
A-21
:
B=300
:
AB-S7
30
PRINTll,AlBlAB
TABandSPC
The TAB and
SPC
instructions are so similar that they are often
confused. The TAB function designates an absolute position, and the
SPC
function indicates a relative position. The following TAB statement will
print
an
asterisk in column
10
of the screen:
PRINT
TAI(0)l "til"
N ow try the following statement.
It
will print one asterisk in column
10
and another in column
11.
PRINT
TAl
(
10);
"til" ;
TAlC
le);
"III"
The
SPC
instruction begins
at
the current cursor position and counts
the indicated number
of
spaces over from that point. Try the following SPC
statement:
PRINT
SPC(10);"tII";SPC(10);"III"
Although this line looks almost identical to the TAB statement above, it
prints one asterisk in column
10
and another in column
21.
This happens
because the
SPC
function starts counting
at
the space immediately after the
first asterisk (column
11)
and puts the next asterisk ten spaces away.
Using
POS
to Tab the
Printer
When used in PRINT# statements, TAB and
SPC
both act like SPC.
Note, however,
that
TAB
and
SPC
cannot appear directly after PRINT#
(for example, PRINT#I, TAB(20».
To take a look
at
these two functions, first open the printer file with
OPEN
1,4
N
ow
type in the following line:
PRINTl1,
"";SPC(10);
"tII";SPC(10)l
"til"

Other manuals for Commodore VIC-20

Related product manuals