C:CHECK

16K Cassette
by Istvan Mohos and Tom Hudson


When typing programs into your computer from ANALOG Computing, there is always a chance of making a mistake. C:CHECK will help you find such errors very easily. Type in the accompanying program and SAVE it. Follow the instructions below to check C:CHECK as you would any other program.

CHECKing your typing.

  1. Type in the program listing from the magazine. Visually check it for obvious errors (missing lines, etc.).
  2. LIST the program to be checked to cassette. Use the command:
    LIST "C:"
  3. LOAD C:CHECK and RUN it.
  4. C:CHECK will ask you if you want the output to go to the screen or printer. Type S for screen or P for printer and press RETURN.
  5. C:CHECK will ask for an issue number. Just type the issue number and press RETURN.
  6. Position the tape to the beginning of the program to be checked and press PLAY on the program recorder. Press RETURN.
  7. C:CHECK will begin reading the program from tape and generate a checksum table. This data should match the "CHECKSUM DATA" printed after the program listing you are checking. The following example shows how to check for errors.
Magazine Checksum Data
10 DATA 34,455,234,22,55,38,93,45,114,
285,633,442,453,23,31,2957
160 DATA 82,94,64,73,347,199,287,84,15
6,368,59,40,98,9,342,2302
310 DATA 65,356,101,25,547
C:CHECK output
10 DATA 34,455,234,22,55,38,244,45,114
,285,633,442,453,23,31,3108
160 DATA 82,94,64,73,347,199,287,84,15
6,368,59,40,98,9,342,2302
310 DATA 65,101,34,200

Each line of the program being checked has its own checksum value. If any characters in the line are incorrect, the checksum value will be different from the corresponding value in the magazine. The checksum data is set up so that there are 15 checksum values in each line with the 16th value containing the total of the checksums.

The line number of the checksum line tells which line number is first in the checksum group. In the example above, the first line checked in the checksum line is 10, and its checksum is 34. The first line checked in the second checksum line is 160, and its checksum is 82. The first line checked in the third checksum line is 310, and its checksum is 65.

Let's assume the CHECKSUM DATA above was listed in the magazine, and you typed in the program and checked it with C:CHECK.

The first thing to do would be to look at the total of the values in the first line. This value should be 2957, as shown in the magazine CHECKSUM DATA. However, in the results in the C:CHECK output, the total is 3108. This means that there is an error in the 15 checksum values in this line. Comparing the magazine checksums to the C:CHECK output, we find that the seventh checksum is 244 in the C:CHECK data, and should be 93. This means that there is an error in the seventh line of the program. Note the error and continue checking. The rest of the line is correct, so we go on to the second line.

Now we check the total of the second line of checksum data. The total of 2302 in our C:CHECK data matches the total in the magazine, so we can go on to the third checksum line.

The third checksum line is different from the others in that it only checks four lines. This is because it is at the end of the program, and the program did not have an even multiple of 15 lines. The line is checked the same as the others. As you can see, the total of the line should be 547, but is only 200 in the C:CHECK data. Looking at the C:CHECK output, you will notice that there is one less checksum value (the 356 in the magazine checksum data). This means that the first line in the program after line 310 is missing. The last checksum in this line is also incorrect. It is a 34 and should be 25. This means that the third line after line 310 in the program is incorrect.

To summarize, there were 3 errors in the program we checked. Two errors were caused by mistakes in the lines, and a third appeared because a whole line was missing.

Once you have noted all errors, type NEW and press RETURN. This erases the C:CHECK program. Next, bring the program being checked into memory by positioning the tape and typing:

ENTER "C:"

If the program had errors, correct the lines in error. If there were no errors, the program is correct and ready to run.

BASIC Listing

CCHECK.LST is available in ATASCII format.

This BASIC listing uses an image to display special characters
Checksum Data
100 DATA 198,759,11,135,191,594,198,80
6,763,467,931,100,465,572,107,6297
250 DATA 764,922,11,168,375,783,304,25
9,534,890,875,136,732,361,7114

Previous | Contents | Next

Original text copyright 1984 by ANALOG Computing. Reprinted with permission by the Digital ANALOG Archive.