File Comparison Utilities on CP/M

There are many utilities available for CP/M to compare the differences between files and to distribute those differences. All the utilities in this article can be found on the Walnut Creek CD.

Binary File Comparison

The easiest type of comparison is between two binary files such as between two .COM files. Here we just want to know which bytes of changed and at which location. This can be particularly useful for discovering locations to patch a .COM file if the documentation isn't forthcoming or to create a tool to automate the process. Each tool below offers something different.

COMPARE

The earliest program I have found to detect if binary files differ is COMPARE. It is one of the many utilities created by Ward Christensen and although this version is from 1978 the source code shows that it was first released in 1977 and therefore supports the 8080. It is quite a simple utility which compares two files, displays the first difference and then stops. Due to its simplicity it weighs in at just 2Kb.

KOMPARE

My favourite binary comparison program is KOMPARE which displays 8 rows of 16 bytes for each file, one after the other with its ASCII equivalent on the side. Where the bytes are the same they are clearly marked in the second file. The addresses displayed start at 0100h for a .COM file or 0000h for all other files. KOMPARE.COM is only 2Kb but unfortunately requires a Z80. The archive also includes COMPARE.COM which seems to be based on COMPARE.COM mentioned previously. The author of KOMPARE mentions that they use COMPARE when trying to disassemble and reassemble, to easily find differences as they go along without seeing all the differences at one go.

DIFCOM

DIFCOM v1.6 was released in 1983 by Harry J Smith along with its PL/I source code. It is similar to KOMPARE in that it displays using a 16 byte row with ASCII on the side. However, DIFCOM displays 16 bytes of one file immediately followed by 16 bytes of the next file. Another significant difference is that the files can't be specified on the command line as they have to be entered interactively. On the plus side you can send the output to a printer, file or to the console. DIFCOM16.COM is 15Kb and supports the 8080.

COMP

The simplest utility here is COMP v1.3, released in 1987. It compares two files and displays their differences side by side along with the address of the difference for each byte that differs. The addresses start at 0100h and there is no accompanying ASCII display of the bytes. COMP is only 1Kb and supports the 8080.

Text File Comparison

Unlike binary file comparison, text comparison looks at lines of text and tries to sync matching lines so that only the lines that have changed or have been inserted or removed are shown. This is great for all sorts of situations where it is important to see how a text file changed such as a source code file if multiple people are working on it.

TEXTCOM

When it comes to comparing text files, TEXTCOM v1.6, released by G. Nigel Gilbert in 1983, is one of the most configurable programs and provides a nice clear output showing the differences between files. It takes options to say how many lines are needed to sync files, whether to use the high-bit (for Wordstar, etc), whether you want to send output to a file or printer, etc. The output often looks similar to that of DIF described next. TEXTCOM.COM is 12Kb and supports the 8080 processor.

DIF / SSED

Chuck Forsberg says, in his 1981 release document for DIF/SSED v2, that he wanted to find a better way of distributing software updates.

Lately (if not sooner) it has become obvious that there must be a better and cheaper way to distribute software updates to changing programs than to transmit all of the new files in their totality, even though only a few lines in each have been changed.

The library contains executable files DIF2.COM and SSED2.COM. The first, DIF2.COM, will output the file differences in a similar way to TEXTCOM but has the additional ability to unsqueeze input files. However, the biggest difference is that it can output an editor script which contains the differences in a format which can be used by SSED2.COM to recreate the second file from the first. This is great when you want to just distribute the changes you have made to files without having to distribute complete new files.

The utilities work pretty well partly because DIF puts CRC values into the editor scripts which SSED then checks to ensure that the correct input file is being operated on. However, there are a couple of things to watch because of the way that CR/LF and ^Z are handled, recreated files may not be exact copies of the original. This is expected behaviour and is explained in its accompanying documentation.

The programs do have a couple of bugs: Sometimes the last line number is reported inaccurately when showing differences between files; Occasionally SSED2 will hang if it reaches the end of the input file unexpectedly.

Both of these utilities have been updated with versions that are smaller and faster but no longer support the BDS style pipes. They are both 10Kb and continue to support the 8080. They are released separately as: DIF v2.2 and SSED v2.2.

Video

The following video shows the utilities being used.

Creative Commons License
File Comparison Utilities on CP/M by Lawrence Woodman is licensed under a Creative Commons Attribution 4.0 International License.

Share This Post

Feedback/Discuss

Related Articles

Modula-2 Compilers on CP/M

Modula-2 is a great language in general and is a good choice for programming on CP/M. There are three good compilers available for CP/M which all require a Z80 processor and we'll compare each in turn...   Read More

XCCP: A Shell Extension for CP/M

XCCP describes itself as an Extended Console Command Processor for CP/M. It supports the 8080 and v1.0 was released by Anton R. Fleig in 1984. Like EPEX, XCCP doesn't require installing so we can begi...   Read More

EPEX: An Environment Extension for CP/M

Epex is an evironment extension for CP/M. It stands for Environmental Processing EXecutive, and v1.1 was released by James H. Whorton in 1986. It can make using CP/M much more comfortable at the cost...   Read More

Breakout Style Games on CP/M

Breakout style video games were pretty popular at one time both at Arcades and on home computers. The games are based on a simple concept where you have to destroy a group of 'bricks' at the top of t...   Read More

Hamurabi and Similar Games on CP/M

Hamurabi is probably the best known land and resource management game on CP/M. However, there are a few other similar text-based games that sought to extend the concept such as Dukedom and Kingdom. T...   Read More