Classic Computer Magazine Archive ANTIC VOL. 5, NO. 7 / NOVEMBER 1986

Auto TYPO

"Fail-safe" key boarding for TYPO II

BY BRIAN SANDFORD

In this enhancement of Antic's TYPO II listing proofreader, you type each two-letter TYPO code before the line number. If you make a typing mistake anywhere in the line, a beep sounds and the screen turns red. An optional Review mode lets you check TYPO II codes after you have finished typing an entire program. The BASIC program can be used with all 8-bit Atari computers of any memory size, with disk or cassette.

I wrote AutoTYPO because when I enter a program listing I prefer to keep typing away until something goes wrong-and I wanted the proofreading software to automatically grab my attention when something has gone wrong. For me, AutoTYPO is a faster tool for checking program typing than the standard TYPO II. (Antic deliberately kept the original TYPO II as short and simple as possible, because it is used by so many Atari beginners. This has left a lot of room for more experienced programmers to create interesting enhancements to the automatic proofreader. Exactly one year ago (November 1985, page 21), Antic brought together four of the best reader-contributed short enhancements for TYPO II in Super Duper Typo II'per (S.D.T.2.P.), including a machine language subroutine that makes the program run much faster. AutoTYPO uses the same speedy subroutine.-ANTIC ED)

Auto TYPO screen

Using the old TYPO II method, you must keep glancing back and forth to compare the two-letter checksum codes on your screen and in the type-in listing pages of Antic. If you make a mistake such as accepting a CN code for a CM on just one line, your listing won't run even though you thought you proofed it 100% correctly.

Now, with improved AutoTYPO, you'll bravely ignore those pointing fingers on the pages of the Antic listings section that warn you, "Don't type the TYPO II codes." In exchange for the small amount of extra work required to type in the two-letter codes at the left of each line number, you get a proofreading system that gives you better safeguards against human error-and, for touch typists, is faster.

Here's what happens when you enter a listing using AutoTYPO. Type in everything on the line, starting from the left-the uppercase two-letter TYPO II code, the line number and the program line. Press [RETURN]. If the line is entered correctly, the cursor just jumps to the next input line.

But...if the line is incorrect, there is a beep, the screen turns red and you cannot go on to the next line. You must retype the TYPO II code and press [RETURN] to redisplay the current line for editing. Use the normal BASIC editing keys to type the line corrections.

OPERATING AUTOTYPO

AutoTYPO and TYPO II share many common line numbers, so you cannot use TYPO II to check AutoTYPO. But you may use AutoTYPO to check itself, a process that will be described later. Therefore, carefully type in Listing 1, AUTOTYPO.LST, and LIST a copy to disk or cassette.

If you have trouble typing the special characters in line 32026, Listing 2 will create this line for you. Type in Listing 2, checking it with TYPO II, and SAVE a copy before you RUN it. When RUN, Listing 2 creates a file which contains line 32026. This line may also be used with the TYPO II Double Feature (Antic, November 1985).

Note that a LISTed program can be merged with other programs already in the computer's memory. (SAVEd programs can't.) This lets you use AutoTYPO to check Antic programs and program fragments already SAVEd to disk or cassette. Just LOAD your program fragment before you ENTER D:AUTOTYPO.LST, and you're ready to go.

To start AutoTYPO, type GOTO 32000, press [RETURN] and follow the onscreen instructions.

Only uppercase letters are accepted for the TYPO II codes. Illegal TYPO II codes, such as lowercase or inverse-video characters, sound a beep. If an incorrect code is entered, you can exit by typing any letter instead of a line number, followed by [RETURN]. The program doesn't accept blank program lines or lines without line numbers.

As explained above, to call back a line for editing you type an asterisk * followed by the desired line number then press [RETURN]. If the line has no BASIC syntax error, its computed code is shown in the code window If that line doesn't exist, the line number will remain for a program line to be entered. This protects you from accidentally entering a new line over an existing one.

To delete a line, just press [RETURN], type the two-letter line code followed by the line number, and then press [RETURN] again.


Bravely ignore the pointing
fingers a warn, "Don't
type the TYPO II codes"


[CONTROL] [B] returns you to BASIC and displays a READY prompt. Any entered program plus the AutoTYPO program remains in memory.

[CONTROL] [L] gives you a screen with the prompt, "ENTER list device (X:FILENAME.EXT)." If "D:MYPROGRM.LST" is entered, lines 0 to 31999 are listed to disk drive 1. A "C: instead of the "D: lists to the cassette and "P: lists to the printer.

