Atari 400/800 Variable Name Utility
For compactness, Atari BASIC stores the ATASCII strings of variable names in a table called the variable name table. The program needs only a one byte reference to the variable name table to determine the desired variable name. This allows the programmer to use long descriptive variable names as the ATASCII string is stored only once, regardless of the number of times that variable name is used in the program.
When studying a program it is sometimes desirable to know what variable names are already in use. This utility will display the contents of the variable name table.
- Clean out the computer's memory using the "NEW" command.
- Type in the variable name table dump utility using line numbers that you do not normally use in writing BASIC programs. Modify the GOTO statements in lines 6 and 7 if you do not use my numbering scheme.
- Save the utility on tape or disk using the "LIST" command.
- Read in the desired BASIC program.
- Read in the variable name table dump utility using the "ENTER" command. This will overlay your program with the utility program.
- Start the utility by entering "GOTO x" where "x" is the first line number of the utility.
- Observe the variable name table as it prints on the screen. The last character of each variable name will be printed in inverse video.
1 POKE 1664, PEEK(130) : POKE 1665, PEEK(131) 2 IF PEEK (1664) = PEEK(132) THEN IF PEEK (1665) = PEEK(133) THEN ?: STOP 3 ?CHR$ (PEEK(PEEK(1664) + 256 * PEEK(1665))); 4 IF PEEK (PEEK(1664) + 256 * PEEK(1665)) > 127 THEN PRINT " "; 5 IF PEEK(1664) = 255 THEN POKE 1664, 0 : POKE 1665, PEEK(1665) + 1 : GOTO 2 6 POKE 1664, PEEK(1664) + 1 : GOTO 2
|130, 131||Contains the address of the start of the variable name table.|
|132, 133||Contains the address of the end of variable name table + 1.|
|1664,1665||Pointer used by variable name table dump routine. The pointer is stored in memory that is not used either by the operating system or by BASIC.|
|1||Set up pointer.|
|2||Check if done.|
|3||Print one character of variable name.|
|4||Print space if last character of variable name.|
|5-6||Increment two byte pointer.|
- Normally, the variable name table contains names no longer used by the program. Because these variable names occupy memory area, it would be desirable to remove them. Unused variable names can be removed from the variable name table by saving the program with the "LIST" command, clearing memory using the "NEW" command, and then reloading the program using the "ENTER" command.
- If you do not have room to add this utility, you can delete as many lines of your program as needed by typing in their associated line numbers followed by RETURN. Deletion of program statements in this manner will have no effect on the variable name table.