Commodore 2001-8 User Manual page 80

Table of Contents

Advertisement

deleted by BASIC; although this does not greatly effect the printing, it should be remembered that when
reading back from tape or another 110 device that file delimIters must be forced. This forcing can be done
by inserting a CHR$(44) or "," between fields or by only printing single fields in each PRINT# statement
which will force carriage returns between fields. Example:
instead of writing
PRINT#LF,A;B$;C$
which will be sent as
AB$C$
with no delimiters:
PRINT#LF,A;CHR$(44)B$;CHR$(44);C$
or:
PRINT#LF,A", ";B$;", ";C$
which will output: (Note: CR means carriage return)
A,B$,C$,CR
or:
PRINT#LF,A
PRINT#LF,B$
PRINT#LF,C$
which will output:
A CR B$ CR C$ CR
Because BASIC always formats outputs to any devices as though it were outputting to the screen,
PRINT#LF,A,B has several skip characters between the values of A and B, while A;B does not have any
extra skips.
An exception to this rule is the tape where the first skip on output is supressed.
Note: Although both the INPUT# AND PRINT# commands operate in virtually the same way as their
equivalent INPUT and PRINT statements do in BAS/C, the abbreviated command? which can be used in
place of PRINT, does not apply to PRINT#. ?# and PRINT# are recognized and reduced to two different
token characters when processed by BAS/C. ?# will/oak like PRINT# when listed but gives ?SYNTAX
ERROR when an attempt is made to execute it.
Examples of the PRINT# Statement
This program will print the series of numbers 1,2,3... 50, one at a time on a PET printer.
100PEN 5,4,0
Open logical file #5. Assign logical file #5 to device #4 (PET
printer) in normal print mode corresponding to secondary
address "0".
20 FOR K
=
1
to
50
30 PRINT#5,K
40 NEXT K
50 CLOSE 5
Print the series of 50 numbers on printer.
Close logical file #5.
To write the above series of numbers on a cassette in tape unit #2, only the OPEN line would have to be
modified, if the same logical file numbers were chosen:
100PEN 5,2,1
Open logical file #5. Assign logical #5 to device #2 (tape unit
#2) with a write without "end of tape" designation
corresponding to secondary address '1'.
77

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pet 2001-8

Table of Contents