Advanced Use of .LBR files on CP/M

Lots of utilities make use of .LBR (Library) files to provide extra facilities such as the ability to run commands from archives or mount them as if they were drives. This article shows some more advanced uses of .LBR files and is a follow-up to our previous article: Working with .LBR files on CP/M.

Setting Dates

Later versions of the .LBR file format definition added support for dates. On CP/M these can be set using SETD v2.2, dated 1988 by Brent B. Powers. These dates can be seen using LDIR-B v2.20 as mentioned in the previous article on .LBR files. The dates can be supplied at the command line or if you have a real-time clock you can write a small piece of code to query it.

Unusually for 1988 one of the files, SETD22.UPD, contains a warning about what may happen with the dates in the year 2000. In reality this was more of a problem with the 2 digit years used by SETD and LDIR-B than the .LBR format as the latter uses Digital Research's Julian date format which records the number of days from 31 December 1977 as a 16-bit number. This would support dates properly up to around the year 2157.

The archive for SETD v2.2 contains an interesting history of its previous versions as listed below:

Version 2.0 was the original assembly language version, recoded
from the TurboPascal version, in turn recoded from the
TurboModula-2 version, which was, finally, a translation of C.B.
Falconer's LSETDATE, with a slightly different date-parsing
algorithm.

I find it interesting that it went through three languages and in particular at one point was written using Turbo Modula-2, a language which didn't exist for very long on CP/M. The Turbo Pascal version is SETD v0.1, dated 17 Oct 1987.

Finding Files Within .LBR Archives

If we have lots of .LBR archives it can be difficult sometimes to remember exactly which archive contains a particular file. To search these archives we can use LFIND v1.13, dated 8 Nov 1984 by Martin Murray. LFIND allows us to search all the .LBR files on all drives and for all users to see which contain a matching filespec. It works really well but only on CP/M 2.2 as on CP/M Plus it lists somes files multiple times.

Mounting .LBR Archives as a Drive

It is possible to mount a .LBR or a number of .LBR archives as if they were a drive using LBRDSK v2.3, dated 13 Feb 1985 by Jim Lopushinsky. From here you can read and write to them, although writing isn't ideal because it can clobber files that follow a file if you are altering an existing one. The LBRDSK archive contains SETRSX11.COM which is used to provide RSX facilities on CP/M 2.2 and for this reasons it will only work on CP/M 2.2.

LBRDSK can be used as follows. To access LBRDSK23.LBR as if it was drive E: in read/write mode:

A> LBRDSK E:=LBRDSK23.LBR

To access the members of all the .LBR archives as if they were on drive E: in read mode:

A> LBRDSK E:=*.LBR

Running Commands

It is possible to run programs directly from a .LBR archive using LRUN v2.3, dated 8 Jul 1985 originally by Gary P. Novosielski. This is very useful if you have lots of small .COM files on a disk as by including them in a .LBR archive you can reduce the amount of space they take up because there may be be less wasted space if they are not a multiple of the block size. If you don't supply LRUN with a .LBR file then it will default to 'COMMAND.LBR'. This works very well, however it isn't suitable for all programs as they may need to access other files which can't be contained in the archive. It should also be noted that the member files can't be compressed.

As an example, if we wanted to run LFIND.COM contained in TOOLS.LBR we could use:

A> LRUN -TOOLS LFIND

Alternatively if LFIND.COM was in COMMAND.LBR we could use:

A> LRUN LFIND

Basic Information

Below is some basic information about each utility that you may find useful and interesting.

NameVersionDate Size (Kb)8080 Compatible
SETD2.210 Feb 19883
LFIND1.138 Nov 19845
LBRDSK2.313 Feb 19858+1
LRUN2.38 Jul 19852

Video

The following video shows these .LBR utilities in action.

Creative Commons License
Advanced Use of .LBR files on CP/M by Lawrence Woodman is licensed under a Creative Commons Attribution 4.0 International License.

Share This Post

Feedback/Discuss

Related Articles

Working with .LBR files on CP/M

The .LBR (Library) file format was the most common form of multi-file archive on personal computers at one time. It was created by Gary P. Novosielski in 1982 for use by his LU (Library Utility) progr...   Read More

Compression and Archiving on CP/M

CP/M has the ability to handle lots of different compression and archive formats which was important due to the limited capacity of floppy disks and the cost of downloading/uploading files on BBS's. T...   Read More

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