Version Detective
Sanity tool for sysops and programmers
by Jeffrey Summers, M.D.
Version Detective quickly determines whether or not two files are identical. This is a great aid for BBS sysops and users group librarians who must weed out duplicate files to conserve disk space. This BASIC program works on all 8-bit Atari computers of any memory size, with disk drive.
Since DOS filenames are limited to less than a dozen characters, it's easy to imagine how a users group disk librarian or a BBS sysop can wind up with several files called MENU.EXE, READ.ME and even MYPROG.BAS. It's then up to the librarian or sysop to search and destroy these duplicate files. But how can you tell if two likenamed files are really different? There's nothing else to do but personally examine the file listings side-by-side. And if you need to compare Machine language files, which cannot easily be LISTed, you've really got a problem.
Programmers also face similar problems. Writing a program is usually a series of approximations. Rarely will the program work as expected the first time around. Then after a few bugs are found, others rear their ugly heads. So it becomes a programmer's challenge simply to keep track of which is the most current version of a program in development--and what changes were made from the prior versions. This becomes especially important when you discover that your "fix" didn't work and you want to go back to the previous version.
To compare disk files easily and without hassles, I wrote Version Detective. This BASIC program compares two files at machine language speed and displays the first mismatch. Version Detective will work with any type of file. It will compare pairs of files written in any programming language, text editor, or word processor. And there is no limit to the length of the files. In several tests, Version Detective compared two 200-sector disk files in less than 90 seconds.
GETTING STARTED
Type in Listing 1, FILCOMP.BAS, check it with TYPO II and SAVE a copy before you RUN it.
When RUN, Version Detective will display a disk directory and ask you for the name of the first file to compare. If your file is on disk drive number one, you needn't type the "D1:" prefix. Just type the filename and press [RETURN].
If you need to see a directory of another disk, place it in drive #1 and press [RETURN]. Version Detective will display a fresh directory and then ask you for the second filename.
Version Detective will quickly compare the two files byte-by-byte and stop when it finds the first mismatch. It will also tell you if one file is longer than the other.
When the first mismatch occurs, Version Detective displays the mismatch in a pair of error windows.
Each window shows a 256-byte block of the file. The left window corresponds to the first file, the right window shows the second file. Each window is approximately 19 characters wide and 14 characters tall. Any [RETURN] symbols will make the window taller. If your file has an abundance of [RETURN]s, the tops of your error windows may scroll off the top of the screen.
The mismatched byte is displayed below its corresponding error window. Version Detective tells you the location of the mismatch, as well as the position of the mismatch in the error window. For example, a sample error report might read: "Mismatch at byte #515, (Byte #3 in the error window.")
SAMPLE CASE
Let's go through an example. Type the following program lines: 10 REM THIS IS A TEST OF
20 REM THE VERSION DETECTIVE
30 FOR I = I TO 1000:REM THE OUTER LOOP
40 FOR J = I TO 5: REM THE INNER LOOP
50 PRINT I*J;" ";:REM PRINT PRODUCT
60 NEXT J:REM END OF INNER LOOP
70 PRINT :REM KEEP THINGS NEAT
80 NEXT I:REM END OF THE OUTER LOOP
90 REM THIS IS THE END
100 END
LIST the program to disk with the filename "D:TEST1.LST" and then change END to XYZ in line 90:
90 REM THIS IS THE XYZ
LIST this modified program to disk with the command:
LIST "D:TEST2.LST"
RUN the Version Detective program. Type TEST1.LST as the first filename and TEST2.LST the second.
Version Detective will quickly compare the listings and display two error windows. The program will display an E beneath the left window, and an X beneath the right one. This is the first mismatch. Beneath this, Version Detective will display:
Mismatch at Byte #281
(Byte #25 in the window)
The files TEST.1 and TEST.2 are identical through the 280th byte. The first mismatch occurred at byte number 281, where the first file had an E and the second file had an X. You can see this for yourself by examining the 25th byte in the error windows.
Rochester New York physician Jeffrey Summers is also represented in this issue with the Extra Disk Bonus Antic Data-X, Revision B.
Listing:FILCOMP.BAS Download