[CONTROL] [R] activates AutoTYPO's Review mode, which displays each line and TYPO II code of an Antic BASIC listing (or fragment) that you typed previously Press any key to review the next line. Press [CONTROL] [D] to leave this mode.

Since the Review mode always begins with the first line of a program, you should note any lines with errors and then correct them in the Edit mode with the asterix [*] command.

Here's how to use AutoTYPO to proofread itself. First, change the number "31999" in line 32420 to "40000". Next, type GOTO 32000 and press [CONTROL] [R] to enter the Review mode. Finally, use the above procedure to check all the lines in AutoTYPO.

Enjoy using AutoTYPO, but make sure all lines in a program have been typed into the listing, because AutoTYPO cannot check for missing lines.

Brian Sandford lives in Concord, Massachusets and this is his first appearance in Antic.

Listing 1: AUTOTYPO.LST Download / View

Listing 2: LINES.BAS(not needed)



Understanding Checksums

BY PATRICK BASS -ST PROGRAM EDITOR

When information is stored in machine-readable form, we need a way to he sum that the recovered information is exactly what was stored. Even dropping a single bit in a character can change its value dramatically.

Checksums are the computer-generated tools for ensuring accurate transfer of large amounts of information either numbers or characters Personal computers can produce different types of checksums for different jobs.

The simplest (and least effective) form of a checksum is the parity bit, which is sometimes added to the leading edge of a byte when transmitted through a modern. Since any ASCII character can be represented by only seven bits, people sometimes agree to use the eighth (parity ) bit as error correction for each byte transmitted. If the byte has an odd number of bits set, the parity bit is set. If the bite has an even number of bits set, the parity bit is cleared. (See Figure 1.)

When the byte is received, the number of bits set in it are counted and the parity bit is checked to see if it matches the required "even-odd" condition. It it doesn't, an error has probably occurred and the program post a warning.

The parity bit protects a single byte. For insuring the integrity of a whole collection of bytes at once, we turn to a more intelligent form of error-correction. When people send large amounts of diata back and forth online, they often use XMODEM, a standard which allows the transmission of blocks of information (typically 128, 256. or 1024 bytes long). This is followed by a checksum of all the bytes in the block.

The entire block of bytes is checked for integrity at one time. If the receiver-computed checksum doesn't match the transmitted checksum, the receiver usually asks the transmitter to re-send the block.

Figure 1
Partity Bit

NCR AND CD

Next time you stay at a large hotel such as Holiday Inn, look at the entries on your bill when you leave. You'll find not only the amount entries, but two additional digits an inch or so to the right of each line. These are checksum codes guarding against human errors in keying data into the computer that runs the cash register.

Hotels normally ring up every bill for every guest every night. If guests already have balances on their bills, the night clerk must punch in the previous balance, ring up the latest charges and total up the new bill. Sleek, computer-run cash registers like the NCR 2250 simplify that. Whenever a new total for each bill is computed, the register also computes a checksum. Next time the clerk punches in the old balance and checksum into the machine, the NCR computes a new checksum of the amount entered. If the checksum doesn't match what the clerk punched in, the NCR just sits and beeps.

The amount of information on a silvery Compact Disk is staggering. And since the information on a CD is just binary numbers, we find a need for our old friend, the checksum. The CD player digests information in groups of as many as 566 bits at a time. Up to 64 bits of error-correction information are encoded with each group.

THE ANTIC WAY

At Antic, we use two different forms of checksums. For our 8-bit BASIC TYPO II listings, we use a checksum which is computed using a form of position-dependent summation. This works well for Atari BASIC because we can check each line as it is typed. Each character in the line is checked, and the two-letter is checksum printed left of the BASIC line number onscreen. You then compare these checksums to the codes printed next to each BASIC line in the magazine listing. If they match, you probably typed the line correctly.

By the way, you can use Antic's TYPO II to generate correct checksum codes for the type-in listings in the two other magazines that regularly publish some programs for 8-bit Ataris.

For our TYPO ST program, we use simple summation, because we are dealing with ASCII files of unknown format. Here, the values for all characters in each line-except for spaces- are added together. Each line's total is then converted into a four-digit hexadecimal number and the result is displayed or printed. You compare your TYPO ST table with the table published after the ST BASIC program in the magazine. Any line that doesn't match should be rechecked carefully.

The computer world couldn't exist without checksums. They are, in a real sense, the insurance policy of information transfer.