Apple IIGS: Tabbing In Applesoft BASIC


An Applesoft "PRINT TAB" statement, such as:

PRINT TAB(10);"A"; TAB(20);"B"; TAB(30);"C"

works on the Apple IIe and ImageWriter II, provided that you precede it
with a Tab Enable statement. For example

PRINT CHR$(9);"T E"

However, the PRINT TAB statement (shown above) on an Apple IIGS and an
ImageWriter II results in spacing 10 or 20 spaces rather than tabbing to
those columns. When using PRINT TAB for screen formatting, there is no
such problem.

The reason for this is that, when printing hardcopy, PRINT TAB appears to
be tabbing the specified spaces from last character. For example:

50 PRINT TAB (20);"Column 20";TAB (40);"Column 40"

causes the first tab to be placed at column 20, but the second tab is
placed at column 68. Here's why. The first tab statement puts the cursor
at column 20. Because the Tab Enable statement defines each tab as
9-characters wide, the tab extends from column 20 to column 28 (one
character at column 20 with the remaining 8 characters pushing the last
character out to column 28). When the TAB 40 statement executes, 40 spaces
are added to the last cursor location (column 28), placing the cursor at
column 68.

There are two ways to handle this problem on the Apple IIGS. The first way
is use the HTAB statement to format columns correctly:

40 HTAB 40:PRINT "Column 40":HTAB 60: PRINT "Column 60"

Old Apple II manuals state that this is not possible, but HTAB works
correctly on the Apple IIGS, both on the screen and on the printer.

Overall, TAB and HTAB work as expected on the screen. When TAB and HTAB
are used for printing, three factors must be considered:

- The type of Apple II.

- The interface card through which printing takes place.

- The active printer.

Each of these variables affect the TAB and HTAB commands when used in
printing.

The second way to handle this is with the "A" command. Page 92 of the
"Apple IIGS Firmware Reference Manual" states that the "A" command
('A'pplesoft Tabbing) duplicates the function of the "T" command of the
Super Serial Card. Issuing this command makes the TAB command work as you
would expect when using a printer.

Note: The command name ("A") was changed to avoid a conflict between
"T"erminal mode and "T"abbing.


Published Date: Feb 18, 2012