CHR$(9) is a problem with some computers. Some BASICS
convert CHR$(9) to a group of spaces that act like a sort of
pseudo-tab. This is line if the computer and the printer have the
same tab settings, but it doesn’t allow us to use our own tab
settings on SD-lOjl5. We can
“outsmart” these computer by
adding 128 to the ASCII value that we use. Instead of using
CHR$(9), use CHR$(137) for a tab command. Even this trick
won’t work for Apple II computers, for they use CHR$(9) for
something else entirely. Apple users can get some help in Appendix
J.
Now add the following line to your program to set different
horizontal tabs:
15 LPRINT CHR$(27) I'D" CHR$(7) CHR$(lb) CHR$(21) CHR$(@)
< ESC > “D” is the command to begin setting horizontal tabs.
It must be followed by characters representing the positions that
you want the tabs set. In our program we are setting tabs in
columns 7, 14, and 21. The CHR$(O) at the end ends the string
of tabs. In fact, any character that is not greater than the previous
one will stop setting tabs. This means that you must put all your
tab values in order, from least to greatest, or they won’t all get
set. (It also means that a CHR$(l) is just as good as a CHR$(O)
for ending a group of tabs; some computers have trouble sending
CHRS(O).)
When you run the program now it produces this:
one
t. WC2
three f out-
The words are now closer together, but still evenly spaced.
Turn your printer off and on again to reset the default tabs.
-
n A one-shot tab command
Suppose you need to move to a position across the page, but
you only need to do it once. It doesn’t make much sense to set
up a tab to use only one time. There must be an easier way-and
of course there is.
The solution is called a one-time tab and is < ESC > “b”
CHR$(n). This command moves the print head n columns to the
right. It has the same effect as sending n spaces to the printer.
62