Classic Computer Magazine Archive ANTIC VOL. 2, NO. 11 / FEBRUARY 1984

TYPO

Type your program once

by BILL WILKINSON

TYPO is designed to help you find the typing errors you make when entering the BASIC programs published in ANTIC. TYPO generates a table of values called a "Typo Table", which includes a variable checksum line-number ranges, codes and lengths. Compare your table with the appropriate Typo Table in ANTIC. (A different table accompanies each BASIC listing. ) If the two are not identical, you've probably made a "typo" that needs to be corrected.

HOW TO USE TYPO

These instructions apply when you use TYPO to test other programs. See the next section for instructions on how to use TYPO to check itself.

1. Enter the program listing exactly as shown.

2. LIST this program to disk (LIST "D:TYPO.LST") or cassette (via LIST "C:"). When using a cassette, reserve an entire blank cassette for TYPO.

3. Type NEW to clear memory.

4. Type in a program from ANTIC.

5. LIST this program to disk (LIST "D:NAME") or cassette (LIST"C:"). Type NEW and reenter the program (ENTER "D:NAME" or ENTER "C:").

6. Append the TYPO program onto the end of the program from the disk (ENTER "D:TYPO.LST") or cassette (ENTER "C:").

7. Type GOTO 32000. You will be prompted for "File for output." Type [S] [RETURN] for screen output or [P] [RETURN] to send output to the printer. Your Typo Table will then be printed to the appropriate device. Compare your table with the one published with the BASIC listing. If they agree, you're finished and the program should run.

8. If any values in the two tables do not agree, note the variable-checksum value and keep it handy.

9. Examine the lines which have codes and/or lengths that disagree. Correct any errors.

10. If and only if the variable checksum you noted agrees with the one in the magazine, return to Step 7 (above) an try again.

11. If the variable checksums do not agree, you must go to Step 5 (above) and perform the listing and reentering ritual! You may skip Step 6, however, since (presumably) you have already merged the two programs with LIST and EN

TER. HOW TO USE TYPO ON ITSELF

1. Follow Steps 1-3 above.

2. Load the saved TYPO (ENTER "D:TYPO.LST" or ENTER "C:").

3. Change 32000 to 32500 in lines 32180 and 32200. This alteration applies only when you use TYPO to check itself.

4. Go to Step 7 (above).

WHAT TYPO IS TELLING YOU

This program is fussy! It counts every period, comma, and space. It also cares about the order in which you type in program lines! The order in which variable names are stored depends on the order in which the lines were typed. If this order is altered, the values of the tokens and subsequent checksums will also be changed.

The variable checksum is used to correct for this by producing a checksum that depends on the order in which variables are stored. If your checksum doesn't agree, you have either entered lines in the wrong order or misspelled a variable name. In either case, you must correct your error(s) and then go through the LIST/NEW/ENTER sequence to ensure that the variables are in the correct order.

The length shown is the number of bytes in the tokenized program that are encountered by TYPO within the indicated line-number range. The two-letter code is essentially a checksum of "length" bytes within that same range. If the length is correct but the code is wrong, you may have made a spelling or punctuation error. Be careful: since all keywords and operators (including two-character operators such as "<>") are tokenized as one byte, the length may stay the same even though you type SETCOLOR for CLR. You may use abbreviations for keywords (see "Appendix A" of the BASIC Reference Manual) as long as the LISTed result conforms to the magazine listing.

If the length bytes disagree, you have added or deleted characters. If nothing obvious shows, pay special attention to characters in quoted strings and/or REM statements. It is easy to omit a space or punctuation in a REMark, thinking that "REMs don't matter." But to TYPO, they do.

"TYPO" first appeared in Volume I, Number 3 of ANTIC, and was reprinted in Volume 2, Number 1. Now that our listings are set in a monospaced font, we reprint it here as a service to our many new readers. Bill Wilkinson, Vice- President and Technical Director of Optimised Systems Software, Inc., was one of the original designers of Atari BASIC. -ANTIC ED

Listing: TYPO.LST Download / View