Lawrence R. Stark

A common problem, the lack of a TAB statement in Atari BASIC, is solved with a single POKE.

Perhaps my first experience with the Atari was similar to yours. Looking at the machine on display and generally feeling favorable, I finally pushed aside a few space war players and sat down to try it out. Having found the BASIC ROM cartridge, I tried to construct a short test program. The only program that came to mind in this stage was to do a few loops and GOSUBs with the phrase : "THIS IS A TEST." To vary it a bit, I fooled around with print positions.

But do this in Atari BASIC and you discover that the TAB command is not there. So you make do with spaces and the like to design printed output. This does not work well. A few subroutines, including some published in COMPUTE!, can be of help, but can also be awkward.

It's In The Maps

So finally I started looking at memory map listings. And there it was. The map is full of TABs. They are at locations 82, 85, 91, and 657. All one has to do is POKE in new values and most of these work – on the TV screen. Not much happens on the printer.

But what is this at location 201? PTABW is the name. It even looks like a shortened name of Print-Tab-Width. And it is! It is the missing TAB command, and in this case it works for both printer and TV screen.

Experiment with it a bit and you learn its rules. First, its formula is POKE 201, nn, followed by PRINT, avar or svar. Remember the comma; after all, it is the tabulator that you are modifying.

But there are two hitches. One is that if you try it with nn at 0, awful things happen. A loop is entered and even the BREAK key doesn't interrupt. The second limitation is that the default setting is not restored except on powering down the computer. Even RESET does not return the value at 201 to 10.

When using the Atari "TAB" in a program, you will have to provide error messages or traps and also reset the default setting. The demonstration program shows an example. The value of nn is tested for "less than one" and a "bypass" is executed if it is. This could just as easily work like an ordinary error message if you have the program STOP or END on less than one. The value at 201 is restored before the program shuts off at line 800. The demonstration program is what might be called the "page centering algorithm." It is used here because it is illustrative of several features of the pseudo-TAB in Atari BASIC.


10 DIM A$(38) : ? CHR$(125)
15 TRAP 800 : REM Trap end of data
20 READ A$
50 X = 17 - (LEN(A$)/2) : REM Center at 17 on 38 col TV screen
60 IF X < 1 THEN 20 : REM Bypass a potential crash
100 POKE 201, X
120 ? , A$
150 GOTO 20
800 POKE 84, 20 : POKE 201, 10 : END : REM for a neater screen AND to reset default tabs
899 REM Commas in DATA statements for blank lines
900 DATA A TALE OF TWO CITIES , , A Novel , , , , by , , Charles Dickens , , , , , , , , 1832

Return to Table of Contents | Previous Section | Next Section