D:CHECK2

16K Disk
by Istvan Mohos and Tom Hudson


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

CHECKing your typing.

  1. Type in the program listing desired from the magazine. Visually check it for obvious errors (missing lines, etc.)
  2. LIST the program to be checked to disk. Use the command:
    LIST "D:PROGNAME"
  3. LOAD D:CHECK2 and RUN it.
  4. D:CHECK2 will ask for a filename. Respond:
    D:PROGNAME
    and press RETURN.
  5. D:CHECK2 will ask for an issue number. Just type the issue number and press RETURN.
  6. D:CHECK2 will execute. The screen will go black in order to speed up the program.
  7. When D:CHECK2 finishes, it will display final instructions. At this time you should type NEW and press RETURN.
  8. When D:CHECK2 executed, it created a BASIC file on disk called BUG. ENTER it into your computer with the command:
    ENTER "D:BUG"

This file 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 first 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 D:CHECK2.

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 BUG file, 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 BUG checksums, we find that the seventh checksum is 244 in the BUG 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 BUG file 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 BUG file. Looking at the BUG file, 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 D:CHECK2 program. Next, bring the program being checked into memory by typing:

ENTER "D:PROGNAME"

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

CHECK.LST is available in ATASCII format.

This BASIC listing uses an image to display special characters
Checksum Data
10 DATA 44,815,767,524,686,389,806,850
,86,721,921,593,591,704,974,9471
160 DATA 482,125,389,696,567,797,442,5
61,230,89,717,216,943,541,299,7094
310 DATA 719,711,741,427,244,435,288,5
84,553,441,711,499,803,322,515,7993
460 DATA 246,684,406,232,123,700,480,7
74,500,4145

Previous | Contents | Next

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