Classic Computer Magazine Archive COMPUTE! ISSUE 77 / OCTOBER 1986 / PAGE 10

BASIC Orphans

I own an Atari 800 computer and am trying to write a game. But I have problems when I try to use the variable COMP. For example, I get an error whenever I type COMP=32. I then try typing COMP (42). The computer just prints READY. Please tell me what this command is used for.

Brain Korn

Atari BASIC, like most early versions of the language, won't let you include reserved BASIC words as part of a variable name. For example, the variable FORCE cannot be used because it contains the embedded BASIC keyword FOR. The variable name COMP is illegal for exactly the same reason, even though the cause is less apparent. When Atari BASIC was written, many different commands were considered, but some of them had to be omitted because of memory limitations. The keyword COM is reserved but unimplemented in Atari BASIC (it would have been used to declare common variables).

Though COM doesn't perform its intended function, it is still recognized as a BASIC keyword and can't be used as part of a variable name. COM is diverted to the DIM command, so the statement COMP (42) has the same effect as DIM P(42). Since DIM requires a value in parentheses, the statement COMP=32 generates a syntax error when BASIC finds an equal sign (=) instead of a left parenthesis. This program PEEKs Atari BASIC ROM and prints all the BASIC statements and functions. As you'll see, COM is the only unimplemented keyword.

10 ADDR = 42163 : ? : ? "--STATEMENTS--" : ?
20 IF NOT PEEK (ADDR) THEN 50
30 BYTE = PEEK (ADDR) : ADDR = ADDR + 1 : IF BYTE<128 THEN? CHR$ (BYTE); : GOTO 30
40 ? CHR$ (BYTE-128) : ADDR = ADDR + 2 : GOTO 20
50 ADDR = 43049 : ? : ? "--FUNCTIONS--" : ?
60 IF NOT PEEK (ADDR) THEN END
70 BYTE = PEEK(ADDR) : ADDR = ADDR + 1 : IF BYTE<128 THEN ? CHR$(BYTE); : GOTO 70
80 ? CHR$ (BYTE - 128) : GOTO 60

Orphan keywords occur in other versions of BASIC as well. For instance, BASIC 7.0 for the Commodore 128 tokenizes QUIT and OFF, but neither statement performs any function. The OFF keyword may have been intended as part of a KEY OFF statement similar to KEY OFF in BASICA for the IBM PC.